Skip to content

Commit cbae094

Browse files
fix: use lazy refresh for Cloud SQL Connector (#144)
1 parent 8cc74dc commit cbae094

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ authors = [
1010
]
1111

1212
dependencies = [
13-
"cloud-sql-python-connector[asyncpg] >= 1.7.0, <2.0.0",
13+
"cloud-sql-python-connector[asyncpg] >= 1.10.0, <2.0.0",
1414
"langchain-core>=0.1.1, <1.0.0 ",
1515
"langchain-community>=0.0.18, <0.3.0",
1616
"numpy>=1.24.4, <2.0.0",

src/langchain_google_cloud_sql_pg/engine.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import aiohttp
2323
import google.auth # type: ignore
2424
import google.auth.transport.requests # type: ignore
25-
from google.cloud.sql.connector import Connector, IPTypes
25+
from google.cloud.sql.connector import Connector, IPTypes, RefreshStrategy
2626
from sqlalchemy import MetaData, Table, text
2727
from sqlalchemy.exc import InvalidRequestError
2828
from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine
@@ -158,6 +158,7 @@ async def _create(
158158
loop=asyncio.get_event_loop(),
159159
user_agent=USER_AGENT,
160160
quota_project=quota_project,
161+
refresh_strategy=RefreshStrategy.LAZY,
161162
)
162163

163164
# if user and password are given, use basic auth

0 commit comments

Comments
 (0)