snowflake-connector-net icon indicating copy to clipboard operation
snowflake-connector-net copied to clipboard

Add QUERY_TAG to SFSessionParameter enum please

Open sandscap-sc opened this issue 3 years ago • 11 comments

Issue description

Please add QUERY_TAG to SFSessionParameter enum

Example code

If possible, please enter some example code here to reproduce the issue.

Error log

If you have an error log, please paste it here.

There is an example in READMD.md file showing you how to enable logging.

Configuration

Driver version:

Dotnet framework and version: E.g. .net framework 4.5.2 or .net standard 2.0

Server version: E.g. 1.90.1 You may get the server version by running a query:

SELECT CURRENT_VERSION();

Client OS: E.g. Debian 8.1 (Jessie), Windows 10

sandscap-sc avatar Aug 15 '21 13:08 sandscap-sc

Any updates on this? Is there a workaround?

DarthRinzler avatar Mar 24 '22 20:03 DarthRinzler

@DarthRinzler Can you provide some detail on the use case you have in mind for this?

sfc-gh-hkapre avatar Mar 24 '22 21:03 sfc-gh-hkapre

@DarthRinzler Can you provide some detail on the use case you have in mind for this?

We would like to tag queries executed by our automation with meta-data details so that we can do then do analysis within snowflake to see which parts of our system were responsible for which queries, and what state they were in when the queries were executed etc.

Snowflake query history can be filtered by the "QUERY_TAG" property which is a session parameter

DarthRinzler avatar Mar 24 '22 21:03 DarthRinzler

Thanks @DarthRinzler. We will evaluate this for Q2 and provide an update once it's confirmed.

sfc-gh-hkapre avatar Mar 24 '22 21:03 sfc-gh-hkapre

Much appreciated @sfc-gh-hkapre

DarthRinzler avatar Mar 24 '22 21:03 DarthRinzler

@DarthRinzler , you may be able to work around this with ALTER SESSION. I.e.,

_connection.Open();

var command = _connection.CreateCommand();
command.CommandText = "ALTER SESSION SET QUERY_TAG = \"SOME_TAG\";";
command.ExecuteNonQuery();

astarche avatar Jun 06 '22 16:06 astarche

hi and thank you for submitting this issue, also apologies for the long period without response. this is already available in our JDBC driver (https://docs.snowflake.com/developer-guide/jdbc/jdbc-configure#connection-parameters , actually not only QUERY_TAG but a whole bunch of session parameters) so would be a valid request. we'll take a look.

sfc-gh-dszmolka avatar Jun 07 '23 14:06 sfc-gh-dszmolka

Any updates on this? Also, is it possible to track this at the query level i.e. per query?

sachin-tive avatar Jul 24 '23 15:07 sachin-tive

no updates unfortunately but will share if there will be available in the future. for query-level tracking, please take a look at the suggestion just above (using ALTER SESSION), you can even combine it with the multi-query statement capability of the driver.

sfc-gh-dszmolka avatar Jul 25 '23 06:07 sfc-gh-dszmolka

@sfc-gh-dszmolka - how would using "ALTER SESSION" work on per query level if snowflake db connection is singleton? Basically, I want to collect info like user who executed the query, which customer this user belongs to etc.

sachin-tive avatar Jul 25 '23 14:07 sachin-tive

PR with the capability in review: https://github.com/snowflakedb/snowflake-connector-net/pull/916

sfc-gh-dszmolka avatar Apr 15 '24 06:04 sfc-gh-dszmolka

PR is now merged and will be part of the upcoming April 2024 release cycle, towards the end of the month

sfc-gh-dszmolka avatar Apr 19 '24 06:04 sfc-gh-dszmolka

quick update: release was postponed to after the Snowflake Summit 2024; which (the Summit) happens 3-6 June so probably the week after that.

sfc-gh-dszmolka avatar May 27 '24 09:05 sfc-gh-dszmolka

Will update this thread once more information is known about the next upcoming major release of the .NET driver which will carry this fix.

edit: confirming with Product team; release should be available by mid-July 2024

sfc-gh-dszmolka avatar Jun 24 '24 09:06 sfc-gh-dszmolka

functionality released with .NET driver version v4.0.0 in July 2024

sfc-gh-dszmolka avatar Jul 09 '24 07:07 sfc-gh-dszmolka