sqlmeta.comparison.diff_models

Diff Models for SQL Object Comparison Results.

This module defines structured classes to represent differences between SQL Model objects, enabling precise tracking of schema drift.

Key Classes: - DiffResult: Base class for all diff results - TableDiff: Table-level differences - ColumnDiff: Column-level differences - ConstraintDiff: Constraint differences - SchemaDiff: Schema-level summary

Classes

ColumnDiff(object_name[, object_type, ...])

Represents differences in a column definition.

ConstraintDiff(object_name[, object_type, ...])

Represents differences in a constraint definition.

DatabaseLinkDiff(object_name[, object_type, ...])

Represents differences in a database link definition (Oracle).

DiffResult(object_name[, object_type, ...])

Base class for comparison results.

DiffSeverity(value)

Severity levels for differences.

EventDiff(object_name[, object_type, ...])

Represents differences in an event definition (MySQL).

ExtensionDiff(object_name[, object_type, ...])

Represents differences in an extension definition (PostgreSQL).

ForeignDataWrapperDiff(object_name[, ...])

Represents differences in a foreign data wrapper definition (PostgreSQL).

ForeignServerDiff(object_name[, ...])

Represents differences in a foreign server definition (PostgreSQL).

FunctionDiff(object_name[, object_type, ...])

Represents differences in a function definition.

IndexDiff(object_name[, object_type, ...])

Represents differences in an index definition.

LinkedServerDiff(object_name[, object_type, ...])

Represents differences in a linked server definition (SQL Server).

ModuleDiff(object_name[, object_type, ...])

Represents differences in a DB2 module definition.

PackageDiff(object_name[, object_type, ...])

Represents differences in a package definition (Oracle).

ProcedureDiff(object_name[, object_type, ...])

Represents differences in a stored procedure definition.

SchemaDiff(object_name, object_type, ...)

Represents schema-level comparison results.

SequenceDiff(object_name[, object_type, ...])

Represents differences in a sequence definition.

SynonymDiff(object_name[, object_type, ...])

Represents differences in a synonym definition.

TableDiff(object_name, object_type, ...)

Represents differences in a table definition.

TriggerDiff(object_name[, object_type, ...])

Represents differences in a trigger definition.

UserDefinedTypeDiff(object_name[, ...])

Represents differences in a user-defined type definition.

ViewDiff(object_name[, object_type, ...])

Represents differences in a view definition.

class sqlmeta.comparison.diff_models.DiffSeverity(value)[source]

Severity levels for differences.

ERROR = 'error'
WARNING = 'warning'
INFO = 'info'
class sqlmeta.comparison.diff_models.DiffResult(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False)[source]

Base class for comparison results.

object_name

Name of the object being compared

Type:

str

object_type

Type of object (table, view, procedure, etc.)

Type:

str

severity

Highest severity of differences found

Type:

sqlmeta.comparison.diff_models.DiffSeverity

has_diffs

Whether any differences were found

Type:

bool

object_name: str
object_type: str = ''
severity: DiffSeverity = 'info'
has_diffs: bool = False
to_dict() Dict[str, Any][source]

Convert to dictionary for serialization.

Returns:

Dictionary representation of the diff result

__str__() str[source]

Human-readable string representation.

Returns:

Formatted string describing the diff

get_summary() str[source]

Get a brief summary of differences.

Returns:

Brief summary string

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False) None
class sqlmeta.comparison.diff_models.ColumnDiff(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, column_name: str = '', data_type_diff: tuple | None = None, nullable_diff: tuple | None = None, default_diff: tuple | None = None, identity_diff: tuple | None = None, computed_diff: tuple | None = None)[source]

Represents differences in a column definition.

column_name

Name of the column

Type:

str

data_type_diff

Data type differences (expected vs actual)

Type:

tuple | None

nullable_diff

Nullability differences

Type:

tuple | None

default_diff

Default value differences

Type:

tuple | None

identity_diff

Identity column differences

Type:

tuple | None

computed_diff

Computed column differences

Type:

tuple | None

column_name: str = ''
data_type_diff: tuple | None = None
nullable_diff: tuple | None = None
default_diff: tuple | None = None
identity_diff: tuple | None = None
computed_diff: tuple | None = None
__post_init__()[source]

Calculate has_diffs and severity after initialization.

to_dict() Dict[str, Any][source]

Convert to dictionary for serialization.

__str__() str[source]

Human-readable string representation.

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, column_name: str = '', data_type_diff: tuple | None = None, nullable_diff: tuple | None = None, default_diff: tuple | None = None, identity_diff: tuple | None = None, computed_diff: tuple | None = None) None
object_name: str
class sqlmeta.comparison.diff_models.ConstraintDiff(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, constraint_name: str = '', constraint_type: str = '', columns_diff: tuple | None = None, references_diff: tuple | None = None, check_clause_diff: tuple | None = None)[source]

Represents differences in a constraint definition.

constraint_name

Name of the constraint

Type:

str

constraint_type

Type of constraint (PK, FK, UNIQUE, CHECK)

Type:

str

columns_diff

Differences in constrained columns

Type:

tuple | None

references_diff

Differences in foreign key references

Type:

tuple | None

check_clause_diff

Differences in CHECK constraint expressions

Type:

tuple | None

constraint_name: str = ''
constraint_type: str = ''
columns_diff: tuple | None = None
references_diff: tuple | None = None
check_clause_diff: tuple | None = None
__post_init__()[source]

Calculate has_diffs and severity after initialization.

to_dict() Dict[str, Any][source]

Convert to dictionary for serialization.

__str__() str[source]

Human-readable string representation.

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, constraint_name: str = '', constraint_type: str = '', columns_diff: tuple | None = None, references_diff: tuple | None = None, check_clause_diff: tuple | None = None) None
object_name: str
class sqlmeta.comparison.diff_models.TableDiff(object_name: str, object_type: str = '', severity: ~sqlmeta.comparison.diff_models.DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, table_name: str = '', missing_columns: ~typing.List[str] = <factory>, extra_columns: ~typing.List[str] = <factory>, modified_columns: ~typing.List[~sqlmeta.comparison.diff_models.ColumnDiff] = <factory>, missing_constraints: ~typing.List[str] = <factory>, extra_constraints: ~typing.List[str] = <factory>, modified_constraints: ~typing.List[~sqlmeta.comparison.diff_models.ConstraintDiff] = <factory>, missing_indexes: ~typing.List[str] = <factory>, extra_indexes: ~typing.List[str] = <factory>, temporary_changed: bool = False, filegroup_changed: bool = False, memory_optimized_changed: bool = False, system_versioned_changed: bool = False, history_table_changed: bool = False, partition_method_changed: bool = False, partition_columns_changed: bool = False, compress_changed: bool = False, compress_type_changed: bool = False, logged_changed: bool = False, organize_by_changed: bool = False)[source]

Represents differences in a table definition.

table_name

Name of the table

Type:

str

missing_columns

Columns in expected but not in actual

Type:

List[str]

extra_columns

Columns in actual but not in expected

Type:

List[str]

modified_columns

Columns with differences

Type:

List[sqlmeta.comparison.diff_models.ColumnDiff]

missing_constraints

Constraints in expected but not in actual

Type:

List[str]

extra_constraints

Constraints in actual but not in expected

Type:

List[str]

modified_constraints

Constraints with differences

Type:

List[sqlmeta.comparison.diff_models.ConstraintDiff]

missing_indexes

Indexes in expected but not in actual

Type:

List[str]

extra_indexes

Indexes in actual but not in expected

Type:

List[str]

temporary_changed

Whether temporary property changed (grammar-based enhancement)

Type:

bool

filegroup_changed

Whether filegroup changed (T-SQL grammar-based)

Type:

bool

memory_optimized_changed

Whether memory-optimized property changed (T-SQL grammar-based)

Type:

bool

system_versioned_changed

Whether system-versioned property changed (T-SQL grammar-based)

Type:

bool

history_table_changed

Whether history table changed (T-SQL grammar-based)

Type:

bool

partition_method_changed

Whether partition method changed (partition scheme tracking)

Type:

bool

partition_columns_changed

Whether partition columns changed (partition scheme tracking)

Type:

bool

compress_changed

Whether compress property changed (DB2 grammar-based)

Type:

bool

compress_type_changed

Whether compress type changed (DB2 grammar-based)

Type:

bool

logged_changed

Whether logged property changed (DB2 grammar-based)

Type:

bool

organize_by_changed

Whether organize_by property changed (DB2 grammar-based)

Type:

bool

table_name: str = ''
missing_columns: List[str]
extra_columns: List[str]
modified_columns: List[ColumnDiff]
missing_constraints: List[str]
extra_constraints: List[str]
modified_constraints: List[ConstraintDiff]
missing_indexes: List[str]
extra_indexes: List[str]
temporary_changed: bool = False
filegroup_changed: bool = False
memory_optimized_changed: bool = False
system_versioned_changed: bool = False
history_table_changed: bool = False
partition_method_changed: bool = False
partition_columns_changed: bool = False
compress_changed: bool = False
compress_type_changed: bool = False
logged_changed: bool = False
organize_by_changed: bool = False
__post_init__()[source]

Calculate has_diffs and severity after initialization.

get_diff_count() Dict[str, int][source]

Get count of each type of difference.

Returns:

Dictionary with counts of different types

to_dict() Dict[str, Any][source]

Convert to dictionary for serialization.

__str__() str[source]

Human-readable string representation.

__init__(object_name: str, object_type: str = '', severity: ~sqlmeta.comparison.diff_models.DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, table_name: str = '', missing_columns: ~typing.List[str] = <factory>, extra_columns: ~typing.List[str] = <factory>, modified_columns: ~typing.List[~sqlmeta.comparison.diff_models.ColumnDiff] = <factory>, missing_constraints: ~typing.List[str] = <factory>, extra_constraints: ~typing.List[str] = <factory>, modified_constraints: ~typing.List[~sqlmeta.comparison.diff_models.ConstraintDiff] = <factory>, missing_indexes: ~typing.List[str] = <factory>, extra_indexes: ~typing.List[str] = <factory>, temporary_changed: bool = False, filegroup_changed: bool = False, memory_optimized_changed: bool = False, system_versioned_changed: bool = False, history_table_changed: bool = False, partition_method_changed: bool = False, partition_columns_changed: bool = False, compress_changed: bool = False, compress_type_changed: bool = False, logged_changed: bool = False, organize_by_changed: bool = False) None
object_name: str
class sqlmeta.comparison.diff_models.ViewDiff(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, view_name: str = '', definition_changed: bool = False, expected_definition: str | None = None, actual_definition: str | None = None, materialized_changed: tuple | None = None, unlogged_changed: tuple | None = None, algorithm_changed: tuple | None = None, sql_security_changed: tuple | None = None, definer_changed: tuple | None = None, force_changed: tuple | None = None, is_populated_changed: tuple | None = None, refresh_method_changed: tuple | None = None, refresh_mode_changed: tuple | None = None, fast_refreshable_changed: tuple | None = None)[source]

Represents differences in a view definition.

view_name

Name of the view

Type:

str

definition_changed

Whether the view definition changed

Type:

bool

expected_definition

Expected view definition SQL

Type:

str | None

actual_definition

Actual view definition SQL

Type:

str | None

materialized_changed

Whether materialized status changed (PostgreSQL)

Type:

tuple | None

unlogged_changed

Whether UNLOGGED status changed (PostgreSQL materialized views, grammar-based)

Type:

tuple | None

algorithm_changed

Whether algorithm changed (MySQL grammar-based: MERGE, TEMPTABLE, UNDEFINED)

Type:

tuple | None

sql_security_changed

Whether SQL SECURITY changed (MySQL grammar-based: DEFINER, INVOKER)

Type:

tuple | None

definer_changed

Whether definer changed (MySQL grammar-based: user@host)

Type:

tuple | None

force_changed

Whether FORCE/NOFORCE changed (Oracle grammar-based)

Type:

tuple | None

is_populated_changed

Whether populated status changed (materialized views)

Type:

tuple | None

refresh_method_changed

Whether refresh method changed (Oracle, DB2)

Type:

tuple | None

refresh_mode_changed

Whether refresh mode changed (Oracle)

Type:

tuple | None

fast_refreshable_changed

Whether fast refresh capability changed (Oracle)

Type:

tuple | None

view_name: str = ''
definition_changed: bool = False
expected_definition: str | None = None
actual_definition: str | None = None
materialized_changed: tuple | None = None
unlogged_changed: tuple | None = None
algorithm_changed: tuple | None = None
sql_security_changed: tuple | None = None
definer_changed: tuple | None = None
force_changed: tuple | None = None
is_populated_changed: tuple | None = None
refresh_method_changed: tuple | None = None
refresh_mode_changed: tuple | None = None
fast_refreshable_changed: tuple | None = None
__post_init__()[source]

Calculate has_diffs and severity after initialization.

to_dict() Dict[str, Any][source]

Convert to dictionary for serialization.

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, view_name: str = '', definition_changed: bool = False, expected_definition: str | None = None, actual_definition: str | None = None, materialized_changed: tuple | None = None, unlogged_changed: tuple | None = None, algorithm_changed: tuple | None = None, sql_security_changed: tuple | None = None, definer_changed: tuple | None = None, force_changed: tuple | None = None, is_populated_changed: tuple | None = None, refresh_method_changed: tuple | None = None, refresh_mode_changed: tuple | None = None, fast_refreshable_changed: tuple | None = None) None
class sqlmeta.comparison.diff_models.IndexDiff(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, index_name: str = '', table_name: str = '', columns_changed: bool = False, uniqueness_changed: tuple | None = None, type_changed: tuple | None = None, online_changed: tuple | None = None, concurrently_changed: tuple | None = None, tablespace_changed: tuple | None = None, expected_columns: List[str] | None = None, actual_columns: List[str] | None = None)[source]

Represents differences in an index definition.

index_name

Name of the index

Type:

str

table_name

Table the index belongs to

Type:

str

columns_changed

Whether indexed columns changed

Type:

bool

uniqueness_changed

Whether uniqueness constraint changed

Type:

tuple | None

type_changed

Whether index type changed (btree, hash, fulltext, spatial, etc.)

Type:

tuple | None

online_changed

Whether ONLINE/OFFLINE status changed (MySQL grammar-based)

Type:

tuple | None

concurrently_changed

Whether CONCURRENTLY status changed (PostgreSQL grammar-based)

Type:

tuple | None

tablespace_changed

Whether TABLESPACE changed (Oracle grammar-based)

Type:

tuple | None

expected_columns

Expected indexed columns

Type:

List[str] | None

actual_columns

Actual indexed columns

Type:

List[str] | None

index_name: str = ''
table_name: str = ''
columns_changed: bool = False
uniqueness_changed: tuple | None = None
type_changed: tuple | None = None
online_changed: tuple | None = None
concurrently_changed: tuple | None = None
tablespace_changed: tuple | None = None
expected_columns: List[str] | None = None
actual_columns: List[str] | None = None
__post_init__()[source]

Calculate has_diffs and severity after initialization.

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, index_name: str = '', table_name: str = '', columns_changed: bool = False, uniqueness_changed: tuple | None = None, type_changed: tuple | None = None, online_changed: tuple | None = None, concurrently_changed: tuple | None = None, tablespace_changed: tuple | None = None, expected_columns: List[str] | None = None, actual_columns: List[str] | None = None) None
class sqlmeta.comparison.diff_models.SequenceDiff(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, sequence_name: str = '', start_value_changed: tuple | None = None, increment_changed: tuple | None = None, min_value_changed: tuple | None = None, max_value_changed: tuple | None = None, cycle_changed: tuple | None = None, temp_changed: tuple | None = None)[source]

Represents differences in a sequence definition.

sequence_name

Name of the sequence

Type:

str

start_value_changed

Whether start value changed

Type:

tuple | None

increment_changed

Whether increment changed

Type:

tuple | None

min_value_changed

Whether minimum value changed

Type:

tuple | None

max_value_changed

Whether maximum value changed

Type:

tuple | None

cycle_changed

Whether cycle option changed

Type:

tuple | None

temp_changed

Whether TEMPORARY status changed (PostgreSQL grammar-based)

Type:

tuple | None

sequence_name: str = ''
start_value_changed: tuple | None = None
increment_changed: tuple | None = None
min_value_changed: tuple | None = None
max_value_changed: tuple | None = None
cycle_changed: tuple | None = None
temp_changed: tuple | None = None
__post_init__()[source]

Calculate has_diffs and severity after initialization.

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, sequence_name: str = '', start_value_changed: tuple | None = None, increment_changed: tuple | None = None, min_value_changed: tuple | None = None, max_value_changed: tuple | None = None, cycle_changed: tuple | None = None, temp_changed: tuple | None = None) None
class sqlmeta.comparison.diff_models.TriggerDiff(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, trigger_name: str = '', table_name: str = '', timing_changed: tuple | None = None, event_changed: tuple | None = None, constraint_trigger_changed: tuple | None = None, definer_changed: tuple | None = None, definition_changed: bool = False, enabled_changed: tuple | None = None)[source]

Represents differences in a trigger definition.

trigger_name

Name of the trigger

Type:

str

table_name

Table the trigger is attached to

Type:

str

timing_changed

Whether timing changed (BEFORE/AFTER/INSTEAD OF, grammar-based)

Type:

tuple | None

event_changed

Whether event changed (INSERT/UPDATE/DELETE/TRUNCATE, grammar-based)

Type:

tuple | None

constraint_trigger_changed

Whether constraint trigger status changed (PostgreSQL, grammar-based)

Type:

tuple | None

definer_changed

Whether definer changed (MySQL grammar-based: user@host)

Type:

tuple | None

definition_changed

Whether trigger body changed

Type:

bool

enabled_changed

Whether enabled status changed

Type:

tuple | None

trigger_name: str = ''
table_name: str = ''
timing_changed: tuple | None = None
event_changed: tuple | None = None
constraint_trigger_changed: tuple | None = None
definer_changed: tuple | None = None
definition_changed: bool = False
enabled_changed: tuple | None = None
__post_init__()[source]

Calculate has_diffs and severity after initialization.

to_dict() Dict[str, Any][source]

Convert to dictionary for serialization.

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, trigger_name: str = '', table_name: str = '', timing_changed: tuple | None = None, event_changed: tuple | None = None, constraint_trigger_changed: tuple | None = None, definer_changed: tuple | None = None, definition_changed: bool = False, enabled_changed: tuple | None = None) None
class sqlmeta.comparison.diff_models.ProcedureDiff(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, procedure_name: str = '', definition_changed: bool = False, parameters_changed: bool = False, expected_parameters: List[str] | None = None, actual_parameters: List[str] | None = None)[source]

Represents differences in a stored procedure definition.

procedure_name

Name of the procedure

Type:

str

definition_changed

Whether procedure body changed

Type:

bool

parameters_changed

Whether parameters changed

Type:

bool

expected_parameters

Expected parameter list

Type:

List[str] | None

actual_parameters

Actual parameter list

Type:

List[str] | None

procedure_name: str = ''
definition_changed: bool = False
parameters_changed: bool = False
expected_parameters: List[str] | None = None
actual_parameters: List[str] | None = None
__post_init__()[source]

Calculate has_diffs and severity after initialization.

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, procedure_name: str = '', definition_changed: bool = False, parameters_changed: bool = False, expected_parameters: List[str] | None = None, actual_parameters: List[str] | None = None) None
class sqlmeta.comparison.diff_models.FunctionDiff(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, function_name: str = '', definition_changed: bool = False, parameters_changed: bool = False, return_type_changed: tuple | None = None, expected_parameters: List[str] | None = None, actual_parameters: List[str] | None = None)[source]

Represents differences in a function definition.

function_name

Name of the function

Type:

str

definition_changed

Whether function body changed

Type:

bool

parameters_changed

Whether parameters changed

Type:

bool

return_type_changed

Whether return type changed

Type:

tuple | None

expected_parameters

Expected parameter list

Type:

List[str] | None

actual_parameters

Actual parameter list

Type:

List[str] | None

function_name: str = ''
definition_changed: bool = False
parameters_changed: bool = False
return_type_changed: tuple | None = None
expected_parameters: List[str] | None = None
actual_parameters: List[str] | None = None
__post_init__()[source]

Calculate has_diffs and severity after initialization.

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, function_name: str = '', definition_changed: bool = False, parameters_changed: bool = False, return_type_changed: tuple | None = None, expected_parameters: List[str] | None = None, actual_parameters: List[str] | None = None) None
class sqlmeta.comparison.diff_models.SynonymDiff(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, synonym_name: str = '', target_changed: tuple | None = None, target_schema_changed: tuple | None = None, target_database_changed: tuple | None = None, db_link_changed: tuple | None = None, expected_target: str | None = None, actual_target: str | None = None)[source]

Represents differences in a synonym definition.

synonym_name

Name of the synonym

Type:

str

target_changed

Whether the target object changed

Type:

tuple | None

target_schema_changed

Whether the target schema changed

Type:

tuple | None

target_database_changed

Whether the target database changed (SQL Server)

Type:

tuple | None

Whether the database link changed (Oracle)

Type:

tuple | None

expected_target

Expected target object

Type:

str | None

actual_target

Actual target object

Type:

str | None

synonym_name: str = ''
target_changed: tuple | None = None
target_schema_changed: tuple | None = None
target_database_changed: tuple | None = None
db_link_changed: tuple | None = None
expected_target: str | None = None
actual_target: str | None = None
__post_init__()[source]

Calculate has_diffs and severity after initialization.

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, synonym_name: str = '', target_changed: tuple | None = None, target_schema_changed: tuple | None = None, target_database_changed: tuple | None = None, db_link_changed: tuple | None = None, expected_target: str | None = None, actual_target: str | None = None) None
class sqlmeta.comparison.diff_models.PackageDiff(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, package_name: str = '', spec_changed: bool = False, body_changed: bool = False, expected_spec: str | None = None, actual_spec: str | None = None, expected_body: str | None = None, actual_body: str | None = None)[source]

Represents differences in a package definition (Oracle).

package_name

Name of the package

Type:

str

spec_changed

Whether package specification changed

Type:

bool

body_changed

Whether package body changed

Type:

bool

expected_spec

Expected package specification

Type:

str | None

actual_spec

Actual package specification

Type:

str | None

expected_body

Expected package body

Type:

str | None

actual_body

Actual package body

Type:

str | None

package_name: str = ''
spec_changed: bool = False
body_changed: bool = False
expected_spec: str | None = None
actual_spec: str | None = None
expected_body: str | None = None
actual_body: str | None = None
__post_init__()[source]

Calculate has_diffs and severity after initialization.

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, package_name: str = '', spec_changed: bool = False, body_changed: bool = False, expected_spec: str | None = None, actual_spec: str | None = None, expected_body: str | None = None, actual_body: str | None = None) None
class sqlmeta.comparison.diff_models.DatabaseLinkDiff(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, link_name: str = '', host_changed: tuple | None = None, username_changed: tuple | None = None, public_changed: tuple | None = None, expected_host: str | None = None, actual_host: str | None = None)[source]

Represents differences in a database link definition (Oracle).

Name of the database link

Type:

str

host_changed

Whether the host/connect string changed

Type:

tuple | None

username_changed

Whether the username changed

Type:

tuple | None

public_changed

Whether the public/private status changed

Type:

tuple | None

expected_host

Expected host/connect string

Type:

str | None

actual_host

Actual host/connect string

Type:

str | None

link_name: str = ''
host_changed: tuple | None = None
username_changed: tuple | None = None
public_changed: tuple | None = None
expected_host: str | None = None
actual_host: str | None = None
__post_init__()[source]

Calculate has_diffs and severity after initialization.

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, link_name: str = '', host_changed: tuple | None = None, username_changed: tuple | None = None, public_changed: tuple | None = None, expected_host: str | None = None, actual_host: str | None = None) None
class sqlmeta.comparison.diff_models.LinkedServerDiff(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, server_name: str = '', product_changed: tuple | None = None, provider_changed: tuple | None = None, data_source_changed: tuple | None = None, catalog_changed: tuple | None = None, username_changed: tuple | None = None)[source]

Represents differences in a linked server definition (SQL Server).

server_name

Name of the linked server

Type:

str

product_changed

Whether the product name changed

Type:

tuple | None

provider_changed

Whether the provider changed

Type:

tuple | None

data_source_changed

Whether the data source changed

Type:

tuple | None

catalog_changed

Whether the catalog changed

Type:

tuple | None

username_changed

Whether the username changed

Type:

tuple | None

server_name: str = ''
product_changed: tuple | None = None
provider_changed: tuple | None = None
data_source_changed: tuple | None = None
catalog_changed: tuple | None = None
username_changed: tuple | None = None
__post_init__()[source]

Calculate has_diffs and severity after initialization.

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, server_name: str = '', product_changed: tuple | None = None, provider_changed: tuple | None = None, data_source_changed: tuple | None = None, catalog_changed: tuple | None = None, username_changed: tuple | None = None) None
class sqlmeta.comparison.diff_models.ModuleDiff(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, module_name: str = '', definition_changed: bool = False)[source]

Represents differences in a DB2 module definition.

module_name

Name of the module

Type:

str

definition_changed

Whether the module definition changed

Type:

bool

module_name: str = ''
definition_changed: bool = False
__post_init__()[source]

Calculate has_diffs and severity after initialization.

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, module_name: str = '', definition_changed: bool = False) None
class sqlmeta.comparison.diff_models.ForeignDataWrapperDiff(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, fdw_name: str = '', handler_changed: tuple | None = None, validator_changed: tuple | None = None, options_changed: tuple | None = None)[source]

Represents differences in a foreign data wrapper definition (PostgreSQL).

fdw_name

Name of the foreign data wrapper

Type:

str

handler_changed

Whether the handler function changed

Type:

tuple | None

validator_changed

Whether the validator function changed

Type:

tuple | None

options_changed

Whether the FDW options changed

Type:

tuple | None

fdw_name: str = ''
handler_changed: tuple | None = None
validator_changed: tuple | None = None
options_changed: tuple | None = None
__post_init__()[source]

Calculate has_diffs and severity after initialization.

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, fdw_name: str = '', handler_changed: tuple | None = None, validator_changed: tuple | None = None, options_changed: tuple | None = None) None
class sqlmeta.comparison.diff_models.ForeignServerDiff(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, server_name: str = '', fdw_changed: tuple | None = None, host_changed: tuple | None = None, port_changed: tuple | None = None, dbname_changed: tuple | None = None, options_changed: tuple | None = None)[source]

Represents differences in a foreign server definition (PostgreSQL).

server_name

Name of the foreign server

Type:

str

fdw_changed

Whether the FDW name changed

Type:

tuple | None

host_changed

Whether the host changed

Type:

tuple | None

port_changed

Whether the port changed

Type:

tuple | None

dbname_changed

Whether the database name changed

Type:

tuple | None

options_changed

Whether server options changed

Type:

tuple | None

server_name: str = ''
fdw_changed: tuple | None = None
host_changed: tuple | None = None
port_changed: tuple | None = None
dbname_changed: tuple | None = None
options_changed: tuple | None = None
__post_init__()[source]

Calculate has_diffs and severity after initialization.

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, server_name: str = '', fdw_changed: tuple | None = None, host_changed: tuple | None = None, port_changed: tuple | None = None, dbname_changed: tuple | None = None, options_changed: tuple | None = None) None
class sqlmeta.comparison.diff_models.ExtensionDiff(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, extension_name: str = '', version_changed: tuple | None = None, schema_changed: tuple | None = None, expected_version: str | None = None, actual_version: str | None = None)[source]

Represents differences in an extension definition (PostgreSQL).

extension_name

Name of the extension

Type:

str

version_changed

Whether the extension version changed

Type:

tuple | None

schema_changed

Whether the extension schema changed

Type:

tuple | None

expected_version

Expected extension version

Type:

str | None

actual_version

Actual extension version

Type:

str | None

extension_name: str = ''
version_changed: tuple | None = None
schema_changed: tuple | None = None
expected_version: str | None = None
actual_version: str | None = None
__post_init__()[source]

Calculate has_diffs and severity after initialization.

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, extension_name: str = '', version_changed: tuple | None = None, schema_changed: tuple | None = None, expected_version: str | None = None, actual_version: str | None = None) None
class sqlmeta.comparison.diff_models.EventDiff(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, event_name: str = '', definition_changed: bool = False, schedule_changed: tuple | None = None, enabled_changed: tuple | None = None, event_type_changed: tuple | None = None)[source]

Represents differences in an event definition (MySQL).

event_name

Name of the event

Type:

str

definition_changed

Whether the event body changed

Type:

bool

schedule_changed

Whether the event schedule changed

Type:

tuple | None

enabled_changed

Whether the enabled status changed

Type:

tuple | None

event_type_changed

Whether the event type changed (ONE TIME/RECURRING)

Type:

tuple | None

event_name: str = ''
definition_changed: bool = False
schedule_changed: tuple | None = None
enabled_changed: tuple | None = None
event_type_changed: tuple | None = None
__post_init__()[source]

Calculate has_diffs and severity after initialization.

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, event_name: str = '', definition_changed: bool = False, schedule_changed: tuple | None = None, enabled_changed: tuple | None = None, event_type_changed: tuple | None = None) None
class sqlmeta.comparison.diff_models.UserDefinedTypeDiff(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, type_name: str = '', type_category_changed: tuple | None = None, base_type_changed: tuple | None = None, attributes_changed: bool = False, enum_values_changed: bool = False, definition_changed: bool = False, expected_type_category: str | None = None, actual_type_category: str | None = None, expected_base_type: str | None = None, actual_base_type: str | None = None, expected_attributes: List | None = None, actual_attributes: List | None = None, expected_enum_values: List | None = None, actual_enum_values: List | None = None)[source]

Represents differences in a user-defined type definition.

type_name

Name of the user-defined type

Type:

str

type_category_changed

Whether the type category changed (COMPOSITE, ENUM, DOMAIN, etc.)

Type:

tuple | None

base_type_changed

Whether the base type changed (for DOMAIN/DISTINCT types)

Type:

tuple | None

attributes_changed

Whether composite type attributes changed

Type:

bool

enum_values_changed

Whether enum values changed

Type:

bool

definition_changed

Whether the type definition changed

Type:

bool

expected_type_category

Expected type category

Type:

str | None

actual_type_category

Actual type category

Type:

str | None

expected_base_type

Expected base type

Type:

str | None

actual_base_type

Actual base type

Type:

str | None

type_name: str = ''
type_category_changed: tuple | None = None
base_type_changed: tuple | None = None
attributes_changed: bool = False
enum_values_changed: bool = False
definition_changed: bool = False
expected_type_category: str | None = None
actual_type_category: str | None = None
expected_base_type: str | None = None
actual_base_type: str | None = None
expected_attributes: List | None = None
actual_attributes: List | None = None
expected_enum_values: List | None = None
actual_enum_values: List | None = None
__post_init__()[source]

Calculate has_diffs and severity after initialization.

__init__(object_name: str, object_type: str = '', severity: DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, type_name: str = '', type_category_changed: tuple | None = None, base_type_changed: tuple | None = None, attributes_changed: bool = False, enum_values_changed: bool = False, definition_changed: bool = False, expected_type_category: str | None = None, actual_type_category: str | None = None, expected_base_type: str | None = None, actual_base_type: str | None = None, expected_attributes: List | None = None, actual_attributes: List | None = None, expected_enum_values: List | None = None, actual_enum_values: List | None = None) None
class sqlmeta.comparison.diff_models.SchemaDiff(object_name: str, object_type: str = '', severity: ~sqlmeta.comparison.diff_models.DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, schema_name: str = '', missing_tables: ~typing.List[str] = <factory>, extra_tables: ~typing.List[str] = <factory>, modified_tables: ~typing.List[~sqlmeta.comparison.diff_models.TableDiff] = <factory>, missing_views: ~typing.List[str] = <factory>, extra_views: ~typing.List[str] = <factory>, modified_views: ~typing.List[~sqlmeta.comparison.diff_models.ViewDiff] = <factory>, missing_indexes: ~typing.List[str] = <factory>, extra_indexes: ~typing.List[str] = <factory>, modified_indexes: ~typing.List[~sqlmeta.comparison.diff_models.IndexDiff] = <factory>, missing_sequences: ~typing.List[str] = <factory>, extra_sequences: ~typing.List[str] = <factory>, modified_sequences: ~typing.List[~sqlmeta.comparison.diff_models.SequenceDiff] = <factory>, missing_triggers: ~typing.List[str] = <factory>, extra_triggers: ~typing.List[str] = <factory>, modified_triggers: ~typing.List[~sqlmeta.comparison.diff_models.TriggerDiff] = <factory>, missing_procedures: ~typing.List[str] = <factory>, extra_procedures: ~typing.List[str] = <factory>, modified_procedures: ~typing.List[~sqlmeta.comparison.diff_models.ProcedureDiff] = <factory>, missing_functions: ~typing.List[str] = <factory>, extra_functions: ~typing.List[str] = <factory>, modified_functions: ~typing.List[~sqlmeta.comparison.diff_models.FunctionDiff] = <factory>, missing_synonyms: ~typing.List[str] = <factory>, extra_synonyms: ~typing.List[str] = <factory>, modified_synonyms: ~typing.List[~sqlmeta.comparison.diff_models.SynonymDiff] = <factory>, missing_packages: ~typing.List[str] = <factory>, extra_packages: ~typing.List[str] = <factory>, modified_packages: ~typing.List[~sqlmeta.comparison.diff_models.PackageDiff] = <factory>, missing_modules: ~typing.List[str] = <factory>, extra_modules: ~typing.List[str] = <factory>, modified_modules: ~typing.List[~sqlmeta.comparison.diff_models.ModuleDiff] = <factory>, missing_database_links: ~typing.List[str] = <factory>, extra_database_links: ~typing.List[str] = <factory>, modified_database_links: ~typing.List[~sqlmeta.comparison.diff_models.DatabaseLinkDiff] = <factory>, missing_linked_servers: ~typing.List[str] = <factory>, extra_linked_servers: ~typing.List[str] = <factory>, modified_linked_servers: ~typing.List[~sqlmeta.comparison.diff_models.LinkedServerDiff] = <factory>, missing_foreign_data_wrappers: ~typing.List[str] = <factory>, extra_foreign_data_wrappers: ~typing.List[str] = <factory>, modified_foreign_data_wrappers: ~typing.List[~sqlmeta.comparison.diff_models.ForeignDataWrapperDiff] = <factory>, missing_foreign_servers: ~typing.List[str] = <factory>, extra_foreign_servers: ~typing.List[str] = <factory>, modified_foreign_servers: ~typing.List[~sqlmeta.comparison.diff_models.ForeignServerDiff] = <factory>, missing_extensions: ~typing.List[str] = <factory>, extra_extensions: ~typing.List[str] = <factory>, modified_extensions: ~typing.List[~sqlmeta.comparison.diff_models.ExtensionDiff] = <factory>, missing_events: ~typing.List[str] = <factory>, extra_events: ~typing.List[str] = <factory>, modified_events: ~typing.List[~sqlmeta.comparison.diff_models.EventDiff] = <factory>, missing_user_defined_types: ~typing.List[str] = <factory>, extra_user_defined_types: ~typing.List[str] = <factory>, modified_user_defined_types: ~typing.List[~sqlmeta.comparison.diff_models.UserDefinedTypeDiff] = <factory>)[source]

Represents schema-level comparison results.

schema_name

Name of the schema

Type:

str

missing_tables

Tables in expected but not in actual

Type:

List[str]

extra_tables

Tables in actual but not in expected

Type:

List[str]

modified_tables

Tables with differences

Type:

List[sqlmeta.comparison.diff_models.TableDiff]

missing_views

Views in expected but not in actual

Type:

List[str]

extra_views

Views in actual but not in expected

Type:

List[str]

modified_views

Views with differences

Type:

List[sqlmeta.comparison.diff_models.ViewDiff]

missing_indexes

Indexes in expected but not in actual

Type:

List[str]

extra_indexes

Indexes in actual but not in expected

Type:

List[str]

modified_indexes

Indexes with differences

Type:

List[sqlmeta.comparison.diff_models.IndexDiff]

missing_sequences

Sequences in expected but not in actual

Type:

List[str]

extra_sequences

Sequences in actual but not in expected

Type:

List[str]

modified_sequences

Sequences with differences

Type:

List[sqlmeta.comparison.diff_models.SequenceDiff]

missing_triggers

Triggers in expected but not in actual

Type:

List[str]

extra_triggers

Triggers in actual but not in expected

Type:

List[str]

modified_triggers

Triggers with differences

Type:

List[sqlmeta.comparison.diff_models.TriggerDiff]

missing_procedures

Procedures in expected but not in actual

Type:

List[str]

extra_procedures

Procedures in actual but not in expected

Type:

List[str]

modified_procedures

Procedures with differences

Type:

List[sqlmeta.comparison.diff_models.ProcedureDiff]

missing_functions

Functions in expected but not in actual

Type:

List[str]

extra_functions

Functions in actual but not in expected

Type:

List[str]

modified_functions

Functions with differences

Type:

List[sqlmeta.comparison.diff_models.FunctionDiff]

missing_synonyms

Synonyms in expected but not in actual

Type:

List[str]

extra_synonyms

Synonyms in actual but not in expected

Type:

List[str]

modified_synonyms

Synonyms with differences

Type:

List[sqlmeta.comparison.diff_models.SynonymDiff]

missing_packages

Packages in expected but not in actual

Type:

List[str]

extra_packages

Packages in actual but not in expected

Type:

List[str]

modified_packages

Packages with differences

Type:

List[sqlmeta.comparison.diff_models.PackageDiff]

missing_extensions

Extensions in expected but not in actual

Type:

List[str]

extra_extensions

Extensions in actual but not in expected

Type:

List[str]

modified_extensions

Extensions with differences

Type:

List[sqlmeta.comparison.diff_models.ExtensionDiff]

missing_events

Events in expected but not in actual

Type:

List[str]

extra_events

Events in actual but not in expected

Type:

List[str]

modified_events

Events with differences

Type:

List[sqlmeta.comparison.diff_models.EventDiff]

missing_user_defined_types

User-defined types in expected but not in actual

Type:

List[str]

extra_user_defined_types

User-defined types in actual but not in expected

Type:

List[str]

modified_user_defined_types

User-defined types with differences

Type:

List[sqlmeta.comparison.diff_models.UserDefinedTypeDiff]

schema_name: str = ''
missing_tables: List[str]
extra_tables: List[str]
modified_tables: List[TableDiff]
missing_views: List[str]
extra_views: List[str]
modified_views: List[ViewDiff]
missing_indexes: List[str]
extra_indexes: List[str]
modified_indexes: List[IndexDiff]
missing_sequences: List[str]
extra_sequences: List[str]
modified_sequences: List[SequenceDiff]
missing_triggers: List[str]
extra_triggers: List[str]
modified_triggers: List[TriggerDiff]
missing_procedures: List[str]
extra_procedures: List[str]
modified_procedures: List[ProcedureDiff]
missing_functions: List[str]
extra_functions: List[str]
modified_functions: List[FunctionDiff]
missing_synonyms: List[str]
extra_synonyms: List[str]
modified_synonyms: List[SynonymDiff]
missing_packages: List[str]
extra_packages: List[str]
modified_packages: List[PackageDiff]
missing_modules: List[str]
extra_modules: List[str]
modified_modules: List[ModuleDiff]
missing_linked_servers: List[str]
extra_linked_servers: List[str]
modified_linked_servers: List[LinkedServerDiff]
missing_foreign_data_wrappers: List[str]
extra_foreign_data_wrappers: List[str]
modified_foreign_data_wrappers: List[ForeignDataWrapperDiff]
missing_foreign_servers: List[str]
extra_foreign_servers: List[str]
modified_foreign_servers: List[ForeignServerDiff]
missing_extensions: List[str]
extra_extensions: List[str]
modified_extensions: List[ExtensionDiff]
missing_events: List[str]
extra_events: List[str]
modified_events: List[EventDiff]
missing_user_defined_types: List[str]
extra_user_defined_types: List[str]
modified_user_defined_types: List[UserDefinedTypeDiff]
__post_init__()[source]

Calculate has_diffs and severity after initialization.

get_diff_count() Dict[str, int][source]

Get count of each type of difference.

Returns:

Dictionary with counts of different types

get_total_diff_count() int[source]

Get total count of all differences.

Returns:

Total number of differences

to_dict() Dict[str, Any][source]

Convert to dictionary for serialization.

__str__() str[source]

Human-readable string representation.

__init__(object_name: str, object_type: str = '', severity: ~sqlmeta.comparison.diff_models.DiffSeverity = DiffSeverity.INFO, has_diffs: bool = False, schema_name: str = '', missing_tables: ~typing.List[str] = <factory>, extra_tables: ~typing.List[str] = <factory>, modified_tables: ~typing.List[~sqlmeta.comparison.diff_models.TableDiff] = <factory>, missing_views: ~typing.List[str] = <factory>, extra_views: ~typing.List[str] = <factory>, modified_views: ~typing.List[~sqlmeta.comparison.diff_models.ViewDiff] = <factory>, missing_indexes: ~typing.List[str] = <factory>, extra_indexes: ~typing.List[str] = <factory>, modified_indexes: ~typing.List[~sqlmeta.comparison.diff_models.IndexDiff] = <factory>, missing_sequences: ~typing.List[str] = <factory>, extra_sequences: ~typing.List[str] = <factory>, modified_sequences: ~typing.List[~sqlmeta.comparison.diff_models.SequenceDiff] = <factory>, missing_triggers: ~typing.List[str] = <factory>, extra_triggers: ~typing.List[str] = <factory>, modified_triggers: ~typing.List[~sqlmeta.comparison.diff_models.TriggerDiff] = <factory>, missing_procedures: ~typing.List[str] = <factory>, extra_procedures: ~typing.List[str] = <factory>, modified_procedures: ~typing.List[~sqlmeta.comparison.diff_models.ProcedureDiff] = <factory>, missing_functions: ~typing.List[str] = <factory>, extra_functions: ~typing.List[str] = <factory>, modified_functions: ~typing.List[~sqlmeta.comparison.diff_models.FunctionDiff] = <factory>, missing_synonyms: ~typing.List[str] = <factory>, extra_synonyms: ~typing.List[str] = <factory>, modified_synonyms: ~typing.List[~sqlmeta.comparison.diff_models.SynonymDiff] = <factory>, missing_packages: ~typing.List[str] = <factory>, extra_packages: ~typing.List[str] = <factory>, modified_packages: ~typing.List[~sqlmeta.comparison.diff_models.PackageDiff] = <factory>, missing_modules: ~typing.List[str] = <factory>, extra_modules: ~typing.List[str] = <factory>, modified_modules: ~typing.List[~sqlmeta.comparison.diff_models.ModuleDiff] = <factory>, missing_database_links: ~typing.List[str] = <factory>, extra_database_links: ~typing.List[str] = <factory>, modified_database_links: ~typing.List[~sqlmeta.comparison.diff_models.DatabaseLinkDiff] = <factory>, missing_linked_servers: ~typing.List[str] = <factory>, extra_linked_servers: ~typing.List[str] = <factory>, modified_linked_servers: ~typing.List[~sqlmeta.comparison.diff_models.LinkedServerDiff] = <factory>, missing_foreign_data_wrappers: ~typing.List[str] = <factory>, extra_foreign_data_wrappers: ~typing.List[str] = <factory>, modified_foreign_data_wrappers: ~typing.List[~sqlmeta.comparison.diff_models.ForeignDataWrapperDiff] = <factory>, missing_foreign_servers: ~typing.List[str] = <factory>, extra_foreign_servers: ~typing.List[str] = <factory>, modified_foreign_servers: ~typing.List[~sqlmeta.comparison.diff_models.ForeignServerDiff] = <factory>, missing_extensions: ~typing.List[str] = <factory>, extra_extensions: ~typing.List[str] = <factory>, modified_extensions: ~typing.List[~sqlmeta.comparison.diff_models.ExtensionDiff] = <factory>, missing_events: ~typing.List[str] = <factory>, extra_events: ~typing.List[str] = <factory>, modified_events: ~typing.List[~sqlmeta.comparison.diff_models.EventDiff] = <factory>, missing_user_defined_types: ~typing.List[str] = <factory>, extra_user_defined_types: ~typing.List[str] = <factory>, modified_user_defined_types: ~typing.List[~sqlmeta.comparison.diff_models.UserDefinedTypeDiff] = <factory>) None
object_name: str