File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 2525table_name = f"books_{ uuid .uuid4 ().hex } "
2626
2727
28+ # [START cloud_sql_connector_postgres_pg8000]
29+ # The Cloud SQL Python Connector can be used along with SQLAlchemy using the
30+ # 'creator' argument to 'create_engine'
2831def init_connection_engine () -> sqlalchemy .engine .Engine :
2932 def getconn () -> pg8000 .dbapi .Connection :
3033 conn : pg8000 .dbapi .Connection = connector .connect (
@@ -44,6 +47,9 @@ def getconn() -> pg8000.dbapi.Connection:
4447 return engine
4548
4649
50+ # [END cloud_sql_connector_postgres_pg8000]
51+
52+
4753@pytest .fixture (name = "pool" )
4854def setup () -> Generator :
4955 pool = init_connection_engine ()
Original file line number Diff line number Diff line change 2525table_name = f"books_{ uuid .uuid4 ().hex } "
2626
2727
28+ # [START cloud_sql_connector_mysql_pymysql]
29+ # The Cloud SQL Python Connector can be used along with SQLAlchemy using the
30+ # 'creator' argument to 'create_engine'
2831def init_connection_engine () -> sqlalchemy .engine .Engine :
2932 def getconn () -> pymysql .connections .Connection :
3033 conn : pymysql .connections .Connection = connector .connect (
@@ -43,6 +46,9 @@ def getconn() -> pymysql.connections.Connection:
4346 return engine
4447
4548
49+ # [END cloud_sql_connector_mysql_pymysql]
50+
51+
4652@pytest .fixture (name = "pool" )
4753def setup () -> Generator :
4854 pool = init_connection_engine ()
Original file line number Diff line number Diff line change 2525table_name = f"books_{ uuid .uuid4 ().hex } "
2626
2727
28+ # [START cloud_sql_connector_mysql_pytds]
29+ # The Cloud SQL Python Connector can be used along with SQLAlchemy using the
30+ # 'creator' argument to 'create_engine'. To use SQLAlchemy with pytds, include
31+ # 'sqlalchemy-pytds` in your dependencies
2832def init_connection_engine () -> sqlalchemy .engine .Engine :
2933 def getconn () -> pytds .Connection :
3034 conn = connector .connect (
@@ -44,6 +48,9 @@ def getconn() -> pytds.Connection:
4448 return engine
4549
4650
51+ # [END cloud_sql_connector_mysql_pytds]
52+
53+
4754@pytest .fixture (name = "pool" )
4855def setup () -> Generator :
4956 pool = init_connection_engine ()
You can’t perform that action at this time.
0 commit comments