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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions posthog/temporal/batch_exports/bigquery_batch_export.py
Original file line number Diff line number Diff line change
@@ -295,9 +295,14 @@ async def acheck_for_query_permissions_on_table(
):
"""Attempt to SELECT from table to check for query permissions."""
job_config = bigquery.QueryJobConfig()
query = f"""
SELECT 1 FROM `{table.full_table_id.replace(":", ".", 1)}`
"""
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.

"""
else:
query = f"""
SELECT 1 FROM `{table.full_table_id.replace(":", ".", 1)}`
"""

try:
query_job = self.query(query, job_config=job_config)