Understand the SQLGlot transpilation architecture
mainSQLGlot's transpilation process is composed of three primary modules that work in sequence:
- Tokenizer: Converts raw SQL code into a sequence of tokens (the smallest units of meaningful information like keywords and symbols).
- Parser: Converts the sequence of tokens into an Abstract Syntax Tree (AST) representing the semantics of the code.
- Generator: Converts the AST back into SQL code.
Transpilation between different SQL dialects (database-specific syntaxes) is achieved by overriding these three modules for a specific dialect. The base sqlglot dialect provides a common implementation to reduce duplication.