diff --git a/5-pg-field-type-detector.py b/5-pg-field-type-detector.py index 2195df2e9953dea82c385cadff52c64a011ac49f..10c5927a695cd0284b5a9c392c0d9a4946330949 100644 --- a/5-pg-field-type-detector.py +++ b/5-pg-field-type-detector.py @@ -189,9 +189,14 @@ def generate_field_catalog( cfg, catalog=None ): #field_catalog = generate_field_catalog( cfg, pg_connection, field_catalog ) if isinstance(cfg['postgis']['databases'][dbname], dict) and 'whitelist' in cfg['postgis']['databases'][dbname].keys(): - whitelist = cfg['postgis']['databases'][dbname]['whitelist'] + schema_dot_table_whitelist = cfg['postgis']['databases'][dbname]['whitelist'] + print(schema_dot_table_whitelist) + schema_whitelist = [ x.split('.')[0] for x in schema_dot_table_whitelist ] + print(schema_whitelist) + else: - whitelist = None + schema_dot_table_whitelist = None + schema_whitelist = None #print(whitelist) @@ -207,6 +212,10 @@ def generate_field_catalog( cfg, catalog=None ): #print(schema_names) for schema_name in schema_names: + if schema_whitelist is not None: + if schema_name not in schema_whitelist: + logging.debug('Skipping schema %s' % schema_name) + continue # if schema_name != selected_schema: # continue # print(schema_name) @@ -216,8 +225,9 @@ def generate_field_catalog( cfg, catalog=None ): # continue # else: # found = True - if whitelist is not None: - if str(table) not in whitelist: + if schema_dot_table_whitelist is not None: + if str(table) not in schema_dot_table_whitelist: + logging.debug('Skipping table %s' % str(table)) continue try: diff --git a/requirements.txt b/requirements.txt index 8f9fe8c9003666d2b40f086473fc0c59f1783f1b..b7eae43e7a682f97eeccc121619bf53964968aa2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,7 @@ pymongo #tqdm # Elasticsearch 6.x elasticsearch>=6.0.0,<7.0.0 -GeoAlchemy2>=0.5.0 +# N.B.: GeoAlchemy2 0.6.1 does not accept POINTZ, MULTILINESTRINGZ, ... geometries +GeoAlchemy2==0.5.0 psycopg2-binary>=2.7.0 sqlalchemy>=1.2.0,<1.3.0