The query Module

Utility to generate SQL query based on a YAML query specification

fqn(t)[source]
class Query(user_request, connection)[source]

Class providing the API to generate SQL from a user request

sql

Generated SQL

execute()[source]
prepare()[source]

Generates SQL. Result is stored as a class member sql

Returns:

None

find_tables(column: str, tables: Dict) List[str][source]
generate_select(variables: Dict) str[source]
collect_tables(source: Dict, tables: Dict, result: Dict)[source]
generate_from(variables: Dict, aux: Dict, source: Dict) str[source]
generate_where(variables: Dict, tables: Dict, used_tables: Set) str[source]
all_tables(variables: Dict) Set[source]
reduce_tables(variables: Dict) bool[source]
generate_order_by(request: dict) str[source]
generate(system, user) -> (<class 'str'>, typing.List)[source]