11# CockroachDB dialect for SQLAlchemy
22
3- ## Prerequisites
3+ ## Setup
4+
5+ ### Version of SQLAlchemy to be used
6+
7+ This version of the dialect requires SQLAlchemy 2.1.x. To work with
8+ SQLAlchemy 2.0.x you'll need to install the corresponding version of this
9+ dialect.
10+
11+ ```
12+ pip install "sqlalchemy-cockroachdb~=2.0"
13+ ```
14+
15+ ### Using async
16+
17+ If you will be running async code you'll need to install the additional
18+ support components for SQLAlchemy:
19+
20+ ```
21+ pip install "sqlalchemy[asyncio]"
22+ ```
23+
24+ ### Database driver
425
526A database driver (DBAPI layer) is required to work with this dialect.
627
7- ### psycopg2
28+ #### < u > psycopg2 (sync only)</ u >
829
930For psycopg2 support you must install either:
1031
@@ -17,44 +38,25 @@ For psycopg2 support you must install either:
1738(The binary package is a practical choice for development and testing but in
1839production it is advised to use the package built from sources.)
1940
20- ### asyncpg
21-
22- For asyncpg support you must install
23-
24- * [ asyncpg] ( https://pypi.org/project/asyncpg/ )
41+ #### <u >asyncpg (async only)</u >
2542
26- For more details on working with asyncpg, see
27- [ README.asyncpg.md] ( README.asyncpg.md )
43+ For asyncpg support you must install [ asyncpg ] ( https://pypi.org/project/asyncpg/ ) . For more details on working with asyncpg, see
44+ [ README.asyncpg.md] ( README.asyncpg.md ) .
2845
29- ### psycopg
46+ #### < u > psycopg (sync or async)</ u >
3047
31- For psycopg version 3 support, you'll need to install
32-
33- * [ psycopg] ( https://pypi.org/project/psycopg/ )
34-
35- As with psycopg2, psycopg can be installed as binary for development and testing purposes.
48+ For psycopg version 3 support, you'll need to install [ psycopg] ( https://pypi.org/project/psycopg/ ) . As with psycopg2, psycopg can
49+ be installed as binary for development and testing purposes.
3650(Installing as binary avoids the need for the libpq-dev package to be installed first.)
3751
38- ` pip install psycopg[binary] `
52+ ```
53+ pip install "psycopg[binary]"
54+ ```
3955
4056For more details on working with psycopg, see
4157[ README.psycopg.md] ( README.psycopg.md )
4258
43- ## Install and usage
44-
45- Use ` pip ` to install the latest release of this dialect.
46-
47- ```
48- pip install sqlalchemy-cockroachdb
49- ```
50-
51- NOTE: This version of the dialect requires SQLAlchemy 2.0.x. To work with
52- earlier versions of SQLAlchemy you'll need to install an earlier version of this
53- dialect.
54-
55- ```
56- pip install "sqlalchemy-cockroachdb<2.0"
57- ```
59+ ## Usage
5860
5961Use a ` cockroachdb ` connection string when creating the ` Engine ` . For example,
6062to connect to an insecure, local CockroachDB cluster using psycopg2:
0 commit comments