Skip to content

thin mode: detect timezone #144

@BayerSe

Description

@BayerSe

The thin and the thick mode drivers behave differently with respect to timezones: thin uses UTC, whereas thick detects the local timezone. This is confusing for people migrating from cx_Oracle to the new thin driver, see e.g. #140.

It would be great if the thin mode driver would detect the local time zone, too, so that the following script always returns the same value, independent of the thick flag.

import oracledb

user ="..."
password = "..."
dsn = "..."

thick = False

if thick:
    oracledb.init_oracle_client()

with oracledb.connect(user=user, password=password, dsn=dsn) as connection:
    with connection.cursor() as cursor:
        tz = cursor.execute("SELECT SESSIONTIMEZONE FROM DUAL").fetchone()[0]

print(f"Timezone: {tz}")

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions