diff --git a/src/snowflake/cli/plugins/stage/manager.py b/src/snowflake/cli/plugins/stage/manager.py index 0120e7865f..0a8632387f 100644 --- a/src/snowflake/cli/plugins/stage/manager.py +++ b/src/snowflake/cli/plugins/stage/manager.py @@ -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 diff --git a/tests/stage/__snapshots__/test_stage.ambr b/tests/stage/__snapshots__/test_stage.ambr index e40a791d26..98ed24f4d3 100644 --- a/tests/stage/__snapshots__/test_stage.ambr +++ b/tests/stage/__snapshots__/test_stage.ambr @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/tests/stage/test_stage.py b/tests/stage/test_stage.py index 59a8726098..417b83167c 100644 --- a/tests/stage/test_stage.py +++ b/tests/stage/test_stage.py @@ -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"], @@ -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"]), diff --git a/tests/streamlit/test_commands.py b/tests/streamlit/test_commands.py index 03194d24e6..0bc1e3781a 100644 --- a/tests/streamlit/test_commands.py +++ b/tests/streamlit/test_commands.py @@ -440,7 +440,9 @@ def test_deploy_streamlit_main_and_pages_files_experimental( with project_directory("example_streamlit"): result = runner.invoke(["streamlit", "deploy", "--experimental"]) - root_path = f"@streamlit/MockDatabase.MockSchema.{STREAMLIT_NAME}/default_checkout" + root_path = ( + f"snow://streamlit/MockDatabase.MockSchema.{STREAMLIT_NAME}/default_checkout" + ) assert result.exit_code == 0, result.output assert ctx.get_queries() == [ dedent( @@ -502,7 +504,9 @@ def test_deploy_streamlit_main_and_pages_files_experimental_double_deploy( assert result2.exit_code == 0, result2.output - root_path = f"@streamlit/MockDatabase.MockSchema.{STREAMLIT_NAME}/default_checkout" + root_path = ( + f"snow://streamlit/MockDatabase.MockSchema.{STREAMLIT_NAME}/default_checkout" + ) # Same as normal, except no CHECKOUT query assert ctx.get_queries() == [ @@ -541,7 +545,9 @@ def test_deploy_streamlit_main_and_pages_files_experimental_no_stage( with project_directory("example_streamlit_no_stage"): result = runner.invoke(["streamlit", "deploy", "--experimental"]) - root_path = f"@streamlit/MockDatabase.MockSchema.{STREAMLIT_NAME}/default_checkout" + root_path = ( + f"snow://streamlit/MockDatabase.MockSchema.{STREAMLIT_NAME}/default_checkout" + ) assert result.exit_code == 0, result.output assert ctx.get_queries() == [ dedent( @@ -580,7 +586,9 @@ def test_deploy_streamlit_main_and_pages_files_experimental_replace( with project_directory("example_streamlit"): result = runner.invoke(["streamlit", "deploy", "--experimental", "--replace"]) - root_path = f"@streamlit/MockDatabase.MockSchema.{STREAMLIT_NAME}/default_checkout" + root_path = ( + f"snow://streamlit/MockDatabase.MockSchema.{STREAMLIT_NAME}/default_checkout" + ) assert result.exit_code == 0, result.output assert ctx.get_queries() == [ dedent(