mermerd icon indicating copy to clipboard operation
mermerd copied to clipboard

Add an option to exclude tables

Open matibarriento opened this issue 2 years ago • 3 comments

Often databases have more tables that you want to include that those that you want to exclude. Having an exclude option could reduce configuration.

Proposal: Add --excludedTables with this behavior

--excludedTables strings tables to exclude. Tables listed in --selectedTables have precedence over exclusion.

matibarriento avatar Nov 22 '23 21:11 matibarriento

This would be handy for me to exclude the partition tables. For the purposes of the schema, it is useful to have just the base table without all partitions. Being able to specify an exclusion flag using SQL wildcards and/or regex would help.

One of my schemas has active/historical separation implemented by partitions in Postgres, so I would like to exclude them like this: --excludedTables = "'%_historical', '%_active'" or some variant thereof.

Right now I use this hack:

db_tables=`echo "\dt" | psql -q --csv postgresql://postgres@localhost:54322/postgres | csvq -f csv --without-header "select Name where (Name not like '%_active' and Name not like '%_historical') order by Name"`
mermerd -c postgresql://postgres@localhost:54322/postgres  -o __design__/db_schema_diagram.mmd --schema public --selectedTables `echo $db_tables | tr ' ' ',' `

vickkhera avatar Dec 28 '23 20:12 vickkhera

Totally agree - I will have a look at this when I got the time 👍🏼

KarnerTh avatar Jan 21 '24 10:01 KarnerTh

This would be super useful, let me know if you need a hand with it!

ghandic avatar Mar 04 '24 00:03 ghandic

Feature is available in version 0.11.0

KarnerTh avatar Jun 16 '24 13:06 KarnerTh