Skip to content

Commit f839f85

Browse files
chore: use Union for type hints to satisfy Python 3.9
1 parent 1aa88a2 commit f839f85

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

tests/system/test_asyncpg_connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import asyncio
1818
import os
19-
from typing import Any
19+
from typing import Any, Union
2020

2121
import asyncpg
2222
import sqlalchemy
@@ -33,7 +33,7 @@ async def create_sqlalchemy_engine(
3333
password: str,
3434
db: str,
3535
refresh_strategy: str = "background",
36-
resolver: type[DefaultResolver] | type[DnsResolver] = DefaultResolver,
36+
resolver: Union[type[DefaultResolver], type[DnsResolver]] = DefaultResolver,
3737
) -> tuple[sqlalchemy.ext.asyncio.engine.AsyncEngine, Connector]:
3838
"""Creates a connection pool for a Cloud SQL instance and returns the pool
3939
and the connector. Callers are responsible for closing the pool and the

tests/system/test_pg8000_connection.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import os
1919

2020
# [START cloud_sql_connector_postgres_pg8000]
21+
from typing import Union
22+
2123
import pg8000
2224
import sqlalchemy
2325

@@ -32,7 +34,7 @@ def create_sqlalchemy_engine(
3234
password: str,
3335
db: str,
3436
refresh_strategy: str = "background",
35-
resolver: type[DefaultResolver] | type[DnsResolver] = DefaultResolver,
37+
resolver: Union[type[DefaultResolver], type[DnsResolver]] = DefaultResolver,
3638
) -> tuple[sqlalchemy.engine.Engine, Connector]:
3739
"""Creates a connection pool for a Cloud SQL instance and returns the pool
3840
and the connector. Callers are responsible for closing the pool and the

0 commit comments

Comments
 (0)