snowflake-connector-net
snowflake-connector-net copied to clipboard
Add QUERY_TAG to SFSessionParameter enum please
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
Any updates on this? Is there a workaround?
@DarthRinzler Can you provide some detail on the use case you have in mind for this?
@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
Thanks @DarthRinzler. We will evaluate this for Q2 and provide an update once it's confirmed.
Much appreciated @sfc-gh-hkapre
@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();
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.
Any updates on this? Also, is it possible to track this at the query level i.e. per query?
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 - 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.
PR with the capability in review: https://github.com/snowflakedb/snowflake-connector-net/pull/916
PR is now merged and will be part of the upcoming April 2024 release cycle, towards the end of the month
quick update: release was postponed to after the Snowflake Summit 2024; which (the Summit) happens 3-6 June so probably the week after that.
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
functionality released with .NET driver version v4.0.0 in July 2024