MCPcopy Create free account
hub / github.com/dbcli/mssql-cli / get_tables

Method get_tables

mssqlcli/packages/sqlcompletion.py:100–113  ·  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 i

(self, scope='full')

Source from the content-addressed store, hash-verified

98 return self.parsed.token_first().value.lower() == 'insert'
99
100 def get_tables(self, scope='full'):
101 """ Gets the tables available in the statement.
102 param `scope:` possible values: 'full', 'insert', 'before'
103 If 'insert', only the first table is returned.
104 If 'before', only tables before the cursor are returned.
105 If not 'insert' and the stmt is an insert, the first table is skipped.
106 """
107 tables = extract_tables(
108 self.full_text if scope == 'full' else self.text_before_cursor)
109 if scope == 'insert':
110 tables = tables[:1]
111 elif self.is_insert():
112 tables = tables[1:]
113 return tables
114
115 def get_previous_token(self, token):
116 return self.parsed.token_prev(self.parsed.token_index(token))[1]

Callers 1

Calls 2

is_insertMethod · 0.95
extract_tablesFunction · 0.90

Tested by

no test coverage detected