Skip to content

Commit

Permalink
fix: Include partition column if present (#26838)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias authored Dec 11, 2024
1 parent d726d02 commit a0b4361
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions posthog/temporal/batch_exports/bigquery_batch_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
else:
query = f"""
SELECT 1 FROM `{table.full_table_id.replace(":", ".", 1)}`
"""

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

0 comments on commit a0b4361

Please sign in to comment.