How kolesole/rtgl works
RTGL turns a user-authored relational prediction query into generated SQL and, optionally, an executed result table. The main workflow is query parsing, conversion to a structured representation, schema-aware validation and relationship resolution, then static or timestamp-based SQL generation. The README also documents explicit Common Path Expressions and raw-SQL virtual tables as query capabilities. Architecture details for some unsampled modules are based on the README and repository tree; uncertain internal wiring is omitted.
Main entry points: validator.py Validator base · temporal_converter.py Temporal converter · converter.py Converter base · static_converter.py Static converter
Components 20
Query language
- RTGL query
- ANTLR parser
rtgl/parser/gen/ParserRTGL.py - RTGL grammar
rtgl/parser/ParserRTGL.g4 - Query visitor
rtgl/visitor/visitor.py - Parsed values
rtgl/visitor/parsed_value.py
Validation and schema
- Validator base
rtgl/validator/validator.py - Static validation
rtgl/validator/static_validator.py - Temporal validation
rtgl/validator/temporal_validator.py - Validation diagnostics
rtgl/validator/diagnostics.py - Database explorer
rtgl/base/database_explorer.py - Path builder
rtgl/base/path_builder.py
SQL conversion
- Converter base
rtgl/converter/converter.py - Static converter
rtgl/converter/static_converter.py - Temporal converter
rtgl/converter/temporal_converter.py
Execution and data
- Relational database
rtgl/base/database.py - Table metadata
rtgl/base/table.py - DuckDB
- SQL or result table
rtgl/base/table.py
Other components
- Query author
- Prediction timestamps
Connections 23
- Query author → RTGL query: writes
- RTGL query → ANTLR parser: parses
- RTGL grammar → ANTLR parser: defines syntax
- ANTLR parser → Query visitor: provides parse tree
- Query visitor → Parsed values: builds values
- Query visitor → Converter base: returns query model
- Converter base → Validator base: validates
- Validator base → Static validation: uses for static
- Validator base → Temporal validation: uses for temporal
- Validator base → Validation diagnostics: reports issues
- Validator base → Database explorer: resolves schema
- Validator base → Path builder: resolves joins
- Database explorer → Relational database: inspects
- Converter base → Static converter: supports static
- Converter base → Temporal converter: supports temporal
- Static converter → Relational database: reads
- Temporal converter → Relational database: reads
- Prediction timestamps → Temporal converter: sets evaluation times
- Temporal converter → SQL or result table: returns result table
- Static converter → SQL or result table: returns SQL or table
- Temporal converter → DuckDB: executes SQL
- Static converter → DuckDB: executes SQL
- DuckDB → SQL or result table: returns query rows