snowflakedb / snowflake-connector-net

Snowflake Connector for .NET
Apache License 2.0
180 stars 139 forks source link

SNOW-950923: SnowflakeDbCommand.GetQueryId() returns null on PUT cmd #802

Closed sfc-gh-agoldberg closed 9 months ago

sfc-gh-agoldberg commented 1 year ago

When I Execute a PUT command and then use GetQueryId on the command object which executed - it returns null. I haven't seen this with any other command.

Please answer these questions before submitting your issue. In order to accurately debug the issue this information is required. Thanks!

  1. What version of .NET driver are you using? 2.1.2

  2. What operating system and processor architecture are you using? Tested on Mac (M2) and PC (Win11/x64)

  3. What version of .NET framework are you using? netcore 7.0.12

  4. What did you do?

SnowflakeDbCommand command = new SnowflakeDbCommand(_connection, "PUT file://path/to/file.csv @stage_name"); System.Data.Common.DbDataReader reader = command.ExecuteReader() ; string queryId = command.GetQueryId(); // this returns null

  1. What did you expect to see? I expect a valid query Id

  2. Can you set logging to DEBUG and collect the logs? let me know if this is needed - can try later.

  3. What is your Snowflake account identifier, if any? (Optional)

sfc-gh-dszmolka commented 1 year ago

hi and thank you for raising this issue - also appreciate the code snippet ! reproduced the same issue with the latest (2.1.2 at the time of writing) version of the driver; also observed that GET command is similarly affected, not only PUT.

We'll take a look.

sfc-gh-dszmolka commented 1 year ago

this is still under investigation and thank you for bearing with us while this gets sorted ! for the 'PUT command failed' scenario, it will require a bit bigger effort, but for the 'PUT command was successful' scenario, you might be able to get the queryid for the PUT (or GET) command with something like

using (var command = connection.CreateCommmand())
{
   command.CommandText = "PUT file:///path/to/file.txt @mystage";
   var reader = command.ExecuteReader();
   // the above is generic DbReader
   // but if we convert it to the actual type we can access QueryID 
   // for succeeded operations
   var queryId = ((SnowflakeDbDataReader)reader).GetQueryId();
..
sfc-gh-mhofman commented 1 year ago

It will be available on the command level as well

sfc-gh-dszmolka commented 1 year ago

PR is https://github.com/snowflakedb/snowflake-connector-net/pull/825

sfc-gh-mhofman commented 10 months ago

@sfc-gh-dszmolka Code is ready however it introduces a BCR and will get released along with other bigger breaking changes in Q1.

sfc-gh-dszmolka commented 10 months ago

hey @sfc-gh-mhofman thanks for the heads-up, this is great news! Do we have any estimation when this could be; together with the regular driver release cycle in February or some other time?

sfc-gh-mhofman commented 10 months ago

@sfc-gh-dszmolka worse case March release cc @sfc-gh-knozderko

sfc-gh-mhofman commented 9 months ago

@sfc-gh-dszmolka planned for the Feb release

sfc-gh-dszmolka commented 9 months ago

PR is now merged and will be part of the next release which is imminent.

sfc-gh-dszmolka commented 9 months ago

fix released with version 3.0.0, closing Issue