--- id: sqlalchemy-cockroachdb version: "2.0.4" license: http://www.apache.org/licenses/LICENSE-2.0 license_treatment: permissive maintenance: active --- # sqlalchemy-cockroachdb — CockroachDB dialect for SQLAlchemy License: permissive · Maintenance: active · Downloads: 971.0K/mo ## 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 above — 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 pip install sqlalchemy-cockroachdb uv add sqlalchemy-cockroachdb 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: unspecified - Install friction: low - Maintenance: active - Downloads: 971.0K/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags sqlalchemy cockroachdb dialect, cockroachdb orm python, sqlalchemy async cockroachdb, psycopg asyncpg cockroachdb, cockroachdb python driver, sqlalchemy database adapter, sqlalchemy-dialect, cockroachdb, async-support [View on SkillFed](https://skillfed.io/packages/sqlalchemy-cockroachdb) · [View on PyPI](https://pypi.org/project/sqlalchemy-cockroachdb/)