- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Exclude tables which matches pattern ListDatabase tables
- Labels:
-
Apache NiFi
Created on ‎03-16-2018 12:40 PM - edited ‎08-18-2019 12:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to exclude the list of the tables which matched the regex pattern in list database tables. Can we do something like negate(or workaround to exclude tables which matches pattern) to TableNamePattern property to exclude the tables which have same pattern.
Created ‎03-16-2018 12:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Method1:-
You can do by using RouteonAttribute processor with negate expression by using not function.
exclude tables
${db.table.name:in("table_name1,table_name2,table_name3"):not()}
with the above expression we are going to exclude all the table names that are listed.
(or)
using startsWith function
${db.table.name:startsWith("table_"):not()}
with above expression we are matching all table names that starts with table_ and using not to exclude them.
Method2:-
including all the possible tablename patterns in regex by using or operator (|)
Table schema pattern
A pattern for matching tables in the database. Within a pattern, "%" means match any substring of 0 or more characters, and "_" means match any one character. The pattern must match the table name as it is stored in the database. If the property is not set, all tables will be retrieved.
Example:-
if you are trying to exclude all the table that are not starting with ua (or) ub use the below regex pattern
[ua|ub]%
Now we are going to have all list of tables those are having names starting with ua (or) ub and having 0 or more characters.
[ua|ub]_
now with the above regex expression we are going to match all table names starting with ua (or) ub and match any one character after that.
Created ‎03-16-2018 12:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Method1:-
You can do by using RouteonAttribute processor with negate expression by using not function.
exclude tables
${db.table.name:in("table_name1,table_name2,table_name3"):not()}
with the above expression we are going to exclude all the table names that are listed.
(or)
using startsWith function
${db.table.name:startsWith("table_"):not()}
with above expression we are matching all table names that starts with table_ and using not to exclude them.
Method2:-
including all the possible tablename patterns in regex by using or operator (|)
Table schema pattern
A pattern for matching tables in the database. Within a pattern, "%" means match any substring of 0 or more characters, and "_" means match any one character. The pattern must match the table name as it is stored in the database. If the property is not set, all tables will be retrieved.
Example:-
if you are trying to exclude all the table that are not starting with ua (or) ub use the below regex pattern
[ua|ub]%
Now we are going to have all list of tables those are having names starting with ua (or) ub and having 0 or more characters.
[ua|ub]_
now with the above regex expression we are going to match all table names starting with ua (or) ub and match any one character after that.
Created ‎03-16-2018 01:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Shu,
Can we do something like, exclude table names that are starting with ua (or) ub?
Created ‎03-16-2018 01:34 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you please see my edited answer.
let me know if you still having issues ..
