Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit b4aa7ec

Browse files
feat: add user_agent to client (#25)
1 parent 6c82c4e commit b4aa7ec

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ requires-python = ">=3.8"
88
dependencies = [
99
"langchain==0.1.1",
1010
"SQLAlchemy==2.0.7",
11-
"cloud-sql-python-connector[pymysql]==1.5.0"
11+
"cloud-sql-python-connector[pymysql]==1.7.0"
1212
]
1313

1414
[tool.setuptools.dynamic]

src/langchain_google_cloud_sql_mysql/mysql_engine.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@
2323
import sqlalchemy
2424
from google.cloud.sql.connector import Connector
2525

26+
from .version import __version__
27+
2628
if TYPE_CHECKING:
2729
import google.auth.credentials
2830
import pymysql
2931

32+
USER_AGENT = "langchain-google-cloud-sql-mysql-python/" + __version__
33+
3034

3135
def _get_iam_principal_email(
3236
credentials: google.auth.credentials.Credentials,
@@ -174,7 +178,7 @@ def _create_connector_engine(
174178
enable_iam_auth = True
175179

176180
if cls._connector is None:
177-
cls._connector = Connector()
181+
cls._connector = Connector(user_agent=USER_AGENT)
178182

179183
# anonymous function to be used for SQLAlchemy 'creator' argument
180184
def getconn() -> pymysql.Connection:

src/langchain_google_cloud_sql_mysql/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "0.1.0"
15+
__version__ = "0.0.1"

0 commit comments

Comments
 (0)