Skip to content

Commit 63e5e20

Browse files
SNOW-743102: fix create_engine("snowflake://").dialect (#387)
1 parent 0d6ae47 commit 63e5e20

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/snowflake/sqlalchemy/snowdialect.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,11 @@ def create_connect_args(self, url):
210210
raise sa_exc.ArgumentError(
211211
f"Invalid name space is specified: {opts['database']}"
212212
)
213-
if ".snowflakecomputing.com" not in opts["host"] and not opts.get("port"):
213+
if (
214+
"host" in opts
215+
and ".snowflakecomputing.com" not in opts["host"]
216+
and not opts.get("port")
217+
):
214218
opts["account"] = opts["host"]
215219
if "." in opts["account"]:
216220
# remove region subdomain

tests/test_core.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,17 @@ def test_connect_args():
173173
engine.dispose()
174174

175175

176+
def test_create_dialect():
177+
"""
178+
Tests getting only dialect object through create_engine
179+
"""
180+
engine = create_engine("snowflake://")
181+
try:
182+
assert engine.dialect
183+
finally:
184+
engine.dispose()
185+
186+
176187
def test_simple_sql(engine_testaccount):
177188
"""
178189
Simple SQL by SQLAlchemy

0 commit comments

Comments
 (0)