Skip to content

Commit

Permalink
Stop overriding snow:// with @ (#1165)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-astus authored Jun 6, 2024
1 parent ba393cb commit aef3e82
Show file tree
Hide file tree
Showing 4 changed files with 232 additions and 23 deletions.
5 changes: 1 addition & 4 deletions src/snowflake/cli/plugins/stage/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,9 @@ class StageManager(SqlExecutionMixin):
@staticmethod
def get_standard_stage_prefix(name: str) -> str:
# Handle embedded stages
if name.startswith("@"):
if name.startswith("snow://") or name.startswith("@"):
return name

if name.startswith("snow://"):
return f"@{name[7:]}"

return f"@{name}"

@staticmethod
Expand Down
219 changes: 219 additions & 0 deletions tests/stage/__snapshots__/test_stage.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@

'''
# ---
# name: test_execute[@db.schema.exe-@db.schema.exe-expected_files15]
'''
SUCCESS - @db.schema.exe/s1.sql
SUCCESS - @db.schema.exe/a/s3.sql
SUCCESS - @db.schema.exe/a/b/s4.sql
+---------------------------------------------+
| File | Status | Error |
|---------------------------+---------+-------|
| @db.schema.exe/s1.sql | SUCCESS | None |
| @db.schema.exe/a/s3.sql | SUCCESS | None |
| @db.schema.exe/a/b/s4.sql | SUCCESS | None |
+---------------------------------------------+

'''
# ---
# name: test_execute[@db.schema.exe-@db.schema.exe-expected_files16]
'''
SUCCESS - @db.schema.exe/s1.sql
Expand All @@ -38,6 +53,17 @@

'''
# ---
# name: test_execute[@db.schema.exe/s1.sql-@db.schema.exe-expected_files17]
'''
SUCCESS - @db.schema.exe/s1.sql
+-----------------------------------------+
| File | Status | Error |
|-----------------------+---------+-------|
| @db.schema.exe/s1.sql | SUCCESS | None |
+-----------------------------------------+

'''
# ---
# name: test_execute[@db.schema.exe/s1.sql-@db.schema.exe-expected_files18]
'''
SUCCESS - @db.schema.exe/s1.sql
Expand All @@ -64,6 +90,21 @@

'''
# ---
# name: test_execute[db.schema.exe-@db.schema.exe-expected_files16]
'''
SUCCESS - @db.schema.exe/s1.sql
SUCCESS - @db.schema.exe/a/s3.sql
SUCCESS - @db.schema.exe/a/b/s4.sql
+---------------------------------------------+
| File | Status | Error |
|---------------------------+---------+-------|
| @db.schema.exe/s1.sql | SUCCESS | None |
| @db.schema.exe/a/s3.sql | SUCCESS | None |
| @db.schema.exe/a/b/s4.sql | SUCCESS | None |
+---------------------------------------------+

'''
# ---
# name: test_execute[db.schema.exe-@db.schema.exe-expected_files17]
'''
SUCCESS - @db.schema.exe/s1.sql
Expand All @@ -79,6 +120,21 @@

'''
# ---
# name: test_execute[exe-@exe-expected_files1]
'''
SUCCESS - @exe/s1.sql
SUCCESS - @exe/a/s3.sql
SUCCESS - @exe/a/b/s4.sql
+-----------------------------------+
| File | Status | Error |
|-----------------+---------+-------|
| @exe/s1.sql | SUCCESS | None |
| @exe/a/s3.sql | SUCCESS | None |
| @exe/a/b/s4.sql | SUCCESS | None |
+-----------------------------------+

'''
# ---
# name: test_execute[exe-@exe-expected_files2]
'''
SUCCESS - @exe/s1.sql
Expand All @@ -94,6 +150,21 @@

'''
# ---
# name: test_execute[exe/*-@exe-expected_files3]
'''
SUCCESS - @exe/s1.sql
SUCCESS - @exe/a/s3.sql
SUCCESS - @exe/a/b/s4.sql
+-----------------------------------+
| File | Status | Error |
|-----------------+---------+-------|
| @exe/s1.sql | SUCCESS | None |
| @exe/a/s3.sql | SUCCESS | None |
| @exe/a/b/s4.sql | SUCCESS | None |
+-----------------------------------+

'''
# ---
# name: test_execute[exe/*-@exe-expected_files4]
'''
SUCCESS - @exe/s1.sql
Expand All @@ -109,6 +180,21 @@

'''
# ---
# name: test_execute[exe/*.sql-@exe-expected_files4]
'''
SUCCESS - @exe/s1.sql
SUCCESS - @exe/a/s3.sql
SUCCESS - @exe/a/b/s4.sql
+-----------------------------------+
| File | Status | Error |
|-----------------+---------+-------|
| @exe/s1.sql | SUCCESS | None |
| @exe/a/s3.sql | SUCCESS | None |
| @exe/a/b/s4.sql | SUCCESS | None |
+-----------------------------------+

'''
# ---
# name: test_execute[exe/*.sql-@exe-expected_files5]
'''
SUCCESS - @exe/s1.sql
Expand All @@ -124,6 +210,21 @@

'''
# ---
# name: test_execute[exe/-@exe-expected_files2]
'''
SUCCESS - @exe/s1.sql
SUCCESS - @exe/a/s3.sql
SUCCESS - @exe/a/b/s4.sql
+-----------------------------------+
| File | Status | Error |
|-----------------+---------+-------|
| @exe/s1.sql | SUCCESS | None |
| @exe/a/s3.sql | SUCCESS | None |
| @exe/a/b/s4.sql | SUCCESS | None |
+-----------------------------------+

'''
# ---
# name: test_execute[exe/-@exe-expected_files3]
'''
SUCCESS - @exe/s1.sql
Expand All @@ -139,6 +240,19 @@

'''
# ---
# name: test_execute[exe/a-@exe-expected_files5]
'''
SUCCESS - @exe/a/s3.sql
SUCCESS - @exe/a/b/s4.sql
+-----------------------------------+
| File | Status | Error |
|-----------------+---------+-------|
| @exe/a/s3.sql | SUCCESS | None |
| @exe/a/b/s4.sql | SUCCESS | None |
+-----------------------------------+

'''
# ---
# name: test_execute[exe/a-@exe-expected_files6]
'''
SUCCESS - @exe/a/s3.sql
Expand All @@ -152,6 +266,19 @@

'''
# ---
# name: test_execute[exe/a/*-@exe-expected_files7]
'''
SUCCESS - @exe/a/s3.sql
SUCCESS - @exe/a/b/s4.sql
+-----------------------------------+
| File | Status | Error |
|-----------------+---------+-------|
| @exe/a/s3.sql | SUCCESS | None |
| @exe/a/b/s4.sql | SUCCESS | None |
+-----------------------------------+

'''
# ---
# name: test_execute[exe/a/*-@exe-expected_files8]
'''
SUCCESS - @exe/a/s3.sql
Expand All @@ -165,6 +292,19 @@

'''
# ---
# name: test_execute[exe/a/*.sql-@exe-expected_files8]
'''
SUCCESS - @exe/a/s3.sql
SUCCESS - @exe/a/b/s4.sql
+-----------------------------------+
| File | Status | Error |
|-----------------+---------+-------|
| @exe/a/s3.sql | SUCCESS | None |
| @exe/a/b/s4.sql | SUCCESS | None |
+-----------------------------------+

'''
# ---
# name: test_execute[exe/a/*.sql-@exe-expected_files9]
'''
SUCCESS - @exe/a/s3.sql
Expand All @@ -178,6 +318,19 @@

'''
# ---
# name: test_execute[exe/a/-@exe-expected_files6]
'''
SUCCESS - @exe/a/s3.sql
SUCCESS - @exe/a/b/s4.sql
+-----------------------------------+
| File | Status | Error |
|-----------------+---------+-------|
| @exe/a/s3.sql | SUCCESS | None |
| @exe/a/b/s4.sql | SUCCESS | None |
+-----------------------------------+

'''
# ---
# name: test_execute[exe/a/-@exe-expected_files7]
'''
SUCCESS - @exe/a/s3.sql
Expand All @@ -202,6 +355,28 @@

'''
# ---
# name: test_execute[exe/a/b-@exe-expected_files9]
'''
SUCCESS - @exe/a/b/s4.sql
+-----------------------------------+
| File | Status | Error |
|-----------------+---------+-------|
| @exe/a/b/s4.sql | SUCCESS | None |
+-----------------------------------+

'''
# ---
# name: test_execute[exe/a/b/*-@exe-expected_files11]
'''
SUCCESS - @exe/a/b/s4.sql
+-----------------------------------+
| File | Status | Error |
|-----------------+---------+-------|
| @exe/a/b/s4.sql | SUCCESS | None |
+-----------------------------------+

'''
# ---
# name: test_execute[exe/a/b/*-@exe-expected_files12]
'''
SUCCESS - @exe/a/b/s4.sql
Expand All @@ -213,6 +388,17 @@

'''
# ---
# name: test_execute[exe/a/b/*.sql-@exe-expected_files12]
'''
SUCCESS - @exe/a/b/s4.sql
+-----------------------------------+
| File | Status | Error |
|-----------------+---------+-------|
| @exe/a/b/s4.sql | SUCCESS | None |
+-----------------------------------+

'''
# ---
# name: test_execute[exe/a/b/*.sql-@exe-expected_files13]
'''
SUCCESS - @exe/a/b/s4.sql
Expand All @@ -224,6 +410,17 @@

'''
# ---
# name: test_execute[exe/a/b/-@exe-expected_files10]
'''
SUCCESS - @exe/a/b/s4.sql
+-----------------------------------+
| File | Status | Error |
|-----------------+---------+-------|
| @exe/a/b/s4.sql | SUCCESS | None |
+-----------------------------------+

'''
# ---
# name: test_execute[exe/a/b/-@exe-expected_files11]
'''
SUCCESS - @exe/a/b/s4.sql
Expand All @@ -235,6 +432,17 @@

'''
# ---
# name: test_execute[exe/s1.sql-@exe-expected_files14]
'''
SUCCESS - @exe/s1.sql
+-------------------------------+
| File | Status | Error |
|-------------+---------+-------|
| @exe/s1.sql | SUCCESS | None |
+-------------------------------+

'''
# ---
# name: test_execute[exe/s1.sql-@exe-expected_files15]
'''
SUCCESS - @exe/s1.sql
Expand All @@ -246,6 +454,17 @@

'''
# ---
# name: test_execute[exe/s?.sql-@exe-expected_files13]
'''
SUCCESS - @exe/s1.sql
+-------------------------------+
| File | Status | Error |
|-------------+---------+-------|
| @exe/s1.sql | SUCCESS | None |
+-------------------------------+

'''
# ---
# name: test_execute[exe/s?.sql-@exe-expected_files14]
'''
SUCCESS - @exe/s1.sql
Expand Down
15 changes: 0 additions & 15 deletions tests/stage/test_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,16 +332,6 @@ def test_copy_throws_error_for_same_platform_operation(runner, source, dest, sna
"get @exe/s1.sql file://{}/ parallel=4",
],
),
(
"snow://exe",
["a/s2.sql", "a/b/s3.sql", "s1.sql"],
"@exe",
[
"get @exe/a/s2.sql file://{}/a/ parallel=4",
"get @exe/a/b/s3.sql file://{}/a/b/ parallel=4",
"get @exe/s1.sql file://{}/ parallel=4",
],
),
(
"@exe/a",
["a/s2.sql", "a/b/s3.sql"],
Expand Down Expand Up @@ -666,11 +656,6 @@ def test_stage_internal_put_quoted_path(
"stage_path, expected_stage, expected_files",
[
("@exe", "@exe", ["@exe/s1.sql", "@exe/a/s3.sql", "@exe/a/b/s4.sql"]),
(
"snow://exe",
"@exe",
["@exe/s1.sql", "@exe/a/s3.sql", "@exe/a/b/s4.sql"],
),
("exe", "@exe", ["@exe/s1.sql", "@exe/a/s3.sql", "@exe/a/b/s4.sql"]),
("exe/", "@exe", ["@exe/s1.sql", "@exe/a/s3.sql", "@exe/a/b/s4.sql"]),
("exe/*", "@exe", ["@exe/s1.sql", "@exe/a/s3.sql", "@exe/a/b/s4.sql"]),
Expand Down
Loading

0 comments on commit aef3e82

Please sign in to comment.