Forum Discussion
Inserting a list of value into a Snowflake query
an extremely large database (Over 10 million rows)
In Power BI we call this "medium sized".
My question is it possible to place the first list of values generated from a query from an excel file into the snowflake sql query using the advance editor.
Technically possible but you will need to test if your code still works in the service refresh (if applicable)
Your "idea" is only halfway viable.
let
Item_id_list = Text.Combine(query1,"','"),
Source = Value.NativeQuery(Snowflake.Databases("Warehouse","Warehouse"){[Name="Database"]}[Data], " SELECT * FROM X_Database WHERE ITEM_ID in ('" & Item_id_list & "')", null, [EnableFolding=true]),
in
Source
- Muniz_Felipe1 month agoFrequent Visitor
Hi.
I applied this solution to get values from one query and input into a Snowflake query and it worked perfectly. It even updated on Power BI service.
Below is how I created the string to concatenate in my Snowflake query. Don't forget the single quoter ( ' ) at the beginning and the end of each value of the list.String to be concatenated into the SQL query (named as aux_query in my example).
let Source = fact_Table[Customer_number], Removed_duplicates = List.Distinct(Source), Transform_list = List.Transform( Removed_duplicates , each "'" & _ & "'" ), Combine_elements_into_single_string = Text.Combine( Transform_list , "," ) in Combine_elements_into_single_stringSQL query
let Source = Value.NativeQuery(Snowflake.Databases("Warehouse","Warehouse"){[Name="Database"]}[Data], " SELECT * FROM X_Database WHERE CUSTOMER_NUMBER in (" & aux_query & ")", null, [EnableFolding=true]), in Source