Table sources, support WHERE conditions
That would be very useful to have "where" in table sources:
tables:
tab_filtered:
layer_id: table_source
# Table name (required)
table: table_source
# SQL where conditions
where: (TYPE = 'A') and (Pop > 100)
Even better I guess:
tables:
tab_filtered:
layer_id: table_source
table_sql: SELECT * FROM table WHERE ...
There has been some conversations about this type of capability. Fundamentally there is nothing stopping us from doing this, with the possible exception that this, by definition, is a subset of functionality already available with SQL functions - so we need to clearly understand why we want to duplicate it... that said, this is indeed simpler than writing a full sql function. This also requires some somewhat unsafe SQL manipulation, but nothing too dangerous - i.e. config author can now write DROP TABLE in that statement, but i guess we have to trust config file.
I don't think we want the second table_sql variant, as it creates more problems -- we would need to evaluate the statement, see which columns are returned, check that exactly one of them is a gis column, match it up with the rest of the table configuration, ... - not worth it. Adding where config value on the other hand seems like a good path.
In short - PRs welcome, should be fairly simple to add.
If this ends up working with auto_publish, that could do things functions can't. If you try to handle a whole schema of geodata in a function, you'll need to EXECUTE FORMAT ... and the hard parses can kill your performance.