Closed viggyfresh closed 5 years ago
I'm apprehensive about having this in the core for a few reasons:
pg_*
tables.pg_*
isn't sufficient, there are also sql_*
tables and maybe others, that ambiguity scares me.After a bit of research, I can't figure out a way to definitively tell the difference between the system tables and the prom tables, I tried looking at the output of these queries but nothing jumped out at me:
* `SELECT tablename FROM pg_tables`
* `SELECT * FROM information_schema.tables`
Because of the above reasons, my inclination is to not merge this unless we can figure out a bulletproof way to tell the system tables apart from the prom tables.
But since you definitely need this, my proposal would be to override prom's Interface with a custom version, along the lines of:
# custom.py
from prom.interface.postgres import PostgreSQL
class CustomPostgres(PostgresSQL):
def _delete_table(self, schema, **kwargs):
table_name = self._normalize_table_name(schema)
if table_name.startswith("pg_"): return
super(CustomPostgres, self)._delete_table(schema, **kwargs)
Then you could just modify your PROM_DSN
to use your custom interface instead:
custom.CustomPostgres://user:pw@localhost/db"
Hopefully that can get you pointed in the right direction.
Thanks Jay - will look into it.