Skip to content

Commit 524a2fa

Browse files
cpcloudjcrist
authored andcommitted
feat(snowflake): add userinfo URL parsing
1 parent dc6bfe2 commit 524a2fa

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ibis/backends/sql/compilers/snowflake.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,12 @@ def visit_ExtractFragment(self, op, *, arg):
559559
self.f.as_varchar(self.f.get(self.f.parse_url(arg, 1), "fragment")), ""
560560
)
561561

562+
def visit_ExtractUserInfo(self, op, *, arg):
563+
host = self.f.get(self.f.parse_url(arg), "host")
564+
return self.if_(
565+
host.like(sge.convert("%@%")), self.f.split_part(host, "@", 1), NULL
566+
)
567+
562568
def visit_Unnest(self, op, *, arg):
563569
sep = sge.convert(util.guid())
564570
split = self.f.split(

ibis/backends/tests/test_string.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ def test_substr_with_null_values(backend, alltypes, df):
729729
"user:pass",
730730
marks=[
731731
pytest.mark.notyet(
732-
["bigquery", "clickhouse", "snowflake", "trino"],
732+
["bigquery", "clickhouse", "trino"],
733733
raises=com.OperationNotDefinedError,
734734
reason="doesn't support `USERINFO`",
735735
)

0 commit comments

Comments
 (0)