diff --git a/posthog/temporal/batch_exports/bigquery_batch_export.py b/posthog/temporal/batch_exports/bigquery_batch_export.py index b1eee8b98d0b7..edaf13d1888af 100644 --- a/posthog/temporal/batch_exports/bigquery_batch_export.py +++ b/posthog/temporal/batch_exports/bigquery_batch_export.py @@ -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)