I've connected to our databricks workspace with a sa.Engine, specifying the database/catalog as my-catalog:
>>>engineEngine(databricks://token:***@mycompany-test.cloud.databricks.com:443/my-catalog)
In this catalog I have a test schema which has a run_header_v1 table. Using the engine I can correctly autoload the table:
>>>importsqlalchemyassa>>>RunHeader=sa.Table(
... 'run_header_v1',
... sa.MetaData(),
... schema='test',
... autoload_with=engine,
... )
>>>RunHeaderTable('run_header_v1', MetaData(), Column('run_id', String(), table=<run_header_v1>, nullable=False), Column('start_time', TIMESTAMP(), table=<run_header_v1>, nullable=False), Column('end_time', TIMESTAMP(), table=<run_header_v1>, nullable=False), Column('run_type', String(), table=<run_header_v1>, nullable=False), Column('status', String(), table=<run_header_v1>, nullable=False), schema='test')When I try to use the Table object I get a TABLE_OR_VIEW_NOT_FOUND error (even though the same engine loaded the table in the first place!)
>>>withengine.connect() asconn:
... res=conn.execute(
... sa.select(sa.func.count())
... .select_from(RunHeader)
... ).scalar_one()
... Traceback (mostrecentcalllast):
<snip>ServerOperationError: [TABLE_OR_VIEW_NOT_FOUND] Thetableorview`test`.`run_header_v1`cannotbefound. Verifythespellingandcorrectnessoftheschemaandcatalog.
Ifyoudidnotqualifythenamewithaschema, verifythecurrent_schema() output, orqualifythenamewiththecorrectschemaandcatalog.
TotoleratetheerrorondropuseDROPVIEWIFEXISTSorDROPTABLEIFEXISTS. SQLSTATE: 42P01; line2pos5
I get the same error if I try to use the engine to execute the equivalent raw SQL:
>>>withengine.connect() asconn:
... res=conn.execute(sa.text("SELECT count(*) FROM test.run_header_v1")).scalar_one()
... <snip>DatabaseError: (databricks.sql.exc.ServerOperationError) [TABLE_OR_VIEW_NOT_FOUND] ...
I've connected to our databricks workspace with a
sa.Engine, specifying the database/catalog asmy-catalog:In this catalog I have a
testschema which has arun_header_v1table. Using the engine I can correctly autoload the table:When I try to use the
Tableobject I get aTABLE_OR_VIEW_NOT_FOUNDerror (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: