Project

General

Profile

« Previous | Next » 

Revision 2601

bin/map: Move retrieval of out_db's relational functions outside of process_input() so they can also be used by the non-by_col case

View differences:

bin/map
161 161
    # Define before the out_is_db section because it's used by by_col
162 162
    row_ins_ct_ref = [0]
163 163
    
164
    if out_is_db:
165
        out_db = connect_db(out_db_config)
166
        relational_funcs = set(sql.tables(out_db, schema_like='%',
167
            table_like=r'\__%'))
168
    
164 169
    def process_input(root, row_ready, map_path):
165 170
        '''Inputs datasource to XML tree, mapping if needed'''
166 171
        # Load map header
......
318 323
                map_table(col_names, []) # just create the template
319 324
                
320 325
                # Strip XML functions not in the DB
321
                preserve_funcs = db_xml.put_table_special_funcs.copy()
322
                preserve_funcs |= set(sql.tables(in_db, schema_like='%',
323
                    table_like=r'\__%'))
324
                xml_func.process(root, preserve=preserve_funcs, strip=True)
326
                preserve = db_xml.put_table_special_funcs | relational_funcs
327
                xml_func.process(root, preserve=preserve, strip=True)
325 328
                if debug: log_debug('Putting stripped:\n'+str(root))
326 329
                    # only calc if debug
327 330
                
......
379 382
    
380 383
    pool.share_vars(locals())
381 384
    if out_is_db:
382
        out_db = connect_db(out_db_config)
383 385
        try:
384 386
            if redo: sql.empty_db(out_db)
385 387
            pool.share_vars(locals())

Also available in: Unified diff