Skip to content

Docs: clarify how to set table location for trino on aws glue#3159

Merged
treysp merged 2 commits intomainfrom
trey/trino-glue-location
Sep 20, 2024
Merged

Docs: clarify how to set table location for trino on aws glue#3159
treysp merged 2 commits intomainfrom
trey/trino-glue-location

Conversation

@treysp
Copy link
Contributor

@treysp treysp commented Sep 19, 2024

No description provided.

@treysp treysp requested a review from erindru September 19, 2024 21:31
@erindru
Copy link
Collaborator

erindru commented Sep 19, 2024

MODEL (
name my_schema.my_model,
physical_properties (
location = 's3://my-bucket/'
Copy link
Collaborator

@erindru erindru Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One problem I found setting this at the model level is that the path doesn't automatically get adjusted for each snapshot. So you have the situation where SQLMesh creates multiple snapshots for the model in the same location and they clobber each other.

In the Athena adapter, I solved this by calling the property s3_base_location which allows the user to specify a base URI to put all the snapshots for this model and the adapter uses that to produce the actual table location property, eg <s3_base_location>/<snapshot_table_name>/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is definitely a problem! Would it make sense to pull that out into a mixin that we use in both Athena and Trino, or is it too specific?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could work as a mixin, it would essentially need to detect s3_base_location and rewrite it to location (injecting the snapshot table name) before handing the properties off to the adapter for further processing.

Perhaps a follow-up PR once the Athena one has been reviewed?

@treysp treysp force-pushed the trey/trino-glue-location branch from 637503e to 4d3d2bd Compare September 20, 2024 14:07
@treysp treysp enabled auto-merge (squash) September 20, 2024 14:07
@treysp treysp merged commit b3841c6 into main Sep 20, 2024
@treysp treysp deleted the trey/trino-glue-location branch September 20, 2024 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants