Support Questions

Find answers, ask questions, and share your expertise

Exclude tables which matches pattern ListDatabase tables

avatar

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.

64642-screen-shot-2018-03-16-at-60533-pm.png

1 ACCEPTED SOLUTION

avatar
Master Guru

@Pavan M

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.

View solution in original post

3 REPLIES 3

avatar
Master Guru

@Pavan M

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.

avatar

Hi @Shu,

Can we do something like, exclude table names that are starting with ua (or) ub?

avatar
Master Guru
@Pavan M

Could you please see my edited answer.
let me know if you still having issues ..