graph LR
SQL_Tokenizer_Element_Factory["SQL Tokenizer & Element Factory"]
SQL_AST_Nodes["SQL AST Nodes"]
Query_Orchestrator["Query Orchestrator"]
Parsing_Entry_Point["Parsing Entry Point"]
Statement_Handlers["Statement Handlers"]
Column_Definition_Parser["Column Definition Parser"]
Parsing_Entry_Point -- "invokes" --> Query_Orchestrator
Query_Orchestrator -- "delegates parsing tasks to" --> Statement_Handlers
Query_Orchestrator -- "uses when processing DDL" --> Column_Definition_Parser
SQL_Tokenizer_Element_Factory -- "provides tokenized input to" --> Query_Orchestrator
SQL_Tokenizer_Element_Factory -- "creates instances of" --> SQL_AST_Nodes
Statement_Handlers -- "constructs and populates" --> SQL_AST_Nodes
Column_Definition_Parser -- "relies on for tokenizing DDL" --> SQL_Tokenizer_Element_Factory
Parsing_Entry_Point -- "leverages for tokenization" --> SQL_Tokenizer_Element_Factory
Parses incoming SQL queries from the Django ORM, tokenizes them, and generates an Abstract Syntax Tree (AST) for subsequent translation into MongoDB queries.
Performs the initial lexical analysis, breaking down raw SQL queries into fundamental tokens (e.g., keywords, operators, identifiers). It also provides structured representations (e.g., SQLStatement, SQLIdentifier) for these tokens and helper methods to extract specific SQL elements, forming the basis for AST construction.
Related Classes/Methods:
These classes represent the fundamental lexical and syntactic units (tokens) extracted from the SQL query, forming the nodes of the Abstract Syntax Tree. They are the core data structures for the intermediate representation of the parsed SQL query.
Related Classes/Methods:
djongo.sql2mongo.sql_tokens.SQLStatement:225-274djongo.sql2mongo.sql_tokens.SQLIdentifier:102-152djongo.sql2mongo.sql_tokens.SQLPlaceholder:201-222
This is the central class that orchestrates the entire SQL parsing and AST generation process. It consumes the tokenized input, identifies the type of SQL statement, and delegates the detailed parsing and AST construction to specialized internal methods.
Related Classes/Methods:
The primary method within the Query class that initiates the parsing of an incoming SQL string. It serves as the public interface for the SQL Query Parsing & AST Generation subsystem, directing the flow to the appropriate statement-specific handlers.
Related Classes/Methods:
These are specialized internal methods within the Query class, each dedicated to processing a specific type of SQL statement (e.g., SELECT, INSERT, UPDATE, DELETE) and constructing its specific AST representation. They embody the concrete parsing logic for different SQL grammar rules.
Related Classes/Methods:
djongo.sql2mongo.query._select:929-930djongo.sql2mongo.query._insert:924-927djongo.sql2mongo.query._update:914-917djongo.sql2mongo.query._delete:919-922
A specialized method for parsing and interpreting column definitions and constraints from SQL DDL (Data Definition Language) statements. While not directly involved in DML query parsing, it's crucial for schema-related operations that are part of the overall SQL interpretation within the sql_tokens module.
Related Classes/Methods: