MCPcopy
hub / github.com/andialbrecht/sqlparse / extract_table_identifiers

Function extract_table_identifiers

examples/extract_table_names.py:43–53  ·  view source on GitHub ↗
(token_stream)

Source from the content-addressed store, hash-verified

41
42
43def extract_table_identifiers(token_stream):
44 for item in token_stream:
45 if isinstance(item, IdentifierList):
46 for identifier in item.get_identifiers():
47 yield identifier.get_name()
48 elif isinstance(item, Identifier):
49 yield item.get_name()
50 # It's a bug to check for Keyword here, but in the example
51 # above some tables names are identified as keywords...
52 elif item.ttype is Keyword:
53 yield item.value
54
55
56def extract_tables(sql):

Callers 1

extract_tablesFunction · 0.85

Calls 2

get_identifiersMethod · 0.80
get_nameMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…