Open dhirschfeld opened 21 hours ago
I can avoid the error if I explicitly issue a USE CATALOG ...
statement on the connection before executing my query:
>>> with engine.connect() as conn:
... conn.execute(sa.text(f"use catalog `{engine.url.database}`"))
... res = conn.execute(sa.text("SELECT count(*) FROM test.run_header_v1")).scalar_one()
...
>>> print(res)
0
>>>
So, it looks like the sqlalchemy
integration isn't correctly setting the catalog when it is specified in the engine connection arguments.
This also works, but shouldn't be required:
def initialise_connection(conn, record):
with conn.cursor() as cursor:
cursor.execute(f"use catalog `{engine.url.database}`")
sa.event.listen(engine, 'connect', initialise_connection)
I've connected to our databricks workspace with a
sa.Engine
, specifying the database/catalog asmy-catalog
:In this catalog I have a
test
schema which has arun_header_v1
table. Using the engine I can correctly autoload the table:When I try to use the
Table
object I get aTABLE_OR_VIEW_NOT_FOUND
error (even though the same engine loaded the table in the first place!)I get the same error if I try to use the engine to execute the equivalent raw SQL: