This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
# this pattern should pick out tablenames or schema.tablenames in | |
# most contexts, respecting legal names, including double-quoted table names | |
# with otherwise illegal characters. | |
# known exceptions include GRANT statements and "joins" using multiple tables | |
# in FROM with WHERE conditions. | |
pattern = r'(?:from|join|(?:create|alter|drop|truncate|update)' \ | |
'(?:\s*table|\s*view|\s*)(?:\sas)?)(?:\s+)' \ |