:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(data-imports): widen row_count to bigint for large synced tables (#113612)
Tom Owersa39c83a79c3b
diff --git a/products/warehouse_sources/backend/migrations/0182_datawarehousetable_row_count_bigint.py b/products/warehouse_sources/backend/migrations/0182_datawarehousetable_row_count_bigint.pynew file mode 100644index 000000000000..bb97a3427d78--- /dev/null+++ b/products/warehouse_sources/backend/migrations/0182_datawarehousetable_row_count_bigint.py@@ -0,0 +1,17 @@+# Generated by Django 5.2.17 on 2026-10-07 20:00++from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("warehouse_sources", "0181_repin_instagram_api_version"),+ ]++ operations = [+ migrations.AlterField(+ model_name="datawarehousetable",+ name="row_count",+ field=models.BigIntegerField(help_text="How many rows are currently synced in this table", null=True),+ ),+ ]diff --git a/products/warehouse_sources/backend/migrations/max_migration.txt b/products/warehouse_sources/backend/migrations/max_migration.txtindex bcf64551730b..6a11f2924db7 100644--- a/products/warehouse_sources/backend/migrations/max_migration.txt+++ b/products/warehouse_sources/backend/migrations/max_migration.txt@@ -1 +1 @@-0181_repin_instagram_api_version+0182_datawarehousetable_row_count_bigintdiff --git a/products/warehouse_sources/backend/models/table.py b/products/warehouse_sources/backend/models/table.pyindex 9edb9a91aec4..eaf61778b053 100644--- a/products/warehouse_sources/backend/models/table.py+++ b/products/warehouse_sources/backend/models/table.py@@ -453,7 +453,7 @@ class DataWarehouseTable(CreatedMetaFields, UpdatedMetaFields, UUIDTModel, Deletoptions = models.JSONField(default=dict, blank=True)- row_count = models.IntegerField(null=True, help_text="How many rows are currently synced in this table")+ row_count = models.BigIntegerField(null=True, help_text="How many rows are currently synced in this table")size_in_s3_mib = models.FloatField(null=True, help_text="The object size in S3 for this table in MiB")__repr__ = sane_repr("name")diff --git a/products/warehouse_sources/backend/tests/test_table.py b/products/warehouse_sources/backend/tests/test_table.pyindex ccf86b9c8db7..358e1516ba33 100644--- a/products/warehouse_sources/backend/tests/test_table.py+++ b/products/warehouse_sources/backend/tests/test_table.py@@ -668,6 +668,19 @@ class TestUrlPatternChangeGuard(BaseTest):assert table.deleted is True+class TestRowCountColumnWidth(BaseTest):+ def test_row_count_beyond_32_bit_range_can_be_saved(self) -> None:+ # Postgres's `integer` column tops out at 2,147,483,647, so a synced table with more+ # rows than that must still be able to save through table.save().+ table = DataWarehouseTable(+ name="t", format="Delta", team=self.team, url_pattern="s3://bucket/team_1/t", row_count=2_147_483_648+ )+ table.save()++ table.refresh_from_db()+ assert table.row_count == 2_147_483_648++class TestModelsNamespaceGuard(BaseTest):def test_legacy_table_with_reserved_name_can_be_soft_deleted(self) -> None:[table] = DataWarehouseTable.objects.bulk_create(