Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/integ/test_bind_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
]
35 changes: 22 additions & 13 deletions tests/integ/test_scoped_temp_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
# Copyright (c) 2012-2025 Snowflake Computing Inc. All rights reserved.
#

from contextlib import contextmanager
import pytest

from snowflake.connector.errors import ProgrammingError
from snowflake.snowpark._internal.utils import (
TempObjectType,
random_name_for_temp_object,
)
from tests.utils import IS_IN_STORED_PROC


@pytest.mark.xfail(
Expand Down Expand Up @@ -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)
Loading