diff --git a/posthog/temporal/batch_exports/temporary_file.py b/posthog/temporal/batch_exports/temporary_file.py index 75cde8a9b651b..079cce001d235 100644 --- a/posthog/temporal/batch_exports/temporary_file.py +++ b/posthog/temporal/batch_exports/temporary_file.py @@ -1,6 +1,7 @@ """This module contains a temporary file to stage data in batch exports.""" import abc +import asyncio import collections.abc import contextlib import csv @@ -390,7 +391,7 @@ async def write_record_batch(self, record_batch: pa.RecordBatch) -> None: column_names = record_batch.column_names column_names.pop(column_names.index("_inserted_at")) - self._write_record_batch(record_batch.select(column_names)) + await asyncio.to_thread(self._write_record_batch, record_batch.select(column_names)) self.last_inserted_at = last_inserted_at self.track_records_written(record_batch)