Snowflake — <redacted> queries

Johan
3 min readMar 28, 2024

When a query, executed by other users, results in an error, you will see <redacted> instead of the actual SQL Statement. The error is visible, but not the SQL Statement itself.

Why would I want this<redacted> to be displayed, instead of the SQL statement itself?

In the 2023–01 update bundle, this feature was introduced: “The query history redacts the content of a query that fails due to a syntax or parsing error. The query text is replaced with <redacted>”. This was introduced for security reasons, not being able to see a query that ran into an error, possibly displaying sensitive information.

The user itself could see the query instead of <redacted> but other users looking into the QUERY_HISTORY would only see <redacted>. The query error would still be visible for others but not the query itself.

Let’s assume we have a requirement where we want to see the SQL statement that runs into an error, such as an export of failed queries to an automated analysis and monitoring system.

Is there a way to fix this, other than asking the executing user itself to have a look ? Perhaps this might not even possible when this is a service-account type of user that executes queries from your ETL tool.

Yes, there is an easy way to fix this, by setting a parameter called…

--

--

Johan

I am a freelance data engineer. My main focus is Snowflake, but I am always eager to learn new things. Python and AWS are my main side interests