# 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](https://pypi.org/project/psycopg2/), which has some
[prerequisites](https://www.psycopg.org/docs/install.html#prerequisites) of
its own, or
* [psycopg2-binary](https://pypi.org/project/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](https://pypi.org/project/asyncpg/)
For more details on working with asyncpg, see
[README.asyncpg.md](README.asyncpg.md)
### psycopg
For psycopg version 3 support (⚠️ experimental 🏗), you'll need to install
* [psycopg](https://pypi.org/project/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](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](README.psycopg.md)
## Changelog
See [CHANGES.md](CHANGES.md)
Raw data
{
"_id": null,
"home_page": "https://github.com/cockroachdb/sqlalchemy-cockroachdb",
"name": "sqlalchemy-cockroachdb",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "SQLAlchemy CockroachDB",
"author": "Cockroach Labs",
"author_email": "cockroach-db@googlegroups.com",
"download_url": "https://files.pythonhosted.org/packages/f2/48/300113edbe1e2d2ad74efbc9b2865acb404019f37cc79e9878a47c984a08/sqlalchemy-cockroachdb-2.0.2.tar.gz",
"platform": null,
"description": "# CockroachDB dialect for SQLAlchemy\n\n## Prerequisites\n\nA database driver (DBAPI layer) is required to work with this dialect.\n\n### psycopg2\n\nFor psycopg2 support you must install either:\n\n* [psycopg2](https://pypi.org/project/psycopg2/), which has some\n [prerequisites](https://www.psycopg.org/docs/install.html#prerequisites) of\n its own, or\n\n* [psycopg2-binary](https://pypi.org/project/psycopg2-binary/)\n\n(The binary package is a practical choice for development and testing but in\nproduction it is advised to use the package built from sources.)\n\n### asyncpg\n\nFor asyncpg support you must install\n\n* [asyncpg](https://pypi.org/project/asyncpg/)\n\nFor more details on working with asyncpg, see \n[README.asyncpg.md](README.asyncpg.md)\n\n### psycopg\n\nFor psycopg version 3 support (\u26a0\ufe0f experimental \ud83c\udfd7), you'll need to install\n\n* [psycopg](https://pypi.org/project/psycopg/)\n\nAs with psycopg2, psycopg can be installed as binary for development and testing purposes.\n(Installing as binary avoids the need for the libpq-dev package to be installed first.)\n\n`pip install psycopg[binary]`\n\nFor more details on working with psycopg, see \n[README.psycopg.md](README.psycopg.md)\n \n## Install and usage\n\nUse `pip` to install the latest release of this dialect.\n\n```\npip install sqlalchemy-cockroachdb\n```\n\nNOTE: This version of the dialect requires SQLAlchemy 2.0 or later. To work with\nearlier versions of SQLAlchemy you'll need to install an earlier version of this\ndialect.\n\n```\npip install sqlalchemy-cockroachdb<2.0.0\n```\n\nUse a `cockroachdb` connection string when creating the `Engine`. For example,\nto connect to an insecure, local CockroachDB cluster using psycopg2:\n\n```\nfrom sqlalchemy import create_engine\nengine = create_engine('cockroachdb://root@localhost:26257/defaultdb?sslmode=disable')\n```\n\nor\n\n```\nfrom sqlalchemy import create_engine\nengine = create_engine('cockroachdb+psycopg2://root@localhost:26257/defaultdb?sslmode=disable')\n```\n\nTo connect using asyncpg:\n\n```\nfrom sqlalchemy.ext.asyncio import create_async_engine\nengine = create_async_engine('cockroachdb+asyncpg://root@localhost:26257/defaultdb')\n```\n\nTo connect using psycopg for sync operation:\n\n```\nfrom sqlalchemy import create_engine\nengine = create_engine('cockroachdb+psycopg://root@localhost:26257/defaultdb')\n```\n\nTo connect using psycopg for async operation (\u26a0\ufe0f experimental \ud83c\udfd7), see\n[README.psycopg.md](README.psycopg.md)\n\n\n## Changelog\n\nSee [CHANGES.md](CHANGES.md)\n",
"bugtrack_url": null,
"license": "http://www.apache.org/licenses/LICENSE-2.0",
"summary": "CockroachDB dialect for SQLAlchemy",
"version": "2.0.2",
"project_urls": {
"Documentation": "https://github.com/cockroachdb/sqlalchemy-cockroachdb/wiki",
"Homepage": "https://github.com/cockroachdb/sqlalchemy-cockroachdb",
"Source": "https://github.com/cockroachdb/sqlalchemy-cockroachdb",
"Tracker": "https://github.com/cockroachdb/sqlalchemy-cockroachdb/issues"
},
"split_keywords": [
"sqlalchemy",
"cockroachdb"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "db3126d9d5f59183f28ea79aaf713a6984bedbb96d1f4b7388ec68b98dbe27ea",
"md5": "8527c08d9002bc61861d39ef2ef48be1",
"sha256": "0d5d50e805b024cb2ccd85423a5c1a367d1a56a5cd0ea47765233fd47665070d"
},
"downloads": -1,
"filename": "sqlalchemy_cockroachdb-2.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8527c08d9002bc61861d39ef2ef48be1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 21432,
"upload_time": "2024-01-10T18:25:50",
"upload_time_iso_8601": "2024-01-10T18:25:50.840195Z",
"url": "https://files.pythonhosted.org/packages/db/31/26d9d5f59183f28ea79aaf713a6984bedbb96d1f4b7388ec68b98dbe27ea/sqlalchemy_cockroachdb-2.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f248300113edbe1e2d2ad74efbc9b2865acb404019f37cc79e9878a47c984a08",
"md5": "4b29291d95ae172dcf62b7b52f26608f",
"sha256": "119756eb905855d6a11345b99cfe853031a3fe598a9c4bf35a8ddac9f89fe8cc"
},
"downloads": -1,
"filename": "sqlalchemy-cockroachdb-2.0.2.tar.gz",
"has_sig": false,
"md5_digest": "4b29291d95ae172dcf62b7b52f26608f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 27781,
"upload_time": "2024-01-10T18:25:53",
"upload_time_iso_8601": "2024-01-10T18:25:53.035882Z",
"url": "https://files.pythonhosted.org/packages/f2/48/300113edbe1e2d2ad74efbc9b2865acb404019f37cc79e9878a47c984a08/sqlalchemy-cockroachdb-2.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-10 18:25:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cockroachdb",
"github_project": "sqlalchemy-cockroachdb",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "sqlalchemy-cockroachdb"
}