Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Sep 20, 2024

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 enabled auto-merge (squash) September 20, 2024 14:07
@treysp treysp merged commit b3841c6 into main Sep 20, 2024
13 of 14 checks passed
@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