{"id":24644,"library":"sql-compare","title":"sql-compare","description":"Compare SQL schemas and generate human-readable diffs. Version 0.2.0, released November 2024. Active development, monthly releases.","status":"active","version":"0.2.0","language":"python","source_language":"en","source_url":"https://github.com/Mergifyio/sql-compare","tags":["sql","schema","diff","comparison"],"install":[{"cmd":"pip install sql-compare","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Package uses underscore in module name.","wrong":"from sqlcompare import diff","symbol":"diff","correct":"from sql_compare import diff"},{"note":"Functions are at package level, not submodule.","wrong":"from sql_compare.diff import diff_files","symbol":"diff_files","correct":"from sql_compare import diff_files"}],"quickstart":{"code":"from sql_compare import diff\n\nschema1 = \"CREATE TABLE users (id INT, name TEXT);\"\nschema2 = \"CREATE TABLE users (id INT, name VARCHAR(255));\"\nprint(diff(schema1, schema2))","lang":"python","description":"Basic usage: compare two SQL schema strings and print the diff."},"warnings":[{"fix":"Use `get_diff()` for human-readable string output, or iterate over the list objects returned by `diff()`.","message":"In version 0.2.0, the return type of `diff()` changed from a string to a list of change objects. Code expecting a string will break.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Replace `get_diff(a, b)` with `str(diff(a, b))` or similar.","message":"The function `get_diff()` is deprecated in 0.2.0; use `diff()` or `diff_files()` instead.","severity":"deprecated","affected_versions":">=0.2.0"},{"fix":"Always pass string paths: `diff_files('schema1.sql', 'schema2.sql')`.","message":"`diff_files()` expects file paths, not file objects. Passing an open file handle will fail.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install with `pip install sql-compare` and import with `from sql_compare import diff`.","cause":"The package is installed as 'sql-compare' but import uses underscore.","error":"ModuleNotFoundError: No module named 'sql_compare'"},{"fix":"Use `diff()` or `diff_files()` instead of `get_diff()`.","cause":"Function renamed or removed in newer version.","error":"AttributeError: module 'sql_compare' has no attribute 'get_diff'"},{"fix":"Pass a string file path: `diff_files('file1.sql', 'file2.sql')`.","cause":"Passed a file object to `diff_files()` instead of a file path.","error":"TypeError: expected str, bytes or os.PathLike object, not _io.TextIOWrapper"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}