Skip to content

Commit badd747

Browse files
authored
chore: add region tags to connection code in tests (#113)
* chore: add region tags to connection code in tests * linting
1 parent bd9b7b6 commit badd747

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

tests/system/test_pg8000_connection.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
table_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'
2831
def 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")
4854
def setup() -> Generator:
4955
pool = init_connection_engine()

tests/system/test_pymysql_connection.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
table_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'
2831
def 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")
4753
def setup() -> Generator:
4854
pool = init_connection_engine()

tests/system/test_pytds_connection.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
table_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
2832
def 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")
4855
def setup() -> Generator:
4956
pool = init_connection_engine()

0 commit comments

Comments
 (0)