oracle/python-oracledb (original) (raw)
Continued from #2
Timestamps fetched by oracledb
have different values that those fetched by cx_Oracle
. Using alter session set time_zone
doesn't make a difference.
Python 3.10.4 (main, Apr 26 2022, 19:42:59) [Clang 13.1.6 (clang-1316.0.21.2)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.3.0 -- An enhanced Interactive Python. Type '?' for help.
🐍 — 1 ❯ odb = oracledb.connect("user/pwd@db")
🐍 — 2 ❯ cdb = cx_Oracle.connect("user/pwd@db")
🐍 — 3 ❯ oc = odb.cursor()
🐍 — 4 ❯ cc = cdb.cursor()
🐍 — 5 ❯ oc.execute("alter session set time_zone='Europe/Berlin'")
🐍 — 6 ❯ cc.execute("alter session set time_zone='Europe/Berlin'")
🐍 — 7 ❯ cc.execute("select start_date from dba_scheduler_jobs where job_name = 'LOG_CLEANUP_JOB'").fetchone()
🐍 — 7 ❮ (datetime.datetime(2019, 3, 26, 4, 33),)
🐍 — 8 ❯ oc.execute("select start_date from dba_scheduler_jobs where job_name = 'LOG_CLEANUP_JOB'").fetchone()
🐍 — 8 ❮ (datetime.datetime(2019, 3, 26, 2, 33),)
🐍 — 9 ❯
The script
import sys, platform, oracledb
print(f"{platform.platform()=}") print(f"{sys.maxsize > 2**32=}") print(f"{platform.python_version()=}") print(f"{oracledb.version=}")
gives the following output on my machine:
platform.platform()='macOS-12.4-x86_64-i386-64bit'
sys.maxsize > 2**32=True
platform.python_version()='3.10.4'
oracledb.__version__='1.0.0'
I'm using oracledb
in thin mode.
The following Oracle related environment variables are set:
export ORACLE_HOME=~/oracle/instantclient_12_2 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$ORACLE_HOME export PATH=$PATH:$ORACLE_HOME export NLS_LANG=GERMAN_GERMANY.AL32UTF8