Skip to content

Commit abf7edb

Browse files
SNOW-679045: _rfc_1738_quote is no longer available in sqlalchemy 1.4.42 (#351)
1 parent 94f234e commit abf7edb

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@ repos:
4444
- id: flake8
4545
additional_dependencies:
4646
- flake8-bugbear == 20.11.1
47+
- importlib_metadata == 4.13.0

DESCRIPTION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Source code is also available at:
1111

1212
- v1.4.3(Unreleased)
1313
- Fixed a bug that `SnowflakeDialect.normalize_name` and `SnowflakeDialect.denormalize_name` could not handle empty string.
14+
- Fixed a compatibility issue to vendor function `sqlalchemy.engine.url._rfc_1738_quote` as it is removed from SQLAlchemy v1.4.42.
1415

1516
- v1.4.2(Sep 19, 2022)
1617

src/snowflake/sqlalchemy/util.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
# Copyright (c) 2012-2022 Snowflake Computing Inc. All rights reserved.
33
#
44

5+
import re
56
from urllib.parse import quote_plus
67

78
from sqlalchemy import exc
8-
from sqlalchemy.engine.url import _rfc_1738_quote
99

1010
from snowflake.connector.compat import IS_STR
1111

1212

13+
def _rfc_1738_quote(text):
14+
return re.sub(r"[:@/]", lambda m: "%%%X" % ord(m.group(0)), text)
15+
16+
1317
def _url(**db_parameters):
1418
"""
1519
Composes a SQLAlchemy connect string from the given database connection

0 commit comments

Comments
 (0)