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")
| 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] |
no test coverage detected