skillfed

sqlalchemy-cockroachdb

CockroachDB dialect for SQLAlchemy

sqlalchemy-cockroachdb v2.0.4 971.0K downloads/30d#4,609 on PyPI156
Permissive license http://www.apache.org/licenses/LICENSE-2.0 Active released

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-cockroachdb

uv

uv add sqlalchemy-cockroachdb

poetry

poetry add sqlalchemy-cockroachdb

Installing 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

License :: OSI Approved :: Apache Software LicenseProgramming 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.14

Tags

sqlalchemy cockroachdb dialectcockroachdb orm pythonsqlalchemy async cockroachdbpsycopg asyncpg cockroachdbcockroachdb python driversqlalchemy database adapter
sqlalchemy-dialectcockroachdbasync-support

More Front-Ends packages

SQLAlchemy

SQLAlchemy is a Python SQL toolkit and Object…

permissive · top 100 on PyPI

psycopg2-binary

psycopg2-binary is a PostgreSQL database…

copyleft · top 1,000 on PyPI

alembic

Alembic generates and manages database schema…

permissive · top 1,000 on PyPI

weaviate-client

A Python client library for connecting to and…

permissive · top 1,000 on PyPI

databricks-sql-connector

A Python client library that connects to…

permissive · top 1,000 on PyPI

psycopg

Psycopg 3 is a PostgreSQL database adapter for…

copyleft · top 1,000 on PyPI

pinotdb

Provides Python DB-API and SQLAlchemy dialect…

permissive · top 1,000 on PyPI

sqlalchemy-jdbcapi

SQLAlchemy dialect for JDBC and ODBC database…

permissive · top 15,000 on PyPI

sqlalchemy-risingwave

Provides a SQLAlchemy dialect that enables…

permissive · top 15,000 on PyPI

sqlalchemy-pgspider

Provides a SQLAlchemy dialect that enables…

permissive · top 15,000 on PyPI

starrocks

Provides a SQLAlchemy dialect and Alembic…

permissive · top 15,000 on PyPI

prisma

Prisma Client Python is a type-safe ORM that…

permissive · top 5,000 on PyPI

clickhouse-sqlalchemy

SQLAlchemy dialect for ClickHouse that enables…

permissive · top 5,000 on PyPI

sqlalchemy-rdsiam

Provides SQLAlchemy dialects for connecting to…

unclear · top 15,000 on PyPI

chalk-sqlalchemy-redshift

Provides a SQLAlchemy dialect for Amazon…

permissive · top 15,000 on PyPI

sqlalchemy-redshift

Provides a SQLAlchemy dialect for Amazon…

permissive · top 5,000 on PyPI