Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions airflow/providers/oracle/hooks/oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@
# specific language governing permissions and limitations
# under the License.

import math
import warnings
from datetime import datetime
from typing import Dict, List, Optional, Union

import cx_Oracle
import numpy

try:
import numpy
except ImportError:
numpy = None # type: ignore

from airflow.hooks.dbapi import DbApiHook

Expand Down Expand Up @@ -211,9 +216,9 @@ def insert_rows(
lst.append("'" + str(cell).replace("'", "''") + "'")
elif cell is None:
lst.append('NULL')
elif isinstance(cell, float) and numpy.isnan(cell): # coerce numpy NaN to NULL
elif isinstance(cell, float) and math.isnan(cell): # coerce numpy NaN to NULL
lst.append('NULL')
elif isinstance(cell, numpy.datetime64):
elif numpy and isinstance(cell, numpy.datetime64):
lst.append("'" + str(cell) + "'")
elif isinstance(cell, datetime):
lst.append(
Expand Down
3 changes: 3 additions & 0 deletions airflow/providers/oracle/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ integrations:
logo: /integration-logos/oracle/Oracle.png
tags: [software]

additional-extras:
numpy: numpy

operators:
- integration-name: Oracle
python-modules:
Expand Down