You may replace the following function in the example:
extract_table_identifiers(token_stream)
with the below definition:
def extract_table_identifiers(token_stream):
for item in token_stream:
if isinstance(item, IdentifierList):
for identifier in item.get_identifiers():
yield identifier.value
elif isinstance(item, Identifier):
yield item.value
# It's not necessary (in general cases) to check for Keyword here, but in case
# some table names are identified as keywords...
elif item.ttype is Keyword:
yield item.value
Please let me know if it worked.
Thanks...