GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - cockroachdb/sqlalchemy-cockroachdb: SQLAlchemy adapter for CockroachDB

BranchesTags
Open more actions menu

Latest commit

 

History

323 Commits
323 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
cockroachdb/sqlalchemy
cockroachdb/sqlalchemy
 
 
sqlalchemy_cockroachdb
sqlalchemy_cockroachdb
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
CHANGES.md
CHANGES.md
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.asyncpg.md
README.asyncpg.md
 
 
README.md
README.md
 
 
README.psycopg.md
README.psycopg.md
 
 
README.testing.md
README.testing.md
 
 
cockroach_helper.sh
cockroach_helper.sh
 
 
dev-requirements.in
dev-requirements.in
 
 
dev-requirements.txt
dev-requirements.txt
 
 
pyproject.toml
pyproject.toml
 
 
setup.cfg
setup.cfg
 
 
setup.py
setup.py
 
 
test-requirements.in
test-requirements.in
 
 
test-requirements.txt
test-requirements.txt
 
 
tox.ini
tox.ini
 
 

Repository files navigation

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

  • psycopg2-binary

(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

  • asyncpg

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

psycopg

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

  • psycopg

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 for this version of the dialect.

pip install "sqlalchemy-cockroachdb~=2.0"

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

About

SQLAlchemy adapter for CockroachDB

Resources

Readme
Apache-2.0 license
Activity
Custom properties

Stars

156 stars

Watchers

45 watching

Forks

66 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.