CockroachDB dialect for SQLAlchemy
Project description
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:
-
psycopg2, which has some prerequisites of its own, or
(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 (⚠️ experimental 🏗), 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 or later. To work with earlier versions of SQLAlchemy you'll need to install an earlier version of this dialect.
pip install sqlalchemy-cockroachdb<2.0.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 (⚠️ experimental 🏗), see README.psycopg.md
Changelog
See CHANGES.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sqlalchemy-cockroachdb-2.0.2.tar.gz
.
File metadata
- Download URL: sqlalchemy-cockroachdb-2.0.2.tar.gz
- Upload date:
- Size: 27.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 119756eb905855d6a11345b99cfe853031a3fe598a9c4bf35a8ddac9f89fe8cc |
|
MD5 | 4b29291d95ae172dcf62b7b52f26608f |
|
BLAKE2b-256 | f248300113edbe1e2d2ad74efbc9b2865acb404019f37cc79e9878a47c984a08 |
File details
Details for the file sqlalchemy_cockroachdb-2.0.2-py3-none-any.whl
.
File metadata
- Download URL: sqlalchemy_cockroachdb-2.0.2-py3-none-any.whl
- Upload date:
- Size: 21.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d5d50e805b024cb2ccd85423a5c1a367d1a56a5cd0ea47765233fd47665070d |
|
MD5 | 8527c08d9002bc61861d39ef2ef48be1 |
|
BLAKE2b-256 | db3126d9d5f59183f28ea79aaf713a6984bedbb96d1f4b7388ec68b98dbe27ea |