Skip to content

Commit

Permalink
fix: Lowercase column names from custom query cursor description to m…
Browse files Browse the repository at this point in the history
…atch table equivalent which come back from Ibis in lower case
  • Loading branch information
nj1973 committed Sep 18, 2023
1 parent 6de9921 commit 963b370
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions third_party/ibis/ibis_oracle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,16 @@ def do_connect(
)
else:
sa_url = sa.engine.url.make_url(url)

self.database_name = sa_url.database
engine = sa.create_engine(sa_url, poolclass=sa.pool.StaticPool)

@sa.event.listens_for(engine, "connect")
def connect(dbapi_connection, connection_record):
with dbapi_connection.cursor() as cur:
cur.execute("ALTER SESSION SET TIME_ZONE='UTC'")

super().do_connect(engine)

super().do_connect(engine)

def _metadata(self, query) -> Iterable[Tuple[str, dt.DataType]]:
if (
Expand All @@ -76,6 +75,6 @@ def _metadata(self, query) -> Iterable[Tuple[str, dt.DataType]]:
result = con.exec_driver_sql(f"SELECT * FROM {query} t0 WHERE ROWNUM <= 1")
cursor = result.cursor
yield from (
(column[0], _get_type(column))
(column[0].lower(), _get_type(column))
for column in cursor.description
)

0 comments on commit 963b370

Please sign in to comment.