skillfed

pysqlsync

Synchronize schema and large volumes of data

pysqlsync v1.0.0 107.5K downloads/30d#12,613 on PyPI6
Permissive license MIT Active released

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 pysqlsync

uv

uv add pysqlsync

poetry

poetry add pysqlsync

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Database :: Database Engines/ServersTopic :: Software Development :: Code GeneratorsTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

async database schema synchronizationbulk insert upsert merge sqldataclass to sql table mappingdatabase schema discovery reflectionefficient data loading postgresql mysql
async-sqlschema-migrationbulk-operations

More Python Modules packages