-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parameter binding issue with complex objects #5
Comments
@vostruk, Hi! As I understand, you want to pass list of values to insert it into one array/object/variant column, right? I haven't found a way to do this via official Snowflake.Data connector. I tried to modify it's source code in a different ways, but with no luck. I think Snowflake API doesn't support this. Each passed parameter should have some value and specified type. Value can be any object, but what to specify as value type in case of array/list? If you try to specify
If you try to specify element type instead, i.e.
The only workaround I have found is to pass list as json string and use var query = "INSERT INTO EMPLOYEES (EmployeesListColumn) SELECT PARSE_JSON(:EmployeesList);";
var result = await _snowflakeClient.ExecuteAsync(query, new { EmployeesList = "[\"Alexander\", \"Max\"]" }); Let me know if you know other options or have more questions. |
Good point. Parse_json workaround is a bit clumsy but it works. However using blobs currently require external storage connection (Azure, AWS or GCS) since file PUT doesn't work with .NET yet :( Let's then close this issue for now. |
@vostruk, got it. GET/PUT files feature is already on my roadmap :) |
When using complex objects (like List) in sqlParams the error is thrown.
For example performing an insert with something like:
Causes an error in SnowflakeClient.cs like 137 (BuildQueryRequest method)
Similar goes when we pass Class with complex fields without even using them in query.
I understand where this may come from, since filtering on such objects may not be needed. But inserts of complex objects is quite common thing, at least in my case.
Would be great if we can solve this problem.
The text was updated successfully, but these errors were encountered: