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

SNOW-834778: Getting System.NotImplementedException exception (Support for VARIANT and ARRAY binding) #169

Open
KLia opened this issue Sep 10, 2019 · 10 comments
Assignees
Labels
feature parity this feature is supported in other drivers status-triage_done Initial triage done, will be further handled by the driver team

Comments

@KLia
Copy link

KLia commented Sep 10, 2019

I am trying to get some data into snowflake, and I am getting the following exception:

   at Snowflake.Data.Core.SFDataConverter.csharpTypeValToSfTypeVal(DbType srcType, Object srcVal)
   at Snowflake.Data.Client.SnowflakeDbCommand.convertToBindList(List`1 parameters)
   at Snowflake.Data.Client.SnowflakeDbCommand.ExecuteInternal(Boolean describeOnly)
   at Snowflake.Data.Client.SnowflakeDbCommand.ExecuteNonQuery()
   at PaymentTransactionsToSnowflake.DbFunctions.SaveTransactionToDb(PaymentTransaction paymentTransaction) 

My sql statement looks like the following:

var insertCmd = $@"INSERT INTO Transactions ( 
 APPLICATION_REFERENCE,
 GAME_ID,
 ACTOR_ID)
VALUES (
 @appRef,
 @gameId,
 @actorId
)";

And then I try to bind the parameter values:

private static void AddParameter(IDbCommand cmd, string paramName, object paramValue)
       {
             var parameter = cmd.CreateParameter();
             parameter.ParameterName = paramName;
             parameter.Value = paramValue;

             cmd.Parameters.Add(parameter);
       } 

I might be doing the whole parameter binding wrong, but the exception itself isn't very insightful. Could you point me to the right direction?

Thanks.

@KLia
Copy link
Author

KLia commented Sep 10, 2019

I think I got it to work by converting the params into (?) and adding a DbType to each binding.

Now I am having an issue binding to an ARRAY type. I have an array of BundledItem[], is it possible to bind that directly to a DbType.Binary or DbType.Object?
I get the following exception when I try:

Snowflake.Data.Client.SnowflakeDbException: Failed to convert data PaymentTransactions.Model.BundledItem from type PaymentTransactions.Model.BundledItem to type PaymentTransactions.Model.BundledItem.
   at Snowflake.Data.Core.SFDataConverter.csharpTypeValToSfTypeVal(DbType srcType, Object srcVal)
   at Snowflake.Data.Client.SnowflakeDbCommand.convertToBindList(List`1 parameters)
   at Snowflake.Data.Client.SnowflakeDbCommand.ExecuteInternal(Boolean describeOnly)
   at Snowflake.Data.Client.SnowflakeDbCommand.ExecuteNonQuery()
   at PaymentTransactionsToSnowflake.DbFunctions.SaveTransactionToDb(PaymentTransaction paymentTransaction) 

@ChTimTsubasa
Copy link
Contributor

So far we cannot bind an array. This is a known limitation.
Our SQL support Variant, but so far binding a variant is not supported yet.

@ChTimTsubasa ChTimTsubasa added the question Issue is a usage/other question rather than a bug label Sep 18, 2019
@alexrosenfeld10
Copy link
Contributor

alexrosenfeld10 commented Apr 23, 2021

@ChTimTsubasa @sfc-gh-stakeda it's been almost two years since this issue was addressed, is there any update on supporting variant types natively in the connector? I get the same problem when trying to insert json.

cc @congxu84

@holtalanm
Copy link

Bump. Curious if it is planned to support this ever.

@sfc-gh-jfan sfc-gh-jfan reopened this Jul 1, 2022
@github-actions github-actions bot closed this as completed Jul 2, 2022
@sfc-gh-jfan sfc-gh-jfan reopened this Jul 6, 2022
@sfc-gh-dszmolka sfc-gh-dszmolka added feature status-triage Issue is under initial triage and removed question Issue is a usage/other question rather than a bug labels Jun 7, 2023
@sfc-gh-dszmolka sfc-gh-dszmolka changed the title Getting System.NotImplementedException exception Getting System.NotImplementedException exception (Support for VARIANT binding) Jun 7, 2023
@sfc-gh-dszmolka sfc-gh-dszmolka changed the title Getting System.NotImplementedException exception (Support for VARIANT binding) Getting System.NotImplementedException exception (Support for VARIANT and ARRAY binding) Jun 7, 2023
@sfc-gh-dszmolka
Copy link
Contributor

hello and thank you for submitting this issue, and apologies for the long comment-less period. Now the server-side should support both datatypes I think, so we'll take a look how it could be implemented into the .NET client as well.

@sfc-gh-dszmolka sfc-gh-dszmolka added status-in_progress Issue is worked on by the driver team and removed status-triage Issue is under initial triage labels Jun 7, 2023
@sfc-gh-dszmolka sfc-gh-dszmolka added the parity this feature is supported in other drivers label Jun 7, 2023
@brvndon-do
Copy link

hello and thank you for submitting this issue, and apologies for the long comment-less period. Now the server-side should support both datatypes I think, so we'll take a look how it could be implemented into the .NET client as well.

so it's currently not implemented in the .NET client? I'm still having issues of Bind variable ? not set when attempting to bind an array in a parameter

@moravas
Copy link

moravas commented Nov 26, 2023

Hi there!

Do you have any progress / any ETA regarding to this issue? This would be a very usefully feature in many cases, like IN clause, or SELECT in subqueries, etc

Thank you

@sfc-gh-dszmolka
Copy link
Contributor

thank you all for your interest in this feature - at this moment I do not have any estimation on the timeline but we'll sync internally and update this thread here once there's any estimation. Thank you for bearing with us while this feature is implemented !

@sfc-gh-dszmolka sfc-gh-dszmolka removed the status-in_progress Issue is worked on by the driver team label Feb 11, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka added the status-triage_done Initial triage done, will be further handled by the driver team label Feb 11, 2024
@xujiabean
Copy link

any update on this feature

@sfc-gh-dszmolka
Copy link
Contributor

hi @xujiabean can you please confirm what exactly you're trying to do and what is the error you're getting ? is it perhaps Binding an array As Variable ?

@sfc-gh-dprzybysz sfc-gh-dprzybysz changed the title Getting System.NotImplementedException exception (Support for VARIANT and ARRAY binding) SNOW-834778: Getting System.NotImplementedException exception (Support for VARIANT and ARRAY binding) Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature parity this feature is supported in other drivers status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

No branches or pull requests