Skip to content

Commit f9dc2d6

Browse files
Andrei-PaulTakashi Matsuoshubha-rajan
authored
Fix deprecation warning for sqlalchemy 1.4 (GoogleCloudPlatform#5834)
Calling URL() directly is deprecated and will be disabled in a future release. The public constructor for URL is now the URL.create() method. Fixed "# Equivalent URL:" example typo. Co-authored-by: Takashi Matsuo <tmatsuo@google.com> Co-authored-by: Shubha Rajan <shubhadayini@google.com>
1 parent 41f21fe commit f9dc2d6

File tree

1 file changed

+4
-4
lines changed
  • cloud-sql/postgres/sqlalchemy

1 file changed

+4
-4
lines changed

cloud-sql/postgres/sqlalchemy/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ def init_tcp_connection_engine(db_config):
7878

7979
pool = sqlalchemy.create_engine(
8080
# Equivalent URL:
81-
# postgres+pg8000://<db_user>:<db_pass>@<db_host>:<db_port>/<db_name>
82-
sqlalchemy.engine.url.URL(
81+
# postgresql+pg8000://<db_user>:<db_pass>@<db_host>:<db_port>/<db_name>
82+
sqlalchemy.engine.url.URL.create(
8383
drivername="postgresql+pg8000",
8484
username=db_user, # e.g. "my-database-user"
8585
password=db_pass, # e.g. "my-database-password"
@@ -108,9 +108,9 @@ def init_unix_connection_engine(db_config):
108108
pool = sqlalchemy.create_engine(
109109

110110
# Equivalent URL:
111-
# postgres+pg8000://<db_user>:<db_pass>@/<db_name>
111+
# postgresql+pg8000://<db_user>:<db_pass>@/<db_name>
112112
# ?unix_sock=<socket_path>/<cloud_sql_instance_name>/.s.PGSQL.5432
113-
sqlalchemy.engine.url.URL(
113+
sqlalchemy.engine.url.URL.create(
114114
drivername="postgresql+pg8000",
115115
username=db_user, # e.g. "my-database-user"
116116
password=db_pass, # e.g. "my-database-password"

0 commit comments

Comments
 (0)