We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ff545c2 commit 05d9bcbCopy full SHA for 05d9bcb
cloud-sql/sql-server/sqlalchemy/connect_connector.py
@@ -35,6 +35,12 @@ def connect_with_connector() -> sqlalchemy.engine.base.Engine:
35
db_name = os.environ["DB_NAME"] # e.g. 'my-database'
36
37
ip_type = IPTypes.PRIVATE if os.environ.get("PRIVATE_IP") else IPTypes.PUBLIC
38
+ # [START_EXCLUDE]
39
+ if 'DB_ROOT_CERT' in os.environ:
40
+ db_root_cert = os.environ["DB_ROOT_CERT"] # e.g. 'certs/server-ca.pem'
41
+ else:
42
+ db_root_cert = None
43
+ # [END_EXCLUDE]
44
45
connector = Connector(ip_type)
46
@@ -45,6 +51,9 @@ def getconn() -> pytds.Connection:
51
user=db_user,
52
password=db_pass,
47
53
db=db_name,
54
55
+ cafile=db_root_cert,
56
48
57
)
49
58
return conn
50
59
0 commit comments