@@ -42,6 +42,7 @@ The Cloud SQL Python Connector is a package to be used alongside a database driv
4242Currently supported drivers are:
4343 - [ ` pymysql ` ] ( https://github.com/PyMySQL/PyMySQL ) (MySQL)
4444 - [ ` pg8000 ` ] ( https://github.com/tlocke/pg8000 ) (PostgreSQL)
45+ - [ ` psycopg ` ] ( https://github.com/psycopg/psycopg ) (PostgreSQL)
4546 - [ ` asyncpg ` ] ( https://github.com/MagicStack/asyncpg ) (PostgreSQL)
4647 - [ ` pytds ` ] ( https://github.com/denisenkom/pytds ) (SQL Server)
4748
@@ -56,12 +57,16 @@ based on your database dialect.
5657pip install "cloud-sql-python-connector[pymysql]"
5758```
5859### Postgres
59- There are two different database drivers that are supported for the Postgres dialect:
60+ There are three different database drivers that are supported for the Postgres dialect:
6061
6162#### pg8000
6263```
6364pip install "cloud-sql-python-connector[pg8000]"
6465```
66+ #### psycopg
67+ ```
68+ pip install "cloud-sql-python-connector[psycopg]"
69+ ```
6570#### asyncpg
6671```
6772pip install "cloud-sql-python-connector[asyncpg]"
@@ -137,6 +142,18 @@ pool = sqlalchemy.create_engine(
137142 db = " my-db-name"
138143 ),
139144)
145+
146+ # Or with Postgres (psycopg):
147+ pool = sqlalchemy.create_engine(
148+ " postgresql+psycopg://" ,
149+ creator = lambda : connector.connect(
150+ " project:region:instance" ,
151+ " psycopg" ,
152+ user = " my-user" ,
153+ password = " my-password" ,
154+ db = " my-db-name"
155+ ),
156+ )
140157```
141158
142159The returned connection pool engine can then be used to query and modify the database.
0 commit comments