Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python snowflake udf that accesses data in snowflake table

Let us say that I create a python udf like so:

create or replace function addone(i int)
returns int
language python
runtime_version = '3.8'
handler = 'addone_py'
as
$$
def addone_py(i):
  return i+1
$$;

Can I access data from a table + schema of where this udf is deployed - ideally whilst using a non default python package? Thanks!

like image 445
cs0815 Avatar asked May 17 '26 08:05

cs0815


1 Answers

Not sure why everyone is asking code example. The question is clear. The answer is no, you cannot access a table from python udf. You would need to implement it as a stored procedure, which comes with another limitation: it cannot be called in a select statement

like image 194
user2555515 Avatar answered May 19 '26 22:05

user2555515