Skip to main content

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:

(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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlalchemy_cockroachdb-2.0.3.tar.gz (28.5 kB view details)

Uploaded Source

Built Distribution

sqlalchemy_cockroachdb-2.0.3-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file sqlalchemy_cockroachdb-2.0.3.tar.gz.

File metadata

  • Download URL: sqlalchemy_cockroachdb-2.0.3.tar.gz
  • Upload date:
  • Size: 28.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for sqlalchemy_cockroachdb-2.0.3.tar.gz
Algorithm Hash digest
SHA256 48b763ffd8b2a4dc9d56459934a56d7d5ffad415c6e68d114baee5d12cf79c1d
MD5 96ddb05b49186914749fa6c6dc77672e
BLAKE2b-256 32022e2e6a0b47259f3c61f3a062653070302eea81f0ae9a57cd3ab7f1dc110e

See more details on using hashes here.

File details

Details for the file sqlalchemy_cockroachdb-2.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for sqlalchemy_cockroachdb-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cd1dca9a8c65ec8564c928ea26d154b7fc02f82948af200d965343894ca0c0f5
MD5 445b0c484d91af68c7af04fe538b3ede
BLAKE2b-256 f161ae638b8adaea4bcb5092b7fedad14d53ef2bef2b75877503019ddf06cd89

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page