diff --git a/tests/integ/test_bind_variable.py b/tests/integ/test_bind_variable.py index 306bf0802d..b3959de32c 100644 --- a/tests/integ/test_bind_variable.py +++ b/tests/integ/test_bind_variable.py @@ -536,4 +536,7 @@ def test_call_union(self, session, proc_name): params=[proc_name, "tmpl2", "args2"], ) result = df1.union_all(df2).collect() - assert result == [Row("tmpl1 | args1"), Row("tmpl2 | args2")] + assert sorted(result, key=lambda r: r[0]) == [ + Row("tmpl1 | args1"), + Row("tmpl2 | args2"), + ] diff --git a/tests/integ/test_scoped_temp_objects.py b/tests/integ/test_scoped_temp_objects.py index 64a70e9055..c016f92ed0 100644 --- a/tests/integ/test_scoped_temp_objects.py +++ b/tests/integ/test_scoped_temp_objects.py @@ -2,6 +2,7 @@ # Copyright (c) 2012-2025 Snowflake Computing Inc. All rights reserved. # +from contextlib import contextmanager import pytest from snowflake.connector.errors import ProgrammingError @@ -9,6 +10,7 @@ TempObjectType, random_name_for_temp_object, ) +from tests.utils import IS_IN_STORED_PROC @pytest.mark.xfail( @@ -43,30 +45,37 @@ def test_create_scoped_temp_objects_syntax(session): ) assert "Unsupported feature 'SCOPED_TEMPORARY'." in str(exc) + # CREATE SCOPED TEMPORARY TABLE previously only worked if the name of the object began with + # SNOWPARK_TEMP_. This was changed to only enforce the naming convention if the query is issued + # from within a stored procedure. + + @contextmanager + def cm(): + if IS_IN_STORED_PROC: + with pytest.raises(ProgrammingError) as exc: + yield + assert "Unsupported feature 'SCOPED_TEMPORARY'." in str(exc) + else: + yield + temp_table_name = "temp_table" - with pytest.raises(ProgrammingError) as exc: + with cm(): session._run_query(f"create scoped temporary table {temp_table_name} (col int)") - assert "Unsupported feature 'SCOPED_TEMPORARY'." in str(exc) - with pytest.raises(ProgrammingError) as exc: + with cm(): session._run_query( f"create scoped temporary view temp_view as select * from {temp_table_name}" ) - assert "Unsupported feature 'SCOPED_TEMPORARY'." in str(exc) - with pytest.raises(ProgrammingError) as exc: + with cm(): session._run_query("create scoped temporary stage temp_stage") - assert "Unsupported feature 'SCOPED_TEMPORARY'." in str(exc) - with pytest.raises(ProgrammingError) as exc: + with cm(): session._run_query( "create scoped temporary function temp_function (arg int) returns int" ) - assert "Unsupported feature 'SCOPED_TEMPORARY'." in str(exc) - with pytest.raises(ProgrammingError) as exc: + with cm(): session._run_query( - "create scoped temporary function temp_talbe_function (arg int) returns table(col int) as $$ select * from {temp_table_name} $$" + f"create scoped temporary function temp_table_function (arg int) returns table(col int) as $$ select col from {temp_table_name} $$" ) - assert "Unsupported feature 'SCOPED_TEMPORARY'." in str(exc) - with pytest.raises(ProgrammingError) as exc: + with cm(): session._run_query( "create scoped temporary file format temp_file_format type = csv" ) - assert "Unsupported feature 'SCOPED_TEMPORARY'." in str(exc)