pysqlsync
Synchronize schema and large volumes of data
What it is and what it does
pysqlsync is an async-first Python library for synchronizing database schemas and efficiently loading large volumes of data. It uses Python dataclasses to define table structures and generates CREATE, DROP, INSERT, MERGE, and DELETE SQL statements, then executes them asynchronously against database drivers like asyncpg or aiomysql. The library supports two main workflows: schema synchronization (comparing a source database state to a target Python dataclass definition and emitting transformation SQL) and data synchronization (inserting, upserting, or deleting rows from lists of tuples or dataclass instances).
The package is built around async/await patterns to maximize throughput when working with large datasets. It handles type mapping across SQL dialects, supports enumerations and composite types, and can generate SQL from dataclass definitions or discover existing database schemas via information_schema or pg_catalog. Runtime dependencies are minimal (json_strong_typing, truststore, typing_extensions), and the library targets modern Python versions (3.10+).
Use it for:
- Generate CREATE TABLE scripts from Python dataclass definitions for schema initialization across multiple SQL dialects.
- Discover and reflect existing database schemas into Python object hierarchies for programmatic inspection and comparison.
- Synchronize a target database schema to match a desired state defined in Python dataclasses, emitting and executing ALTER/CREATE/DROP statements.
- Bulk-insert or upsert millions of rows from in-memory lists or tuples with minimal CPU overhead using async operations.
- Keep a local database replica in sync with remote data sources by efficiently merging incoming records into existing tables.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Synchronize database schemas and bulk-load data using Python dataclasses and async SQL generation, supporting PostgreSQL, MySQL, and other dialects.
Yes, if you need async bulk data loading or schema synchronization in Python. The library is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and offers genuine performance advantages over traditional ORMs for insert/upsert workflows. Install friction is low. Not suitable if you require Python versions below 3.10 or prefer synchronous APIs.
Install
pysqlsync on PyPI
pip
pip install pysqlsyncuv
uv add pysqlsyncpoetry
poetry add pysqlsyncInstalling pysqlsync
Before you install
Low install friction with only three runtime dependencies. Active maintenance with recent releases; last commit 2026-07-24 and latest release 2026-07-06 indicate ongoing development.
License in practice
MIT license permits commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install pysqlsync
import dataclasses
from pysqlsync import get_dialect, ConnectionParameters
@dataclasses.dataclass
class UserTable:
id: int
name: str
engine = get_dialect("postgresql")
params = ConnectionParameters(host="localhost", database="mydb")
async with engine.create_connection(params) as conn:
await conn.create_objects([UserTable])
await conn.insert_data(UserTable, [UserTable(id=1, name="Alice")])
Requires Python 3.10 or later; async/await usage requires an event loop (e.g., asyncio).
Verify before relying
- Supported database dialects beyond PostgreSQL, MySQL, and Oracle mentioned in formation section.
- Performance comparison baseline against SQLAlchemy or other ORMs in real-world scenarios.
- Handling of complex nested composite types and collection types in practice.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — json_strong_typing, truststore, typing_extensions |
| Maintenance | actively maintained — 39 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 107,486/month — #12,613 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pysqlsync-1.0.0-py3-none-any.whl
Keywords: synchronization, sql-schema, sql-query, sql-insert, database-clients
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
pgcopypgcopy wraps PostgreSQL's binary COPY protocol…
permissive · top 15,000 on PyPI
pangresUpserts pandas DataFrames into PostgreSQL,…
permissive · top 15,000 on PyPI
databasesProvides async database access for PostgreSQL,…
permissive · top 5,000 on PyPI
aiosqlLoad SQL queries from files and call them as…
permissive · top 15,000 on PyPI
asyncmy2asyncmy2 is a fast asyncio-based MySQL/MariaDB…
permissive · top 15,000 on PyPI
asyncpg-trekManages database migrations for asyncpg by…
permissive · top 15,000 on PyPI
asyncmyasyncmy is an asyncio-native MySQL/MariaDB…
permissive · top 5,000 on PyPI
pgpqEncodes PyArrow RecordBatches into PostgreSQL's…
permissive · top 15,000 on PyPI
postgrestAn async Python client library that provides an…
permissive · top 1,000 on PyPI
querysourceQuerySource provides a unified async interface…
permissive · top 15,000 on PyPI