Skip to content

Commit b7d1642

Browse files
chore: add IPTypes import to samples (#317)
1 parent 88f0fe4 commit b7d1642

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ defaults for each connection to make, you can initialize a custom
107107
`Connector` object directly:
108108

109109
```python
110-
from google.cloud.sql.connector import Connector
110+
from google.cloud.sql.connector import Connector, IPTypes
111111

112112
# Note: all parameters below are optional
113113
connector = Connector(
@@ -190,10 +190,12 @@ with pool.connect() as db_conn:
190190
The Cloud SQL Connector for Python can be used to connect to Cloud SQL instances using both public and private IP addresses. To specify which IP address to use to connect, set the `ip_type` keyword argument Possible values are `IPTypes.PUBLIC` and `IPTypes.PRIVATE`.
191191
Example:
192192
```python
193+
from google.cloud.sql.connector import IPTypes
194+
193195
connector.connect(
194196
"project:region:instance",
195197
"pymysql",
196-
ip_type=IPTypes.PRIVATE # Prefer private IP
198+
ip_type=IPTypes.PRIVATE # use private IP
197199
... insert other kwargs ...
198200
)
199201
```

0 commit comments

Comments
 (0)