Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_completer(self, settings=None, casing=None):
metadata = self.metadata
from pgcli.pgcompleter import PGCompleter
from pgspecial import PGSpecial
comp = PGCompleter(
smart_completion=True, settings=settings, pgspecial=PGSpecial()
)
schemata, tables, tbl_cols, views, view_cols = [], [], [], [], []
for sch, tbls in metadata["tables"].items():
schemata.append(sch)
for tbl, cols in tbls.items():
tables.append((sch, tbl))
# Let all columns be text columns
tbl_cols.extend([self._make_col(sch, tbl, col) for col in cols])
for sch, tbls in metadata.get("views", {}).items():
for tbl, cols in tbls.items():
views.append((sch, tbl))
# Let all columns be text columns
logger.debug('System path: %r', sys.path)
global PGCli, need_completion_refresh, need_search_path_refresh
global has_meta_cmd, has_change_path_cmd, has_change_db_cmd, OutputSettings
from pgcli.main import (PGCli, has_meta_cmd, has_change_path_cmd,
has_change_db_cmd, OutputSettings)
global PGExecute
from pgcli.pgexecute import PGExecute
global PGCompleter
from pgcli.pgcompleter import PGCompleter
global special
from pgspecial import PGSpecial
special = PGSpecial()
global CompletionRefresher
from pgcli.completion_refresher import CompletionRefresher
global Document
from prompt_toolkit.document import Document
global format_output
from pgcli.main import format_output
global psycopg2
import psycopg2
global sqlparse
import sqlparse