class dbload.query_parser.QueryParser[source]

SQL file parser.

Parses annotated SQL files from provided paths. This class should not generally be used by itself. Context already invokes this parser during its initialization phase.

QueryParser provides a single static method parse() that performs the parsing. There is no need to create the QueryParser object itself.


Use parser:

from dbload import QueryParser
parsed = QueryParser.parse(["./queries.sql"])
static parse(sources: List[str] = [])mapz.mapz.Mapz[source]

Parse text sources with annotated SQL queries.


sources (List[str]) – List of text strings with annotated SQL queries to parse.

Parser reads each string line by line (split by \n symbol) and looks for annotated SQL queries in it. It does not verify the validity of SQL syntax. Parser understands annotation comments in SQL file that start with "--" comment identifier and contain name: tag in them.


Dictionary of parsed queries.

Return type



SqlQueriesFileEmptyError – when provided text file with annotated SQL queries is empty.