Skip to content

feat(bigquery): Implement truncate with views #253

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

Conversation

iambriccardo
Copy link
Contributor

@iambriccardo iambriccardo commented Aug 11, 2025

This PR implements truncation in BigQuery in the following way:

  • Tables are created with monotonically increasing names in the form table_name_[n].
  • A view is created with the name table_name.
  • Every time there is a new truncate in the events batch, the truncate will create a new table with sequence number n + 1 and will atomically move the view to the new table.
  • In case of subsequent truncates on the same table, we will avoid creating empty tables, even though this case should be rare in practice.

@iambriccardo iambriccardo marked this pull request as ready for review August 11, 2025 13:53
@iambriccardo iambriccardo requested a review from a team as a code owner August 11, 2025 13:53
@iambriccardo iambriccardo merged commit b381c04 into main Aug 11, 2025
3 checks passed
@iambriccardo iambriccardo deleted the riccardobusetti/etl-156-find-a-solution-for-inability-to-truncate-bigquery-table branch August 11, 2025 14: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