You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@mkmoisen, python-oracledb (and cx_Oracle before it) has never handled timezone aware datetime instances, mostly due to the fact that there is no C API for doing so. I have given some thought to adding support for it anyway, ensuring that it is opt-in since the performance will be considerably reduced in that case.
Note that when you insert a datetime.datetime instance, the default bind type is DATE, not TIMESTAMP. Try inserting with sysdate vs systimestamp and you will note a difference. Note as well that there is a difference between the database time zone (dbtimezone) and the session time zone (sessiontimezone).
I just tried your code and I see the results coming as expected. Fetching the values back returns the same values (naive, of course) and examining the data in the database shows the session time zone has been applied.
What version of the database and client (in thick mode) are you using?
Oracle 19
platform.platform: Linux-4.18.0-372.76.1.el8_6.x86_64-x86_64-with-glibc2.28
sys.maxsize > 2**32: True
platform.python_version: 3.13.0
oracledb.version: 2.4.1
Error
When inserting a naive or a timezone aware datetime into an oracle TIMESTAMP WITH TIMEZONE column, the result is always saved in GMT.
I'm under the impression that it didn't used to do this.
This bug is happening in both thick and thin mode.
The same bug occurs in thinmode and thickmode.
This outputs:
The text was updated successfully, but these errors were encountered: