Pass C# array to UDTF in Snowflake as an array
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 18.4k
- Forks
- 3.7k
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
I have a parameter in C#
var selectedUsersIds = new long[]{1,2,3};
which I want to pass to a UDTF in Snowflake:
CREATE OR REPLACE FUNCTION GetUserInfo ( pselectedUsersIds ARRAY)
RETURNS TABLE (
"Username" VARCHAR(1000),
"Age" NUMBER(38,0))
...
My sql query reads
SELECT * FROM TABLE(GetUserInfo(:SelectedUsers))
When I pass it via a DynamicParameters object
var dynamicParams = new DynamicParameters();
dynamicParams.Add("SelectedUsers", selectedUsersIds, (DbType?)null);
I get an error from Snowflake, saying that
Invalid argument types for function 'GetUserInfo': ( ROW(NUMBER(10,0), ROW(NUMBER(10,0), NUMBER(10,0))))
Is there a way to pass the C# array as a Snowflake array?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no repository files or tests. Start from the shown DynamicParameters.Add call and reproduce the GetUserInfo query with the long[] value; done means the array is passed as a Snowflake ARRAY instead of a row-shaped value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100