Skip to content

Commit 1aa73f6

Browse files
committed
Merge branch 'main' of github.com:snowflakedb/snowpark-python into jkew/add-hybrid-precheck
2 parents 7de4f64 + 8601802 commit 1aa73f6

190 files changed

Lines changed: 12316 additions & 546 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/daily_precommit.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,13 @@ jobs:
417417
strategy:
418418
fail-fast: false
419419
matrix:
420-
os: [macos-latest, windows-latest, ubuntu-latest]
420+
os:
421+
- download_name: macos
422+
image_name: macos-latest
423+
- download_name: windows
424+
image_name: windows-latest
425+
- download_name: ubuntu
426+
image_name: ubuntu-latest
421427
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
422428
cloud-provider: [azure]
423429
steps:

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ repos:
8484
- --per-file-ignores=tests/*.py:T201 # prints are allowed in test files
8585
# Ignore errors for generated protocol buffer stubs
8686
- --exclude=src/snowflake/snowpark/_internal/proto/generated/ast_pb2.py
87+
- --exclude=scripts/release/prepare_release_branch.py
8788
# Use mypy for static type checking.
8889
- repo: https://github.com/pre-commit/mirrors-mypy
8990
rev: 'v0.991'

CHANGELOG.md

Lines changed: 95 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,106 @@
11
# Release History
22

3-
## 1.39.0 (YYYY-MM-DD)
3+
## 1.40.0 (YYYY-MM-DD)
44

55
### Snowpark Python API Updates
66

7+
#### Bug Fixes
8+
9+
- Fixed a bug that `DataFrame.limit()` fail if there is parameter binding in the executed SQL.
10+
11+
#### New Features
12+
13+
- Added a new module `snowflake.snowpark.secrets` that provides Python wrappers for accessing Snowflake Secrets within Python UDFs and stored procedures that execute inside Snowflake.
14+
- `get_generic_secret_string`
15+
- `get_oauth_access_token`
16+
- `get_secret_type`
17+
- `get_username_password`
18+
- `get_cloud_provider_token`
19+
20+
- Added support for the following scalar functions in `functions.py`:
21+
- `array_remove_at`
22+
- `as_boolean`
23+
- `booland`
24+
- `boolnot`
25+
- `boolor`
26+
- `boolor_agg`
27+
- `boolxor`
28+
- `chr`
29+
- `decode`
30+
- `div0null`
31+
- `dp_interval_high`
32+
- `dp_interval_low`
33+
- `greatest_ignore_nulls`
34+
- `h3_cell_to_boundary`
35+
- `h3_cell_to_children`
36+
- `h3_cell_to_children_string`
37+
- `h3_cell_to_parent`
38+
- `h3_cell_to_point`
39+
- `h3_compact_cells`
40+
- `h3_compact_cells_strings`
41+
- `h3_coverage`
42+
- `h3_coverage_strings`
43+
- `h3_get_resolution`
44+
- `h3_grid_disk`
45+
- `h3_grid_distance`
46+
- `h3_int_to_string`
47+
- `h3_polygon_to_cells`
48+
- `h3_polygon_to_cells_strings`
49+
- `h3_string_to_int`
50+
- `h3_try_polygon_to_cells_strings`
51+
- `hex_decode_binary`
52+
- `last_query_id`
53+
- `last_transaction`
54+
- `least_ignore_nulls`
55+
- `nullif`
56+
- `nvl2`
57+
- `regr_valx`
58+
59+
60+
### Snowpark pandas API Updates
61+
762
#### New Features
63+
- Added support for `DataFrame.query` for dataframes with single-level indexes.
864

65+
#### Improvements
66+
67+
- Hybrid execution mode is now enabled by default. Certain operations on smaller data will now automatically execute in native pandas in-memory. Use `from modin.config import AutoSwitchBackend; AutoSwitchBackend.disable()` to turn this off and force all execution to occur in Snowflake.
68+
- Added a session parameter `pandas_hybrid_execution_enabled` to enable/disable hybrid execution as an alternative to using `AutoSwitchBackend`.
69+
- Removed an unnecessary `SHOW OBJECTS` query issued from `read_snowflake` under certain conditions.
70+
71+
## 1.39.0 (2025-09-17)
72+
73+
### Snowpark Python API Updates
74+
75+
#### New Features
76+
77+
- Added support for unstructured data engineering in Snowpark, powered by Snowflake AISQL and Cortex functions:
78+
- `DataFrame.ai.complete`: Generate per-row LLM completions from prompts built over columns and files.
79+
- `DataFrame.ai.filter`: Keep rows where an AI classifier returns TRUE for the given predicate.
80+
- `DataFrame.ai.agg`: Reduce a text column into one result using a natural-language task description.
81+
- `RelationalGroupedDataFrame.ai_agg`: Perform the same natural-language aggregation per group.
82+
- `DataFrame.ai.classify`: Assign single or multiple labels from given categories to text or images.
83+
- `DataFrame.ai.similarity`: Compute cosine-based similarity scores between two columns via embeddings.
84+
- `DataFrame.ai.sentiment`: Extract overall and aspect-level sentiment from text into JSON.
85+
- `DataFrame.ai.embed`: Generate VECTOR embeddings for text or images using configurable models.
86+
- `DataFrame.ai.summarize_agg`: Aggregate and produce a single comprehensive summary over many rows.
87+
- `DataFrame.ai.transcribe`: Transcribe audio files to text with optional timestamps and speaker labels.
88+
- `DataFrame.ai.parse_document`: OCR/layout-parse documents or images into structured JSON.
89+
- `DataFrame.ai.extract`: Pull structured fields from text or files using a response schema.
90+
- `DataFrame.ai.count_tokens`: Estimate token usage for a given model and input text per row.
91+
- `DataFrame.ai.split_text_markdown_header`: Split Markdown into hierarchical header-aware chunks.
92+
- `DataFrame.ai.split_text_recursive_character`: Split text into size-bounded chunks using recursive separators.
93+
- `DataFrameReader.file`: Create a DataFrame containing all files from a stage as FILE data type for downstream unstructured data processing.
994
- Added a new datatype `YearMonthIntervalType` that allows users to create intervals for datetime operations.
1095
- Added a new function `interval_year_month_from_parts` that allows users to easily create `YearMonthIntervalType` without using SQL.
1196
- Added a new datatype `DayTimeIntervalType` that allows users to create intervals for datetime operations.
97+
- Added a new function `interval_day_time_from_parts` that allows users to easily create `DayTimeIntervalType` without using SQL.
1298
- Added support for `FileOperation.list` to list files in a stage with metadata.
1399
- Added support for `FileOperation.remove` to remove files in a stage.
100+
- Added an option to specify `copy_grants` for the following `DataFrame` APIs:
101+
- `create_or_replace_view`
102+
- `create_or_replace_temp_view`
103+
- `create_or_replace_dynamic_table`
14104
- Added a new function `snowflake.snowpark.functions.vectorized` that allows users to mark a function as vectorized UDF.
15105
- Added support for parameter `use_vectorized_scanner` in function `Session.write_pandas()`.
16106
- Added support for the following scalar functions in `functions.py`:
@@ -29,6 +119,8 @@
29119

30120
#### Deprecations
31121

122+
- Deprecated warnings will be triggered when using snowpark-python with Python 3.9. For more details, please refer to https://docs.snowflake.com/en/developer-guide/python-runtime-support-policy.
123+
32124
#### Dependency Updates
33125

34126
#### Improvements
@@ -38,12 +130,12 @@
38130
- Added a new option `cacheResult` to `DataFrameReader.xml` that allows users to cache the result of the XML reader to a temporary table after calling `xml`. It helps improve performance when subsequent operations are performed on the same DataFrame.
39131

40132
### Snowpark pandas API Updates
133+
- Added support for `DataFrame.eval()` for dataframes with single-level indexes.
41134

42135
#### New Features
43136

44137
#### Improvements
45138

46-
- Hybrid execution mode is now enabled by default. Certain operations on smaller data will now automatically execute in native pandas in-memory. Use `from modin.config import AutoSwitchBackend; AutoSwitchBackend.disable()` to turn this off and force all execution to occur in Snowflake.
47139
- Downgraded to level `logging.DEBUG - 1` the log message saying that the
48140
Snowpark `DataFrame` reference of an internal `DataFrameReference` object
49141
has changed.
@@ -54,6 +146,7 @@
54146
- The following operations are currently supported and can benefit from the optimization: `read_snowflake`, `repr`, `loc`, `reset_index`, `merge`, and binary operations.
55147
- If a lazy object (e.g., DataFrame or Series) depends on a mix of supported and unsupported operations, the optimization will not be used.
56148
- Updated the error message for when Snowpark pandas is referenced within apply.
149+
- Added a session parameter `dummy_row_pos_optimization_enabled` to enable/disable dummy row position optimization in faster pandas.
57150

58151
#### Dependency Updates
59152

docs/source/modin/supported/dataframe_supported.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ Methods
165165
+-----------------------------+---------------------------------+----------------------------------+----------------------------------------------------+
166166
| ``equals`` | Y | | |
167167
+-----------------------------+---------------------------------+----------------------------------+----------------------------------------------------+
168-
| ``eval`` | N | | |
168+
| ``eval`` | P | | No support for dataframes with a row MultiIndex. |
169169
+-----------------------------+---------------------------------+----------------------------------+----------------------------------------------------+
170170
| ``ewm`` | N | | |
171171
+-----------------------------+---------------------------------+----------------------------------+----------------------------------------------------+
@@ -332,7 +332,7 @@ Methods
332332
| | | | ``"linear"`` or ``"nearest"``, and ``method`` is |
333333
| | | | ``"single"``. |
334334
+-----------------------------+---------------------------------+----------------------------------+----------------------------------------------------+
335-
| ``query`` | N | | |
335+
| ``query`` | P | | No support for dataframes with a row MultiIndex. |
336336
+-----------------------------+---------------------------------+----------------------------------+----------------------------------------------------+
337337
| ``radd`` | P | ``level`` | |
338338
+-----------------------------+---------------------------------+----------------------------------+----------------------------------------------------+

docs/source/snowpark/dataframe.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ DataFrame
1313
DataFrameNaFunctions
1414
DataFrameStatFunctions
1515
DataFrameAnalyticsFunctions
16+
DataFrameAIFunctions
1617

1718
.. rubric:: Methods
1819

@@ -120,6 +121,20 @@ DataFrame
120121
DataFrameAnalyticsFunctions.compute_lag
121122
DataFrameAnalyticsFunctions.compute_lead
122123
DataFrameAnalyticsFunctions.time_series_agg
124+
DataFrameAIFunctions.agg
125+
DataFrameAIFunctions.classify
126+
DataFrameAIFunctions.complete
127+
DataFrameAIFunctions.count_tokens
128+
DataFrameAIFunctions.embed
129+
DataFrameAIFunctions.extract
130+
DataFrameAIFunctions.filter
131+
DataFrameAIFunctions.parse_document
132+
DataFrameAIFunctions.sentiment
133+
DataFrameAIFunctions.similarity
134+
DataFrameAIFunctions.split_text_markdown_header
135+
DataFrameAIFunctions.split_text_recursive_character
136+
DataFrameAIFunctions.summarize_agg
137+
DataFrameAIFunctions.transcribe
123138
dataframe.map
124139
dataframe.map_in_pandas
125140

@@ -133,6 +148,7 @@ DataFrame
133148
.. autosummary::
134149
:toctree: api/
135150

151+
DataFrame.ai
136152
DataFrame.columns
137153
DataFrame.na
138154
DataFrame.queries

docs/source/snowpark/functions.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Functions
5959
array_position
6060
array_prepend
6161
array_remove
62+
array_remove_at
6263
array_reverse
6364
array_size
6465
array_slice
@@ -70,6 +71,7 @@ Functions
7071
arrays_zip
7172
as_array
7273
as_binary
74+
as_boolean
7375
as_char
7476
as_date
7577
as_decimal
@@ -109,6 +111,11 @@ Functions
109111
bitshiftright
110112
bitxor
111113
bitxor_agg
114+
boolor_agg
115+
booland
116+
boolnot
117+
boolor
118+
boolxor
112119
build_stage_file_url
113120
builtin
114121
bround
@@ -123,6 +130,7 @@ Functions
123130
charindex
124131
check_json
125132
check_xml
133+
chr
126134
coalesce
127135
col
128136
collate
@@ -180,13 +188,16 @@ Functions
180188
dayofmonth
181189
dayofweek
182190
dayofyear
191+
decode
183192
degrees
184193
dense_rank
185194
desc
186195
desc_nulls_first
187196
desc_nulls_last
188197
div0
189198
divnull
199+
dp_interval_high
200+
dp_interval_low
190201
editdistance
191202
endswith
192203
equal_nan
@@ -223,18 +234,38 @@ Functions
223234
getdate
224235
getvariable
225236
greatest
237+
greatest_ignore_nulls
226238
grouping
227239
grouping_id
228240
hash
229241
hex
242+
hex_decode_binary
230243
hex_encode
231244
hour
245+
h3_cell_to_boundary
246+
h3_cell_to_parent
247+
h3_cell_to_point
248+
h3_compact_cells
249+
h3_compact_cells_strings
250+
h3_coverage
251+
h3_coverage_strings
252+
h3_get_resolution
253+
h3_grid_disk
254+
h3_grid_distance
255+
h3_polygon_to_cells
256+
h3_polygon_to_cells_strings
257+
h3_string_to_int
258+
h3_try_polygon_to_cells_strings
259+
h3_cell_to_children
260+
h3_cell_to_children_string
261+
h3_int_to_string
232262
iff
233263
ifnull
234264
in_
235265
initcap
236266
insert
237267
instr
268+
interval_day_time_from_parts
238269
interval_year_month_from_parts
239270
invoker_role
240271
invoker_share
@@ -264,9 +295,12 @@ Functions
264295
kurtosis
265296
lag
266297
last_day
298+
last_query_id
299+
last_transaction
267300
last_value
268301
lead
269302
least
303+
least_ignore_nulls
270304
left
271305
length
272306
listagg
@@ -307,8 +341,10 @@ Functions
307341
not_
308342
nth_value
309343
ntile
344+
nullif
310345
nullifzero
311346
nvl
347+
nvl2
312348
object_agg
313349
object_construct
314350
object_construct_keep_null
@@ -345,6 +381,7 @@ Functions
345381
regr_sxx
346382
regr_sxy
347383
regr_syy
384+
regr_valx
348385
repeat
349386
replace
350387
right

docs/source/snowpark/grouping.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Grouping
1818
:toctree: api/
1919

2020
RelationalGroupedDataFrame.agg
21+
RelationalGroupedDataFrame.ai_agg
2122
RelationalGroupedDataFrame.apply_in_pandas
2223
RelationalGroupedDataFrame.applyInPandas
2324
RelationalGroupedDataFrame.avg

docs/source/snowpark/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Snowpark APIs
2020
udf
2121
udaf
2222
udtf
23+
secrets
2324
observability
2425
files
2526
catalog

docs/source/snowpark/secrets.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
=============================
2+
Snowpark Secrets
3+
=============================
4+
5+
.. currentmodule:: snowflake.snowpark.secrets
6+
7+
.. rubric:: Classes
8+
9+
.. autosummary::
10+
:toctree: api/
11+
12+
UsernamePassword
13+
CloudProviderToken
14+
15+
.. rubric:: Functions
16+
17+
.. autosummary::
18+
:toctree: api/
19+
20+
get_generic_secret_string
21+
get_oauth_access_token
22+
get_secret_type
23+
get_username_password
24+
get_cloud_provider_token

recipe/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% set name = "snowflake-snowpark-python" %}
2-
{% set version = "1.38.0" %}
2+
{% set version = "1.39.0" %}
33
{% set noarch_build = (os.environ.get('SNOWFLAKE_SNOWPARK_PYTHON_NOARCH_BUILD', 'false')) == 'true' %}
44
{% set build_number = os.environ.get('SNOWFLAKE_SNOWPARK_PYTHON_BUILD_NUMBER', 0) %}
55

0 commit comments

Comments
 (0)