Skip to content

Latest commit

 

History

History
112 lines (66 loc) · 7.19 KB

File metadata and controls

112 lines (66 loc) · 7.19 KB
graph LR
    piccolo_query_base_Query["piccolo.query.base.Query"]
    piccolo_querystring_QueryString["piccolo.querystring.QueryString"]
    piccolo_querystring_bundle["piccolo.querystring.bundle"]
    piccolo_query_base_querystrings["piccolo.query.base.querystrings"]
    piccolo_query_base_ddl["piccolo.query.base.ddl"]
    piccolo_query_mixins_querystring["piccolo.query.mixins.querystring"]
    piccolo_columns_base_Column["piccolo.columns.base.Column"]
    piccolo_query_base_run["piccolo.query.base.run"]
    piccolo_query_base_Query -- "uses" --> piccolo_query_mixins_querystring
    piccolo_query_base_Query -- "uses" --> piccolo_columns_base_Column
    piccolo_query_base_Query -- "calls" --> piccolo_query_base_querystrings
    piccolo_query_base_Query -- "calls" --> piccolo_query_base_ddl
    piccolo_query_base_Query -- "delegates execution to" --> piccolo_query_base_run
    piccolo_querystring_bundle -- "consumes" --> piccolo_querystring_QueryString
    piccolo_querystring_bundle -- "sends compiled SQL to" --> piccolo_query_base_run
    piccolo_query_base_querystrings -- "generates" --> piccolo_querystring_QueryString
    piccolo_query_base_querystrings -- "sends fragments to" --> piccolo_querystring_bundle
    piccolo_query_base_querystrings -- "uses" --> piccolo_columns_base_Column
    piccolo_query_base_ddl -- "generates" --> piccolo_querystring_QueryString
    piccolo_query_base_ddl -- "sends fragments to" --> piccolo_querystring_bundle
    piccolo_query_base_ddl -- "uses" --> piccolo_columns_base_Column
    piccolo_query_mixins_querystring -- "generates" --> piccolo_querystring_QueryString
    piccolo_columns_base_Column -- "generates" --> piccolo_querystring_QueryString
    piccolo_query_base_run -- "receives compiled SQL from" --> piccolo_querystring_bundle
Loading

CodeBoardingDemoContact

Details

The piccolo.query subsystem is central to Piccolo's ORM, providing a robust and extensible framework for constructing and executing SQL queries. At its core, the piccolo.query.base.Query component orchestrates the entire query building process, leveraging specialized components for different aspects of SQL generation. piccolo.query.mixins.querystring and piccolo.columns.base.Column are key in generating atomic piccolo.querystring.QueryString fragments, which serve as the fundamental building blocks of all SQL statements. For complete SQL generation, Query delegates to piccolo.query.base.querystrings (for DML) and piccolo.query.base.ddl (for DDL), both of which assemble QueryString objects. These fragments are then passed to piccolo.querystring.bundle, which is responsible for compiling them into a final, executable SQL string. The compiled SQL is then handed off to piccolo.query.base.run for asynchronous execution against the database, completing the query lifecycle. This modular design ensures clear separation of concerns, reusability of SQL components, and secure parameterization.

piccolo.query.base.Query

The foundational abstract class for all query types (e.g., Select, Insert, Update, Delete). It provides the fluent API for users to define queries and orchestrates the query building process.

Related Classes/Methods:

piccolo.querystring.QueryString

Represents an atomic SQL fragment or a parameter. It's the fundamental, immutable building block used to compose complex SQL statements, ensuring secure parameterization.

Related Classes/Methods:

piccolo.querystring.bundle

Responsible for compiling a collection of QueryString objects into a complete, executable SQL string, handling parameterization for secure query execution. This is the final step in SQL generation.

Related Classes/Methods:

piccolo.query.base.querystrings

A method within Query responsible for generating the appropriate Data Manipulation Language (DML) SQL (e.g., SELECT, INSERT, UPDATE, DELETE) tailored to the specific database engine.

Related Classes/Methods:

piccolo.query.base.ddl

A method within Query responsible for generating Data Definition Language (DDL) statements (e.g., CREATE TABLE, ALTER TABLE, DROP TABLE) adapted for the target database engine, crucial for schema management.

Related Classes/Methods:

piccolo.query.mixins.querystring

A mixin providing common logic for generating reusable SQL clauses (e.g., WHERE, ORDER BY, LIMIT, JOIN) that are integrated into various query types, promoting code reuse and consistency.

Related Classes/Methods:

piccolo.columns.base.Column

While part of the ORM Core, Column objects are crucial for the Query Builder as they provide their own SQL fragments and metadata, contributing to the SELECT, WHERE, and DDL parts of a query.

Related Classes/Methods:

piccolo.query.base.run

The method responsible for delegating the compiled SQL and parameters to the appropriate database engine's run_querystring function for asynchronous execution, completing the query lifecycle.

Related Classes/Methods: