def make_sqlx(conn, schema, tables):
    'Make sqlx lookup function for given tables'
    table_func_map = {}
    for table in tables:
        ntRec = namedtuple(table, tables[table].columns.keys())
        table_func_map[table] = SqlX(conn, table, schema, ntRec)

    def sqlx(expr) -> SqlX:
        obj = jmespath.search(expr, table_func_map)
        if (not obj):
            raise Exception('sqlx: Cannot find "{}"'.format(expr))
        return obj
    return sqlx
Make sqlx lookup function for given tables
def make_sqlx(conn, schema, tables):
    
    table_func_map = {}
    for table in tables:
        ntRec = namedtuple(table, tables[table].columns.keys())
        table_func_map[table] = SqlX(conn, table, schema, ntRec)

    def sqlx(expr) -> SqlX:
        obj = jmespath.search(expr, table_func_map)
        if (not obj):
            raise Exception('sqlx: Cannot find "{}"'.format(expr))
        return obj
    return sqlx