Registry / database / cockroachdb

cockroachdb

JSON →
library0.3.5pypypi✓ verified 89d ago

CockroachDB adapter for SQLAlchemy, allowing SQLAlchemy applications to connect to CockroachDB. Current version 0.3.5. Release cadence is irregular; maintained by Cockroach Labs.

pip install cockroachdb
INSTALL
IMPORT
SIG · COCKROACHDB
C
cockroachdb
databasepythonv0.3.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

cockroachdb
✓ import cockroachdb

Create a SQLAlchemy engine for CockroachDB and run a simple query.

from sqlalchemy import create_engine import os DATABASE_URL = os.environ.get('DATABASE_URL', 'cockroachdb://user:password@localhost:26257/defaultdb?sslmode=disable') engine = create_engine(DATABASE_URL) with engine.connect() as conn: result = conn.execute("SELECT version()") print(result.fetchone())
Debug
Known issues
gotchaThe package name 'cockroachdb' might conflict if you also have CockroachDB Python client installed (cockroachdb-python). This adapter is only for SQLAlchemy.
fix
Use pip show to verify, or install in a clean environment.
affects: all
deprecatedOlder versions (pre-0.3.0) used a different connection URI pattern. Ensure your URI starts with 'cockroachdb://' not 'cockroach://'.
fix
Update to version 0.3.5 and use 'cockroachdb://' scheme.
affects: < 0.3.0
gotchaTransactions with SERIALIZABLE isolation may behave differently than PostgreSQL. Use the cockroachdb-specific retry logic for transactions.
fix
Use the 'run_transaction' helper from the CockroachDB Python client for proper retry support.
affects: all
Errors
Common errors & fixes
sqlalchemy.exc.OperationalError: (cockroachdb.sqlalchemy.dialect.CockroachDBDialect) ...
Invalid connection string or missing SSL configuration.
fix
Ensure your DATABASE_URL is correct and includes ?sslmode=disable or ?sslmode=require as needed.
ModuleNotFoundError: No module named 'cockroachdb'
The package is not installed or installed in a different environment.
fix
Run 'pip install cockroachdb' in the correct Python environment.
Upgrade
Version history
0.3.5latest on PyPI · released May 19, 2020
Audit
Dependencies
sqlalchemyrequiredCore dependency for ORM and SQL connection
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
cockroachdb — pip install cockroachdb · libregistry