sqlalchemy-cockroachdb
CockroachDB dialect for SQLAlchemy
What it is and what it does
This package provides a SQLAlchemy dialect that translates SQLAlchemy's ORM and Core SQL constructs into CockroachDB-compatible SQL. It acts as a bridge between your Python application and a CockroachDB cluster, allowing you to use SQLAlchemy's familiar API instead of writing raw SQL or using a lower-level driver directly.
The dialect supports three different database drivers—psycopg2 (and its binary variant), asyncpg, and psycopg (version 3)—giving you flexibility in choosing between synchronous and asynchronous operation. You specify which driver to use in your connection string (e.g., `cockroachdb+asyncpg://...`). The package itself is a thin adapter layer; it depends only on SQLAlchemy and requires you to install your chosen driver separately.
Use it for:
- Building a Python web application with SQLAlchemy ORM models that persists data to a CockroachDB cluster.
- Migrating an existing SQLAlchemy application from PostgreSQL to CockroachDB with minimal code changes.
- Writing async Python services that need non-blocking database access to CockroachDB via asyncpg.
- Using SQLAlchemy's query builder and schema reflection tools against CockroachDB without raw SQL.
- Testing distributed SQL workloads locally by connecting a SQLAlchemy app to a local CockroachDB node.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A SQLAlchemy dialect that enables ORM and SQL toolkit access to CockroachDB databases, supporting both synchronous and asynchronous connections through multiple database drivers.
Yes, if you are using SQLAlchemy 2.0.x and need CockroachDB support. The package is actively maintained, has no known vulnerabilities, carries a permissive license, and requires only one runtime dependency. The main condition is that you must install a separate database driver (psycopg2, asyncpg, or psycopg) before you can connect—this is documented but represents a real prerequisite step.
Install
sqlalchemy-cockroachdb on PyPI
pip
pip install sqlalchemy-cockroachdbuv
uv add sqlalchemy-cockroachdbpoetry
poetry add sqlalchemy-cockroachdbInstalling sqlalchemy-cockroachdb
Before you install
Low friction install with a single runtime dependency on SQLAlchemy. The package is actively maintained with a recent release and no known vulnerabilities. However, you must separately install one of three database drivers (psycopg2, asyncpg, or psycopg) before the dialect will function.
License in practice
Licensed under Apache 2.0 (permissive), allowing free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install sqlalchemy-cockroachdb
from sqlalchemy import create_engine
engine = create_engine('cockroachdb://root@localhost:26257/defaultdb?sslmode=disable')
Requires SQLAlchemy 2.0.x and one of: psycopg2, psycopg2-binary, asyncpg, or psycopg (version 3). Without a driver installed, connection attempts will fail.
Verify before relying
- Whether the dialect supports all CockroachDB-specific SQL features and extensions beyond standard PostgreSQL compatibility.
- Performance characteristics and any known limitations when used with high-concurrency async workloads.
- Compatibility matrix details between specific CockroachDB versions and this dialect version.
Package facts
| License | http://www.apache.org/licenses/LICENSE-2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — SQLAlchemy |
| Maintenance | actively maintained — 113 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 970,968/month — #4,609 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sqlalchemy_cockroachdb-2.0.4-py3-none-any.whl
Keywords: SQLAlchemy, CockroachDB
Tags
More Front-Ends packages
SQLAlchemy is a Python SQL toolkit and Object…
permissive · top 100 on PyPI
psycopg2-binarypsycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
alembicAlembic generates and manages database schema…
permissive · top 1,000 on PyPI
weaviate-clientA Python client library for connecting to and…
permissive · top 1,000 on PyPI
databricks-sql-connectorA Python client library that connects to…
permissive · top 1,000 on PyPI
psycopgPsycopg 3 is a PostgreSQL database adapter for…
copyleft · top 1,000 on PyPI
pinotdbProvides Python DB-API and SQLAlchemy dialect…
permissive · top 1,000 on PyPI
sqlalchemy-jdbcapiSQLAlchemy dialect for JDBC and ODBC database…
permissive · top 15,000 on PyPI
sqlalchemy-risingwaveProvides a SQLAlchemy dialect that enables…
permissive · top 15,000 on PyPI
sqlalchemy-pgspiderProvides a SQLAlchemy dialect that enables…
permissive · top 15,000 on PyPI
starrocksProvides a SQLAlchemy dialect and Alembic…
permissive · top 15,000 on PyPI
prismaPrisma Client Python is a type-safe ORM that…
permissive · top 5,000 on PyPI
clickhouse-sqlalchemySQLAlchemy dialect for ClickHouse that enables…
permissive · top 5,000 on PyPI
sqlalchemy-rdsiamProvides SQLAlchemy dialects for connecting to…
unclear · top 15,000 on PyPI
chalk-sqlalchemy-redshiftProvides a SQLAlchemy dialect for Amazon…
permissive · top 15,000 on PyPI
sqlalchemy-redshiftProvides a SQLAlchemy dialect for Amazon…
permissive · top 5,000 on PyPI