Usage Query Filtering
To extract usage information, OpenMetadata parses the queries that have run against the database. We fetch these queries from the query history table of the respective data source. This query fetches all queries executed within the configured number of days. In this guide, we explain how to filter the query history result set. This can help exclude queries with specific patterns or queries executed on a specific schema or database, depending on the data source. Query filtering is supported for both Usage and Lineage workflows. While configuring either workflow, you will find aFiltering Condition text field where you can provide the SQL condition, which will be added to the existing conditions with an AND operation. Later in this document, you will find how to write this condition for each supported data source.

Snowflake Filter Condition
To fetch the query history log from snowflake we execute the following query-- metabase % then you can put the condition as query_text NOT LIKE '--metabase %'
you also need to further restrict the query log and need only queries which have been executed on SALES database then you can put the filter condition as query_text NOT LIKE '--metabase %' AND database_name='SALES'.
Bigquery Filter Condition
To fetch the query history log from bigquery we execute the following query-- metabase % then you can put the condition as query NOT LIKE '--metabase %'.
MSSQL Filter Condition
To fetch the query history log from MSSQL we execute the following query-- metabase % then you can put the condition as t.text NOT LIKE '--metabase %'.
you also need to further restrict the query log and need only queries which have been executed on SALES database then you can put the filter condition as t.text NOT LIKE '--metabase %' AND db.NAME='SALES'.
Clickhouse Filter Condition
To fetch the query history log from clickhouse we execute the following query-- metabase % then you can put the condition as query NOT LIKE '--metabase %'.
Vertica Filter Condition
To fetch the query history log from vertica we execute the following query-- metabase % then you can put the condition as query NOT LIKE '--metabase %'.
Redshift Filter Condition
To fetch the query history log from redshift we execute the following queryRedshift Provisioned Cluster
STL_QUERY table.
Redshift Serverless
SYS_QUERY_HISTORY view.
For example if you want to add a condition to filter out queries executed by metabase client, i.e. the queries staring with -- metabase % then you can put the condition as query NOT LIKE '--metabase %'.