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

fix: Include partition column if present #26838

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

tomasfarias
Copy link
Contributor

Problem

We need to include the partition column when querying a table partitioned by timestamp.

Changes

Include partition column timestamp if present.

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

How did you test this code?

@tomasfarias tomasfarias requested a review from rossgray December 11, 2024 15:28
@tomasfarias tomasfarias enabled auto-merge (squash) December 11, 2024 15:28
"""
if "timestamp" in [field.name for field in table.schema]:
query = f"""
SELECT 1 FROM `{table.full_table_id.replace(":", ".", 1)}` WHERE timestamp IS NOT NULL
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whether the WHERE clause is actually doing something doesn't matter. BigQuery just checks a filter is there.

@tomasfarias tomasfarias merged commit a0b4361 into master Dec 11, 2024
90 checks passed
@tomasfarias tomasfarias deleted the fix/include-partition-column-if-present branch December 11, 2024 16:11
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