Skip to main content

Module utils

Module utils 

Source

Functions§

extract_alias_name
Extract the alias name from an AliasExpression. The alias name is the last Identifier or QuotedIdentifier before any non-trivia, non-keyword segment (scanning from the end).
find_keyword_in_children
Find a keyword by case-insensitive name in children. Returns (index, segment).
first_non_trivia
Return the first non-trivia child segment.
has_as_keyword
Check if an AliasExpression’s children contain an explicit AS keyword.
is_false_alias
Check if the “alias name” in an AliasExpression is actually a misidentified SQL keyword (e.g. OVER in window functions). Returns true if the alias looks like a false positive.
last_non_trivia
Return the last non-trivia child segment.