sqlmesh icon indicating copy to clipboard operation
sqlmesh copied to clipboard

"schema_name" config not applied to unqualified models with Athena

Open ksonbol opened this issue 10 months ago • 1 comments

Hi, This issue references a discussion in the Tobiko Slack. When using Athena as a gateway, the schema_name config is not applied to unqualified models and default is used instead.

@erindru 's explanation:

schema_name is a passed to the PyAthena driver, which injects it into the QueryExecutionContext part of the AWS API calls as Database (so the idea here is that the database driver effectively calls SET SCHEMA <schema_name> before running a query).

ksonbol avatar Mar 27 '25 12:03 ksonbol

Gonna go ahead and mark this as a bug for now. My theory is that SET SCHEMA at the driver level isn't useful in SQLMesh's case, because we automatically qualify models with a default schema before reaching the engine.

georgesittas avatar Mar 27 '25 13:03 georgesittas