For questions regarding programming in Snowpark Python or Scala APIs
Questions tagged [snowpark]
41 questions
4
votes
4 answers
How to add new python package for Snowpark
I am using Snowpark for Python.
I want to import imblearn package but when I check pre-installed packages at https://repo.anaconda.com/pkgs/snowflake/ this package is not installed in the Snowpark anaconda environment. How can use this package on…

Emre Becit
- 41
- 1
- 2
3
votes
1 answer
In Snowflake: How to access internally staged pre-trained model from UDF, syntax dilemma?
What is the syntax to reference a staged zip file from UDF? Specifically, I created UDF in Snowpark and it needs to load s-bert sentence_transformers pre-trained model (I downloaded the model, zipped it, and uploaded it to internal stage).
The…

psabela
- 324
- 1
- 3
- 16
3
votes
1 answer
How to convert pandas dataframe to snowpark dataframe?
How to convert pandas dataframe back to snowpark dataframe?
pandas_df = snowpark_df.to_pandas()
...
???

psabela
- 324
- 1
- 3
- 16
3
votes
3 answers
How to use partition by in Snowpark with TableFunction
I am trying to use UDTF in snowpark but not able to do partition by column.
what I want the sql query is something like this :
select mcount.result from CUSTOMER, table(map_count(name) over (partition by name)) mcount;
Here "map_count" is my…

Sella
- 31
- 6
2
votes
1 answer
Snowflake null java.lang.NullPointerException ERROR when launching Java UDF
I created a Java UDF in a snowflake in order to query GeoIp2 library and get the ISO code of a column list of IP. I have '@AWS_CSV_STAGE/lib/geoip2-2.8.0.jar','@AWS_CSV_STAGE/geodata/GeoLite2-City.mmdb' and 'maxmind-db-1.2.1.jar' already staged so i…

Kaido
- 117
- 9
2
votes
2 answers
Specify columns while appending Snowpark Python Dataframe to table
So right now, I have a Dataframe created using the session.createDataFrame() in Python. The intention is to append this Dataframe to an existing table object in Snowflake.
However the schema of the source dataframe doesn't match exactly with the…

halfwind22
- 329
- 4
- 18
1
vote
2 answers
Snowpark - split a dataframe column
Is there a way to split a snowpark dataframe column based on a string?
Here is what I have tried so far
from snowflake.snowpark import Session
from snowflake.snowpark import functions as SF
connection_parameters = {
"account": "myaccount",
…

Ananth
- 101
- 9
1
vote
1 answer
Create a Java UDF that uses geoip2 library with the database in a S3 bucket
Correct me if i'm wrong, but my understanding of the UDF function in Snowpark is that you can send the function UDF from your IDE and it will be executed inside Snowflake. I have a staged database called GeoLite2-City.mmdb inside a S3 bucket on my…

Kaido
- 117
- 9
1
vote
1 answer
Use Snowpark python to unload snowflake data to S3. How to provide storage integration option
I am trying to unload snowflake data to S3, I have storage integration setup for the same. I could unload using SQL query, but wanted to do that using snowpark python.
DataFrameWriter.copy_into_location - this snowpark method does not have any…

NikhilKV
- 48
- 6
1
vote
1 answer
'pyarrow' is not installed - Snowpark stored procedure with Python
I have created this basic stored procedure to query a Snowflake table based on a customer id:
CREATE OR REPLACE PROCEDURE SP_Snowpark_Python_Revenue_2(site_id STRING)
RETURNS STRING
LANGUAGE PYTHON
RUNTIME_VERSION = '3.8'
PACKAGES =…

C B
- 65
- 6
1
vote
1 answer
Binding data in type (list) is not supported
I wrote this script to execute a query and return the results to a data frame. It works like a charm and is quite fast.
Now, I want to give the script bind parameters at runtime, a customer id and a date.
from snowflake.snowpark.functions import…

C B
- 65
- 6
1
vote
1 answer
How to read from one DB but write to another using Snowflake's Snowpark?
I'm SUPER new to Snowflake and Snowpark, but I do have respectable SQL and Python experience. I'm trying to use Snowpark to do my data prep and eventually use it in a data science model. However, I cannot write to the database from which I'm pulling…

drymolasses
- 73
- 6
1
vote
1 answer
Does using cache_result essentially do the same thing as writing a temp table
Update 2022-08-31
While the chosen answer did confirm that the behavior was similar, there actually is a blind spot which is that using the cache_result implementation will not overwrite the previous table which means that extra storage will be used…

Maxim
- 725
- 1
- 8
- 24
1
vote
1 answer
How does array_contains work in Snowpark Python API
I have the following DataFrame
----------
|"ARR" |
----------
|[ |
| "A", |
| "B", |
| "C" |
|] |
----------
Not I want to check whether a specific element is in ARR:
This gives a Error (failed to execute query...):
df\
…

Raphael Roth
- 26,751
- 15
- 88
- 145
1
vote
5 answers
Snowflake SnowPark Python -Clarifications
Have a few questions regarding SnowPark with Python.
Why do we need Snowpark when we already have Snowflake python connector(freely) that can use to connect to Python jupyter with Snowflake DW?
If we use snowpark and connect with Local jupyter…

johnson
- 379
- 2
- 17