Skip to content

Commit

Permalink
fix: use lazy refresh for Cloud SQL Connector (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwotherspoon committed Jun 26, 2024
1 parent 8cc74dc commit cbae094
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ authors = [
]

dependencies = [
"cloud-sql-python-connector[asyncpg] >= 1.7.0, <2.0.0",
"cloud-sql-python-connector[asyncpg] >= 1.10.0, <2.0.0",
"langchain-core>=0.1.1, <1.0.0 ",
"langchain-community>=0.0.18, <0.3.0",
"numpy>=1.24.4, <2.0.0",
Expand Down
3 changes: 2 additions & 1 deletion src/langchain_google_cloud_sql_pg/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import aiohttp
import google.auth # type: ignore
import google.auth.transport.requests # type: ignore
from google.cloud.sql.connector import Connector, IPTypes
from google.cloud.sql.connector import Connector, IPTypes, RefreshStrategy
from sqlalchemy import MetaData, Table, text
from sqlalchemy.exc import InvalidRequestError
from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine
Expand Down Expand Up @@ -158,6 +158,7 @@ async def _create(
loop=asyncio.get_event_loop(),
user_agent=USER_AGENT,
quota_project=quota_project,
refresh_strategy=RefreshStrategy.LAZY,
)

# if user and password are given, use basic auth
Expand Down

0 comments on commit cbae094

Please sign in to comment.