Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use lazy refresh for Cloud SQL Connector #144

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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