SchemaDiff

class felis.diff.SchemaDiff(schema_old, schema_new, table_filter=None, strip_ids=True)

Bases: object

Compare two schemas using DeepDiff and print the differences.

Parameters:
  • schema_old (Schema) – The old schema to compare, typically the original schema.

  • schema_new (Schema) – The new schema to compare, typically the modified schema.

  • table_filter (list[str] | None, default: None) – A list of table names to filter on.

  • strip_ids (bool, default: True) – Whether to strip ‘@id’ fields from the schemas before comparison.

Notes

This class uses DeepDiff to compare two schemas and provides methods to retrieve the differences. It is designed to be extended for more structured output, such as in FormattedSchemaDiff and would not typically be used directly.

Attributes Summary

diff

Return the differences between the two schemas.

has_changes

Check if there are any differences between the two schemas.

Methods Summary

print([output_stream])

Print the differences between the two schemas in raw format.

to_change_list()

Convert differences to a structured format.

Attributes Documentation

diff

Return the differences between the two schemas.

Returns:

The differences between the two schemas.

Return type:

dict

has_changes

Check if there are any differences between the two schemas.

Returns:

True if there are differences, False otherwise.

Return type:

bool

Methods Documentation

print(output_stream=None)

Print the differences between the two schemas in raw format.

Parameters:

output_stream (Optional[IO[str]], default: None) – The output stream for printing the differences.

Return type:

None

to_change_list()

Convert differences to a structured format.

Returns:

List of change dictionaries.

Return type:

list[dict[str, Any]]