Closed duongleh closed 2 months ago
Hello @duongleh ,
Thanks for raising the issue, we are having a look, will update.
Regards, Sujan
Hello @duongleh ,
Could you try this way as follows by casting the array to Strng, you will get the expected output.
`whitelist = [] whitelist_json = str(whitelist) sql_query = """ SELECT ARRAY_SIZE(PARSE_JSON(?)) """
dataframe = session.sql(sql_query, params=[whitelist_json]) dataframe.show()
`
Regards, Sujan
Hello @duongleh ,
The PARSE_JSON function accepts string as parameter, so you have to either cast it to string the recommendation which we provided before or or use as string whitelist = '["a", "b"]'
whitelist = ['']
sql_query = """ SELECT ARRAY_SIZE(PARSE_JSON(?)) """ dataframe = session.sql(sql_query, params=[whitelist]) dataframe.show()
or
whitelist = [] whitelist_json = str(whitelist) sql_query = """ SELECT ARRAY_SIZE(PARSE_JSON(?)) """
dataframe = session.sql(sql_query, params=[whitelist_json]) dataframe.show()
Regards, Sujan
ah got it, we will proceed to to use a string whitelist
Python version
3.11
Operating system and processor architecture
Snowflake Python Worksheet
Installed packages
What did you do?
What did you expect to see?
Expect the query to return 0 as the param is an empty list But here is the error log
Can you set logging to DEBUG and collect the logs?