Support schema's
When running dbdot, it will only output tables in the default schema. Using whitelist to access tables in the non-default schema doesn't work either:
$ dbdot -dbname=ipp -user=geertjohan -W --whitelist sales.partners
password for geertjohan@ipp:
digraph {
}
I confirm. It would be useful to whitelist with wildcard sales.* and by multiple schemas too.
Thanks to @andreas schema flag is now available- https://github.com/akarki15/dbdot/pull/9. @GeertJohan LMK if the whitelist works with the schema flag. I will be cutting new release soon after some testing.
The --schema flag works, but it only works for selecting a single schema. It would be nice if dependencies between schema's could be shown as well, creating a graph for the complete database. This also is a bit inconsistent for dbdot's behaviour; there are now two ways to control the output, one based on selection (--schema) and another based on whitelist (--whitelist).
I think dbdot should by default output everything in a database, and have a single filtering parameter to control output. That parameter should be schema aware, e.g.: --wihtelist foo,sales.bar,meta.*, where foo is a table in the public schema, sales.bar indicates the table bar in schema sales and meta.* whitelists all tables in schema meta.
I noticed that the PR added a %s in the query. Using %s in a query is very very wrong. It should use query parameters. This allows an attacker to inject SQL queries through dbdot.
I wasn't aware a table could have relation to a table in another schema. You are right that the current schema flag doesn't allow displaying those cross-schema relations. I'll test out the schema aware whitelist option and see how it feels.
Also good point about the %s. Will clean it up while I am at it. Feel free to do it if you want to too :)