Skip to content

read_sql from Oracle to polars truncates timestamp #273

Closed
@wKollendorf

Description

@wKollendorf

What language are you using?

Python

What version are you using?

0.2.5

What database are you using?

Oracle

What dataframe are you using?

polars, pandas, arrow2

Can you describe your bug?

When quering data from Oralce DB, timestamp columns are trunctated to date format (DD-MM-YYYY 00:00:00).

Example query / code
query = 'select timestamp_col from sample_db'
cx.read_sql(conn, query, return_type='polars')

Result:
2022-04-27 00:00:00

Converting timestamp to varchar (within query) and then to datetime (polars) it works:

query = 'select to_char(timestamp_col, 'YYYY-MM-DD HH24:MI:SS') as str_col from sample_db'
cx.read_sql(conn, query, return_type='polars').with_column(
          pl.col('str_col').str.strptime(pl.Datetime, '%F %T').alias('datetime_col') 
)

Result:
2022-04-27 18:21:22

What is the error?

No error message, but wrong dateime format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions