Skip to content

Fix: Automatic derivation of a partitioning transformation for a time column in BigQuery#1389

Merged
izeigerman merged 2 commits intomainfrom
fix-bigquery-time-column-partition
Sep 6, 2023
Merged

Fix: Automatic derivation of a partitioning transformation for a time column in BigQuery#1389
izeigerman merged 2 commits intomainfrom
fix-bigquery-time-column-partition

Conversation

@izeigerman
Copy link
Contributor

No description provided.

if isinstance(this, exp.Column):
if partition_interval_unit == IntervalUnit.MINUTE:
raise SQLMeshError("BigQuery does not support partitioning by minute")
if isinstance(this, exp.Column) and partition_interval_unit != IntervalUnit.MINUTE:
Copy link
Contributor

Choose a reason for hiding this comment

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

For the case when partition_by is a column and we get an interval unit of a minute, is the thought to use the BQ error message instead of our own?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but the error message will only happen if the column is not date and the custom expression was not provided.

Copy link
Contributor

Choose a reason for hiding this comment

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

If the data type is timestamp or datetime, only providing the column will fail. Does it make sense to provide a better error message to the user of what to do? If they are relying on our "magic", it would be helpful to point them at documentation that informs them what to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd rather not hide BQ responses for now. If we can derive the partition automatically - great, if not - we should just let user interpret the error and provide a correct partition_by based on the error message they got from BQ.

@izeigerman izeigerman merged commit f151c22 into main Sep 6, 2023
@izeigerman izeigerman deleted the fix-bigquery-time-column-partition branch September 6, 2023 21:41
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