Skip to content

Commit b174132

Browse files
committed
add a functionality for sas
1 parent 30c5dd7 commit b174132

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/snowflake/snowpark/context.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
_use_structured_type_semantics = False
2727
_use_structured_type_semantics_lock = threading.RLock()
2828

29+
# This is an internal-only global flag, used to determine whether the api is called from snowflake.snowpark_connect
30+
_is_called_from_snowpark_connect = False
31+
2932

3033
def _should_use_structured_type_semantics():
3134
global _use_structured_type_semantics

src/snowflake/snowpark/relational_grouped_dataframe.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import inspect
77

88
import snowflake.snowpark._internal.proto.generated.ast_pb2 as proto
9+
import snowflake.snowpark.context as context
910
from snowflake.connector.options import pandas
1011
from snowflake.snowpark._internal.analyzer.analyzer_utils import unquote_if_quoted
1112
from snowflake.snowpark import functions
@@ -329,7 +330,6 @@ def apply_in_pandas(
329330
func: Callable,
330331
output_schema: StructType,
331332
_emit_ast: bool = True,
332-
_is_called_from_snowpark_connect=False,
333333
**kwargs,
334334
) -> DataFrame:
335335
"""Maps each grouped dataframe in to a pandas.DataFrame, applies the given function on
@@ -409,7 +409,10 @@ def apply_in_pandas(
409409
# this is the case where this is being called from spark
410410
# this is not handleing nested column access, it is assuming that the access in the function is not nested
411411
original_columns: List[str] | None = None
412-
if _is_called_from_snowpark_connect and self._dataframe._column_map is not None:
412+
if (
413+
context._is_called_from_snowpark_connect
414+
and self._dataframe._column_map is not None
415+
):
413416
original_columns = [
414417
column.spark_name for column in self._dataframe._column_map.columns
415418
]

0 commit comments

Comments
 (0)