Skip to content

Error fetching data to an OracleDataFrame with dates prior to 1970-01-01 #483

Closed
@G-Berg

Description

@G-Berg

I am using oracledb 3.1 to extract data, and an error occurs when there is any date less than or equal to 1970-01-01 in any date column.
Any date after 1970-01-01 works fine.

The code that demonstrates the problem is as follows:

sql = """
SELECT TO_DATE('1970-01-01', 'yyyy-mm-dd') AS DATA_REF FROM DUAL
"""

odf = conn.fetch_df_all(statement=sql, arraysize=100)

print(odf.column_names())
print(f"{odf.num_columns()} columns")
print(f"{odf.num_rows()} rows")

Error message:

--------------------------------------------------------------------------

OSError                                   Traceback (most recent call last)
Cell In[9], line 5
      1 sql = """
      2 SELECT TO_DATE('1970-01-01', 'yyyy-mm-dd') AS DATA_REF FROM DUAL
      3 """
----> 5 odf = conn.fetch_df_all(statement=sql, arraysize=100)
      7 print(odf.column_names())
      8 print(f"{odf.num_columns()} columns")

File [~\AppData\Roaming\Python\Python311\site-packages\oracledb\connection.py:810](http://localhost:8888/~/AppData/Roaming/Python/Python311/site-packages/oracledb/connection.py#line=809), in Connection.fetch_df_all(self, statement, parameters, arraysize)
    808     cursor.arraysize = arraysize
    809 cursor.prefetchrows = cursor.arraysize
--> 810 cursor.execute(statement, parameters)
    811 return cursor._impl.fetch_df_all(cursor)

File [~\AppData\Roaming\Python\Python311\site-packages\oracledb\cursor.py:708](http://localhost:8888/~/AppData/Roaming/Python/Python311/site-packages/oracledb/cursor.py#line=707), in Cursor.execute(self, statement, parameters, **keyword_parameters)
    706 self._prepare_for_execute(statement, parameters, keyword_parameters)
    707 impl = self._impl
--> 708 impl.execute(self)
    709 if impl.fetch_vars is not None:
    710     return self

File src\\oracledb\\impl/thin/cursor.pyx:277, in oracledb.thin_impl.ThinCursorImpl.execute()

File src\\oracledb\\impl/thin/protocol.pyx:450, in oracledb.thin_impl.Protocol._process_single_message()

File src\\oracledb\\impl/thin/protocol.pyx:451, in oracledb.thin_impl.Protocol._process_single_message()

File src\\oracledb\\impl/thin/protocol.pyx:419, in oracledb.thin_impl.Protocol._process_message()

File src\\oracledb\\impl/thin/protocol.pyx:395, in oracledb.thin_impl.Protocol._process_message()

File src\\oracledb\\impl/thin/messages/execute.pyx:262, in oracledb.thin_impl.ExecuteMessage.process()

File src\\oracledb\\impl/thin/messages/base.pyx:687, in oracledb.thin_impl.Message.process()

File src\\oracledb\\impl/thin/messages/base.pyx:1089, in oracledb.thin_impl.MessageWithData._process_message()

File src\\oracledb\\impl/thin/messages/base.pyx:1170, in oracledb.thin_impl.MessageWithData._process_row_data()

File src\\oracledb\\impl/thin/messages/base.pyx:931, in oracledb.thin_impl.MessageWithData._process_column_data()

File src\\oracledb\\impl/base/converters.pyx:246, in oracledb.base_impl.convert_oracle_data_to_arrow()

OSError: [Errno 22] Invalid argument

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions