Skip to content
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

Handling Array (Variant) objects from Snowflake #4

Closed
vostruk opened this issue Jan 28, 2021 · 5 comments
Closed

Handling Array (Variant) objects from Snowflake #4

vostruk opened this issue Jan 28, 2021 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@vostruk
Copy link

vostruk commented Jan 28, 2021

Hi,
First of all thanks for developing this library, it is much better than default one in my opinion!

I was testing it and tried to query Snowflake ARRAY type into C# List, but received

System.Text.Json.JsonException '0x0A' is invalid within a JSON string. The string should be correctly escaped.

Is there a way to overcome this using Options or the fix should be added to Mapper?

@fixer-m
Copy link
Owner

fixer-m commented Jan 28, 2021

Thank you for your bug report!

I have just fixed this bug in Mapper, now it should properly map array, variant and object data types.
This will be included in the next release of a NuGet package soon - I just need some more time to do some additional tests.
But you already can use fixed version directly from master branch.

@fixer-m fixer-m added the bug Something isn't working label Jan 28, 2021
@fixer-m fixer-m self-assigned this Jan 28, 2021
@fixer-m
Copy link
Owner

fixer-m commented Jan 29, 2021

@vostruk, I've included this fix into latest NuGet release - Snowflake.Client 0.3.1.
Can you please try this version and approve, that array mapping now works as should?

@vostruk
Copy link
Author

vostruk commented Feb 18, 2021

@fixer-m, yes array mapping works well now. Thanks a lot for solving that!

Also I found another bug related to it (could open a new issue if needed) - when using complex objects (like List) in sqlParams the error is thrown.
For example performing an insert with something like:

await snowflakeClient.ExecuteAsync("INSERT INTO EMPLOYEES (EmploymentsList) VALUES (:EmploymentsList);", new { EmploymentsList = new List<string> {"Programmer"} });

Causes an error in SnowflakeClient.cs like 137 (BuildQueryRequest method)

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 too.

@fixer-m
Copy link
Owner

fixer-m commented Feb 18, 2021

@vostruk Great!
Can you please create a new separate issue for this? This is completely unrelated to original mapping issue, new one is related to Parameter Binding feature.
Then I can close this bug.

@vostruk
Copy link
Author

vostruk commented Feb 18, 2021

Done,
#5
let's close this one. Thanks for solving!

@vostruk vostruk closed this as completed Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants