MCPcopy
hub / github.com/dbcli/pgcli / get_tables

Method get_tables

pgcli/packages/sqlcompletion.py:89–101  ·  view source on GitHub ↗

Gets the tables available in the statement. param `scope:` possible values: 'full', 'insert', 'before' If 'insert', only the first table is returned. If 'before', only tables before the cursor are returned. If not 'insert' and the stmt is an insert, the first table is

(self, scope="full")

Source from the content-addressed store, hash-verified

87 return self.parsed.token_first().value.lower() == "insert"
88
89 def get_tables(self, scope="full"):
90 """Gets the tables available in the statement.
91 param `scope:` possible values: 'full', 'insert', 'before'
92 If 'insert', only the first table is returned.
93 If 'before', only tables before the cursor are returned.
94 If not 'insert' and the stmt is an insert, the first table is skipped.
95 """
96 tables = extract_tables(self.full_text if scope == "full" else self.text_before_cursor)
97 if scope == "insert":
98 tables = tables[:1]
99 elif self.is_insert():
100 tables = tables[1:]
101 return tables
102
103 def get_previous_token(self, token):
104 return self.parsed.token_prev(self.parsed.token_index(token))[1]

Callers 2

_suggest_expressionFunction · 0.80

Calls 2

is_insertMethod · 0.95
extract_tablesFunction · 0.85

Tested by

no test coverage detected