Search code examples
snowflake-cloud-data-platformsnowflake-stage

How to use filter on show stages and show pipes query in Snowflake


Show Stages;

The above query returns the list of all the stages that are defined in a particular database and the schema in Snowflake.

After finding the stage name the next step is to figure out which pipe is using this stage.

I don't know if it is possible to filter on the Show Pipes; query directly so I am running this query, download the result as a .csv file then using find in the .csv file to figure out which pipe is using the required stage.

Is there a way to filter on the show pipes query for a particular stage name in Snowflake?


Solution

  • You can query from snowflake.account_usage.pipes view and filter based on database, schema, stage details.

    select * from snowflake.account_usage.pipes 
    where definition like '%<stage name>%' 
    and pipe_catalog = '<DB name>' 
    and pipe_schema = '<schema name>';
    

    https://docs.snowflake.com/en/sql-reference/account-usage/pipes