You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ The connector itself creates connection objects by calling its `connect` method
56
56
In the connector's `connect` method below, input your connection string as the first positional argument and the name of the database driver for the second positional argument. Insert the rest of your connection keyword arguments like user, password and database. You can also set the optional `timeout` or `ip_type` keyword arguments.
57
57
58
58
To use this connector with SQLAlchemy, use the `creator` argument for `sqlalchemy.create_engine`:
@@ -74,7 +74,7 @@ pool = sqlalchemy.create_engine(
74
74
```
75
75
76
76
The returned connection pool engine can then be used to query and modify the database.
77
-
```
77
+
```python
78
78
# insert statement
79
79
insert_stmt = sqlalchemy.text(
80
80
"INSERT INTO my_table (id, title) VALUES (:id, :title)",
@@ -99,7 +99,7 @@ with pool.connect() as db_conn:
99
99
### Specifying Public or Private IP
100
100
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`.
101
101
Example:
102
-
```
102
+
```python
103
103
connector.connect(
104
104
"project:region:instance",
105
105
"pymysql",
@@ -116,7 +116,7 @@ First, make sure to [configure your Cloud SQL Instance to allow IAM authenticati
116
116
Now, you can connect using user or service account credentials instead of a password.
117
117
In the call to connect, set the `enable_iam_auth` keyword argument to true and `user` to the email address associated with your IAM user.
0 commit comments