{"id":24405,"library":"pysqlsync","title":"pysqlsync","description":"A Python library for synchronizing database schema and large volumes of data between different database engines. Version 0.8.4 supports PostgreSQL, MySQL, SQLite, and MSSQL. Active development with monthly releases.","status":"active","version":"0.8.4","language":"python","source_language":"en","source_url":"https://github.com/hunyadi/pysqlsync","tags":["database","synchronization","schema-migration","data-sync","async"],"install":[{"cmd":"pip install pysqlsync","lang":"bash","label":"Default install"},{"cmd":"pip install pysqlsync[postgresql,mysql]","lang":"bash","label":"With database drivers"}],"dependencies":[{"reason":"Required for PostgreSQL sync engine","package":"asyncpg","optional":true},{"reason":"Required for MySQL sync engine","package":"aiomysql","optional":true},{"reason":"Required for SQLite sync engine","package":"aiosqlite","optional":true},{"reason":"Required for MSSQL sync engine","package":"pymssql","optional":true}],"imports":[{"note":"Main class for synchronization.","symbol":"SyncEngine","correct":"from pysqlsync.sync import SyncEngine"},{"note":"PostgreSQL-specific sync engine.","symbol":"PostgreSQLSyncEngine","correct":"from pysqlsync.sync.postgresql import PostgreSQLSyncEngine"},{"note":"MySQL-specific sync engine.","symbol":"MySQLSyncEngine","correct":"from pysqlsync.sync.mysql import MySQLSyncEngine"},{"note":"SQLite-specific sync engine.","symbol":"SQLiteSyncEngine","correct":"from pysqlsync.sync.sqlite import SQLiteSyncEngine"}],"quickstart":{"code":"import asyncio\nfrom pysqlsync.sync.postgresql import PostgreSQLSyncEngine\nfrom pysqlsync.model import TableDef\n\nasync def main():\n    # Connect and sync\n    engine = PostgreSQLSyncEngine(\n        host='localhost',\n        port=5432,\n        user='user',\n        password=os.environ.get('PGPASSWORD', ''),\n        database='mydb'\n    )\n    await engine.connect()\n    \n    # Define a table\n    table = TableDef(name='users', columns=[\n        {'name': 'id', 'type': 'integer', 'primary_key': True},\n        {'name': 'name', 'type': 'text'}\n    ])\n    \n    # Create table and sync data\n    await engine.create_table(table)\n    await engine.sync_data(table, [{'id': 1, 'name': 'Alice'}], mode='upsert')\n    \n    await engine.close()\n\nasyncio.run(main())","lang":"python","description":"Connect to PostgreSQL, define a table, and sync data with upsert mode."},"warnings":[{"fix":"Update imports to use 'from pysqlsync.sync.postgresql import PostgreSQLSyncEngine' instead of 'from pysqlsync.engine.postgresql import PostgreSQLSyncEngine'.","message":"Version 0.8.0 renamed 'SQLSyncEngine' to 'SyncEngine' and moved engines to submodules like 'pysqlsync.sync.postgresql'. Old imports from 'pysqlsync.engine.*' will fail.","severity":"breaking","affected_versions":">=0.8.0"},{"fix":"Use mode='upsert' (insert or update) or mode='overwrite' (delete and insert).","message":"The 'mode' parameter in sync_data() with value 'replace' is deprecated in favor of 'upsert' or 'overwrite' since 0.7.0.","severity":"deprecated","affected_versions":">=0.7.0"},{"fix":"Always run sync code inside async functions and use asyncio.run().","message":"All operations require an active event loop; running without asyncio.get_event_loop() will fail. Engine.connect() is async and must be awaited.","severity":"gotcha","affected_versions":"All"},{"fix":"Install required extras: pip install pysqlsync[postgresql] for PostgreSQL, etc.","message":"If optional database driver is not installed, import raises ModuleNotFoundError. pysqlsync does not auto-install drivers.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from pysqlsync.sync.postgresql import PostgreSQLSyncEngine'.","cause":"Imports changed in v0.8.0; engines moved under pysqlsync.sync.","error":"ModuleNotFoundError: No module named 'pysqlsync.engine'"},{"fix":"Replace engine.sync(...) with await engine.sync_data(...).","cause":"Older API used 'sync'; renamed to 'sync_data' in v0.7.0.","error":"AttributeError: 'PostgreSQLSyncEngine' object has no attribute 'sync_data'"},{"fix":"Ensure only one call to asyncio.run() or use await inside existing async context.","cause":"pysqlsync functions are async and require a running loop, but calling asyncio.run() inside a nested context is invalid.","error":"RuntimeError: asyncio.run() cannot be called from a running event loop"},{"fix":"pip install pysqlsync[postgresql] or pip install asyncpg","cause":"PostgreSQL driver not installed.","error":"ModuleNotFoundError: No module named 'asyncpg'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}