def completer(): import pgcli.pgcompleter as pgcompleter comp = pgcompleter.PGCompleter(smart_completion=True) schemata, tables, columns = [], [], [] for schema, tbls in metadata['tables'].items(): schemata.append(schema) for table, cols in tbls.items(): tables.append((schema, table)) columns.extend([(schema, table, col) for col in cols]) functions = [ FunctionMetadata(schema, *func_meta) for schema, funcs in metadata['functions'].items() for func_meta in funcs ] datatypes = [(schema, datatype) for schema, datatypes in metadata['datatypes'].items() for datatype in datatypes] comp.extend_schemata(schemata) comp.extend_relations(tables, kind='tables') comp.extend_columns(columns, kind='tables') comp.extend_functions(functions) comp.extend_datatypes(datatypes) comp.set_search_path(['public']) return comp
def completer(): import pgcli.pgcompleter as pgcompleter comp = pgcompleter.PGCompleter(smart_completion=True) schemata = ['public'] comp.extend_schemata(schemata) # tables tables, columns = [], [] for table, cols in metadata['tables'].items(): tables.append(('public', table)) columns.extend([('public', table, col) for col in cols]) comp.extend_relations(tables, kind='tables') comp.extend_columns(columns, kind='tables') # views views, columns = [], [] for view, cols in metadata['views'].items(): views.append(('public', view)) columns.extend([('public', view, col) for col in cols]) comp.extend_relations(views, kind='views') comp.extend_columns(columns, kind='views') # functions functions = [('public', func) for func in metadata['functions']] comp.extend_functions(functions) comp.set_search_path(['public']) return comp
def completer(): import pgcli.pgcompleter as pgcompleter comp = pgcompleter.PGCompleter(smart_completion=True) comp.extend_table_names(tables.keys()) for t in tables: comp.extend_column_names(t, tables[t]) return comp
def completer(): import pgcli.pgcompleter as pgcompleter comp = pgcompleter.PGCompleter(smart_completion=True) schemata = ['public'] tables, columns = [], [] for table, cols in metadata['tables'].items(): tables.append(('public', table)) columns.extend([('public', table, col) for col in cols]) functions = [('public', func) for func in metadata['functions']] comp.extend_schemata(schemata) comp.extend_tables(tables) comp.extend_columns(columns) comp.extend_functions(functions) comp.set_search_path(['public']) return comp
def completer(): import pgcli.pgcompleter as pgcompleter comp = pgcompleter.PGCompleter(smart_completion=True) schemata = ['public'] comp.extend_schemata(schemata) # tables tables, columns = [], [] for table, cols in metadata['tables'].items(): tables.append(('public', table)) # Let all columns be text columns columns.extend([('public', table, col, 'text') for col in cols]) comp.extend_relations(tables, kind='tables') comp.extend_columns(columns, kind='tables') # views views, columns = [], [] for view, cols in metadata['views'].items(): views.append(('public', view)) columns.extend([('public', view, col, 'text') for col in cols]) comp.extend_relations(views, kind='views') comp.extend_columns(columns, kind='views') # functions functions = [FunctionMetadata('public', *func_meta) for func_meta in metadata['functions']] comp.extend_functions(functions) # types datatypes = [('public', typ) for typ in metadata['datatypes']] comp.extend_datatypes(datatypes) comp.set_search_path(['public']) return comp
def completer(): import pgcli.pgcompleter as pgcompleter return pgcompleter.PGCompleter()
def completer(): import pgcli.pgcompleter as pgcompleter return pgcompleter.PGCompleter(smart_completion=False)