Skip to main content

CockroachDB dialect for SQLAlchemy

Prerequisites

A database driver (DBAPI layer) is required to work with this dialect.

psycopg2

For psycopg2 support you must install either:

(The binary package is a practical choice for development and testing but in production it is advised to use the package built from sources.)

asyncpg

For asyncpg support you must install

For more details on working with asyncpg, see README.asyncpg.md

psycopg

For psycopg version 3 support, you'll need to install

As with psycopg2, psycopg can be installed as binary for development and testing purposes. (Installing as binary avoids the need for the libpq-dev package to be installed first.)

pip install psycopg[binary]

For more details on working with psycopg, see README.psycopg.md

Install and usage

Use pip to install the latest release of this dialect.

pip install sqlalchemy-cockroachdb

NOTE: This version of the dialect requires SQLAlchemy 2.0.x. To work with earlier versions of SQLAlchemy you'll need to install an earlier version of this dialect.

pip install "sqlalchemy-cockroachdb<2.0"

Use a cockroachdb connection string when creating the Engine. For example, to connect to an insecure, local CockroachDB cluster using psycopg2:

from sqlalchemy import create_engine
engine = create_engine('cockroachdb://root@localhost:26257/defaultdb?sslmode=disable')

or

from sqlalchemy import create_engine
engine = create_engine('cockroachdb+psycopg2://root@localhost:26257/defaultdb?sslmode=disable')

To connect using asyncpg:

from sqlalchemy.ext.asyncio import create_async_engine
engine = create_async_engine('cockroachdb+asyncpg://root@localhost:26257/defaultdb')

To connect using psycopg for sync operation:

from sqlalchemy import create_engine
engine = create_engine('cockroachdb+psycopg://root@localhost:26257/defaultdb')

To connect using psycopg for async operation, see README.psycopg.md

Changelog

See CHANGES.md

Release files for sqlalchemy-cockroachdb 2.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqlalchemy-cockroachdb 2.0.4
File Size Uploaded
sqlalchemy_cockroachdb-2.0.4.tar.gz 31.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sqlalchemy-cockroachdb 2.0.4
File Interpreter ABI Platform
sqlalchemy_cockroachdb-2.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 54.5 kB

Release files / sqlalchemy_cockroachdb-2.0.4.tar.gz

Download URL sqlalchemy_cockroachdb-2.0.4.tar.gz
Size 31.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f66354d2b93da89cb4524c5b78a44d0cf5a8943d328b7f0aee4aa1dfc6178b65
BLAKE2b-256 checksum
How to use checksums
c0461462dd4734c58e04b754db71a9607de6d748dedea86e30007b5ae7b4e3db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.16

Release files / sqlalchemy_cockroachdb-2.0.4-py3-none-any.whl

Download URL sqlalchemy_cockroachdb-2.0.4-py3-none-any.whl
Size 22.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0804306a733a1fe09b2d496eadf8bf35d878862b6138e69175136fa2ca0ce5d0
BLAKE2b-256 checksum
How to use checksums
f2f1e08ec3fc57b6f890e8f6eb16734c4865626635f4863cc2fe7d259699ce7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.16

Release history Release notifications | RSS feed

This release

2.0.4 This release

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.4.6

2 release files

1.4.5

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

0.4.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page