Skip to content

tables

tables

Table-specific invariants.

NoEmptyTables

Bases: ComparisonBInvariant

Verify no tables exist without any columns.

This is a sanity check to detect corrupted or improperly created tables.

name property

description property

check(expected_schema, actual_schema)

TableNamingConvention

Bases: ComparisonBInvariant

Verify tables follow Django's naming convention.

Django typically names tables as 'app_modelname'. This invariant checks that all non-Django tables follow this pattern.

name property

description property

check(expected_schema, actual_schema)

NoLegacyTables

Bases: ComparisonBInvariant

Verify no tables with legacy/deprecated prefixes exist.

This helps identify old tables that should have been removed. Customize the LEGACY_PREFIXES set for your project.

LEGACY_PREFIXES = {'old_', 'legacy_', 'temp_', 'tmp_', 'backup_', 'deprecated_'} class-attribute instance-attribute

name property

description property

check(expected_schema, actual_schema)

TableCountReasonable

Bases: ComparisonBInvariant

Verify the number of tables is reasonable.

This is a sanity check to detect issues like: - Too many tables (possible test pollution) - Too few tables (possible data loss)

MIN_TABLES = 1 class-attribute instance-attribute

MAX_TABLES = 500 class-attribute instance-attribute

name property

description property

check(expected_schema, actual_schema)