THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
Translate Orionis query plans into engine-executable statements.
This is the only component, together with the connection and the
dialect helpers, aware of the underlying SQL toolkit. It converts
orionis.orm.schema.TableDefinition objects into engine table metadata
(cached
per compiler) and query plans into executable statements.
| Static Method | _combine |
Combine compiled clauses while preserving left-to-right grouping. |
| Static Method | _predicate |
Match UUID predicates to textual storage without changing UUID columns. |
| Static Method | _raw |
Compile trusted SQL text with named bindings and an optional alias. |
| Static Method | supports |
Check whether multiple rows share a parameter-only batch shape. |
| Method | __init__ |
Initialize backend settings and compiler-owned table metadata. |
| Method | _aggregate |
Aggregate the complete compound or grouped query through a derived table. |
| Method | _aggregate |
Compile an aggregate function over a column or all rows. |
| Method | _apply |
Extend a FROM clause with the requested join type. |
| Method | _apply |
Apply a plan's ordering, limit, and offset to a SELECT. |
| Method | _apply |
Apply the backend's supported row-lock syntax to a SELECT. |
| Method | _apply |
Combine union branches and apply global ordering and pagination. |
| Method | _bare |
Extract a bare column name for a matching source identifier. |
| Method | _basic |
Compile a column-to-value comparison with backend-specific handling. |
| Method | _between |
Compile BETWEEN or NOT BETWEEN with exactly two bounds. |
| Method | _build |
Build a SELECT and resolve references to enclosing query sources. |
| Method | _cache |
Build a table cache key from its physical name and optional schema. |
| Method | _clause |
Dispatch a WHERE condition to its matching SQL predicate builder. |
| Method | _clause |
Compile a SELECT value or return a non-query value unchanged. |
| Method | _collect |
Collect explicit column references from conditions and nested groups. |
| Method | _collect |
Collect explicit column references from the current SELECT plan. |
| Method | _column |
Compare two resolved columns using the clause's operator. |
| Method | _columnless |
Compile nested groups, raw predicates, and EXISTS subqueries. |
| Method | _column |
Build column constraints, identity options and static defaults. |
| Method | _compile |
Compile every branch while retaining enclosing correlation sources. |
| Method | _ensure |
Declare missing referenced columns on a schemaless table. |
| Method | _ensure |
Extend undeclared target metadata with missing foreign-key columns. |
| Method | _ensure |
Register missing metadata for a single-column foreign-key target. |
| Method | _ensure |
Declare referenced columns for schemaless SELECT and JOIN sources. |
| Method | _join |
Combine a join's ON conditions into one boolean expression. |
| Method | _join |
Compile an ON condition as a comparison between two columns. |
| Method | _join |
Build a joined table or an aliased subquery source. |
| Method | _physical |
Build a physical table name by prepending the configured prefix. |
| Method | _projection |
Compile one projection entry into a SQL expression. |
| Method | _resolve |
Resolve a column by source qualifier or default table. |
| Method | _resolve |
Build SELECT sources and assemble the FROM clause. |
| Method | _select |
Build a SELECT projection from an aggregate or projected entries. |
| Method | _split |
Split a column reference at its last qualifier separator. |
| Method | _sql |
Translate a column definition into SQLAlchemy column metadata. |
| Method | _sql |
Resolve cached table metadata or rebuild it for a new definition. |
| Method | _sql |
Build a SQLAlchemy type with any required backend variants. |
| Method | _table |
Build table-level keys, foreign keys, and indexes. |
| Method | _validate |
Reject a SELECT row lock when the backend is Redshift. |
| Method | _where |
Compile ordered WHERE or HAVING clauses into one predicate. |
| Method | compile |
Compile table metadata into a CREATE TABLE DDL object. |
| Method | compile |
Compile filtering conditions into a DELETE statement. |
| Method | compile |
Compile a DROP TABLE DDL object for a logical table name. |
| Method | compile |
Compile row mappings into an executable INSERT statement. |
| Method | compile |
Compile a SELECT plan, including aggregates and union branches. |
| Method | compile |
Compile replacement values and filters into an UPDATE statement. |
| Constant | _TYPE |
Factories translating logical column definitions into SQLAlchemy types. |
| Class Variable | __slots__ |
Declare the instance attribute slots reserved by this class. |
| Instance Variable | _definitions |
Schema definitions cached for statement compilation. |
| Instance Variable | _driver |
Orionis backend name for native type, identity, and locking options. |
| Instance Variable | _metadata |
Compiled metadata used to describe and invoke the registered operation. |
| Instance Variable | _prefix |
Text prepended to logical table names; empty by default. |
| Instance Variable | _tables |
Table metadata indexed for query compilation or route lookup. |
Callable[ ..., ColumnElement[ bool]], sources: SourceMap, default: SqlSource, clauses: Sequence[ WhereClause] | Sequence[ JoinCondition]) -> ColumnElement[ bool] | None:
(source)
¶
Combine compiled clauses while preserving left-to-right grouping.
Ignore the first clause's connector; later connectors join successive clauses.
| Parameters | |
compilecollections.abc.Callable | Callable receiving sources, default, and one condition. |
sources:orionis.database.compiler.SourceMap | Source lookup supplied unchanged to each clause compiler. |
default:typing.Any | Fallback source supplied to the clause compiler. |
clauses:Sequence[ | Conditions to compile and combine in their declared order. |
| Returns | |
sqlalchemy.sql.elements.ColumnElement or TextClause or None | Combined predicate, or None for an empty sequence. |
Match UUID predicates to textual storage without changing UUID columns.
| Parameters | |
column:sqlalchemy.sql.elements.ColumnElement | Resolved column, including its declared SQL type and any alias. |
value:typing.Any | Predicate value to bind. |
| Returns | |
typing.Any | Canonical UUID text for textual columns; the original value otherwise. |
Compile trusted SQL text with named bindings and an optional alias.
Treat SQL text as trusted input; only values in bindings are parameterized. Aliased expressions remain addressable in derived queries.
| Parameters | |
raw:orionis.orm.query.expressions.RawExpression | SQL fragment, named parameter values, and optional projection alias. |
| Returns | |
sqlalchemy.sql.elements.ColumnElement or TextClause | Text clause or labeled expression; supplied bindings use unique parameters. |
Check whether multiple rows share a parameter-only batch shape.
Check row shapes and values without compiling the INSERT statement.
| Parameters | |
plan:orionis.orm.query.InsertPlan | Insert plan with row mappings and optional declared table columns. |
| Returns | |
bool | True when the batch precheck accepts multiple rows with matching keys and no SQLAlchemy expressions; False otherwise. |
Aggregate the complete compound or grouped query through a derived table.
| Parameters | |
plan:orionis.orm.query.SelectPlan | Query whose aggregate must consume its complete projected row set. |
outerorionis.database.compiler.SourceMap | Enclosing sources retained while compiling correlated branches. |
| Returns | |
sqlalchemy.sql.Select | Aggregate over the original rows without read ordering or pagination. |
SourceMap, default: SqlSource, aggregate: AggregateClause) -> ColumnElement[ Any]:
(source)
¶
Compile an aggregate function over a column or all rows.
| Parameters | |
sources:orionis.database.compiler.SourceMap | Sources indexed by alias or logical table name. |
default:typing.Any | Fallback source for an unqualified aggregate column. |
aggregate:orionis.orm.query.AggregateClause | Aggregate function and column reference, or * for COUNT. |
| Returns | |
sqlalchemy.sql.elements.ColumnElement | COUNT expression or the requested function applied to a resolved column. |
| Raises | |
orionis.database.QueryException | If a non-COUNT aggregate targets * or a column cannot be resolved. |
SqlSource, sources: SourceMap, join: JoinExpression) -> tuple[ SqlSource, str, SqlSource]:
(source)
¶
Extend a FROM clause with the requested join type.
Emulate RIGHT JOIN by swapping sources in a LEFT JOIN.
| Parameters | |
fromtyping.Any | FROM/JOIN expression built before this join. |
sources:orionis.database.compiler.SourceMap | Existing sources used to resolve ON-clause column references. |
join:orionis.orm.query.expressions.JoinExpression | Joined source, join type, and optional ON conditions. |
| Returns | |
tuple of (typing.Any, str, typing.Any) | Extended FROM clause, joined identifier, and joined source. |
| Raises | |
orionis.database.QueryException | If a subquery alias is missing or ON conditions are absent or invalid. |
SourceMap, default: SqlSource, statement: Select[ Any], plan: SelectPlan) -> Select[ Any]:
(source)
¶
Apply a plan's ordering, limit, and offset to a SELECT.
| Parameters | |
sources:orionis.database.compiler.SourceMap | Sources indexed by alias or logical table name. |
default:typing.Any | Fallback source for unqualified ordering columns. |
statement:sqlalchemy.sql.Select | SELECT statement to extend without mutating it. |
plan:orionis.orm.query.SelectPlan | Ordering clauses and optional limit and offset values. |
| Returns | |
sqlalchemy.sql.Select | SELECT with all requested sorting and pagination clauses applied. |
| Raises | |
orionis.database.QueryException | If an ordering column or its source cannot be resolved. |
Select[ Any], default: SqlSource, plan: SelectPlan) -> Select[ Any]:
(source)
¶
Apply the backend's supported row-lock syntax to a SELECT.
| Parameters | |
statement:sqlalchemy.sql.Select | Query whose projection and conditions are already compiled. |
default:orionis.database.compiler.SqlSource | Main source receiving SQL Server table hints. |
plan:orionis.orm.query.SelectPlan | Validated plan containing the optional lock mode. |
| Returns | |
sqlalchemy.sql.Select | Original statement or its backend-specific locked variant. |
Select[ Any], plan: SelectPlan, outer_sources: SourceMap) -> Select[ Any]:
(source)
¶
Combine union branches and apply global ordering and pagination.
Flatten consecutive operators of the same kind; preserve left-to-right grouping when switching between UNION and UNION ALL.
| Parameters | |
statement:sqlalchemy.sql.Select | Base SELECT without the owning plan's unions, ordering, or paging. |
plan:orionis.orm.query.SelectPlan | SELECT plan containing at least one union branch. |
outerorionis.database.compiler.SourceMap | Enclosing sources retained by each branch. |
| Returns | |
sqlalchemy.sql.Select | SELECT over combined rows with the owning plan's order and bounds. |
ColumnElement[ Any], clause: WhereClause) -> ColumnElement[ bool]:
(source)
¶
Compile a column-to-value comparison with backend-specific handling.
Translate None equality into IS NULL or IS NOT NULL. Use DBMS_LOB.COMPARE for Oracle text equality.
| Parameters | |
column:sqlalchemy.sql.elements.ColumnElement | Column expression, including its SQL type for backend handling. |
clause:orionis.orm.query.WhereClause | Comparison operator and bound value, including None. |
| Returns | |
sqlalchemy.sql.elements.ColumnElement | NULL check, text comparison, pattern predicate, or ordinary comparison. |
| Raises | |
orionis.database.QueryException | If the comparison operator has no supported handler. |
ColumnElement[ Any], clause: WhereClause) -> ColumnElement[ bool]:
(source)
¶
Compile BETWEEN or NOT BETWEEN with exactly two bounds.
| Parameters | |
column:sqlalchemy.sql.elements.ColumnElement | Left-hand column expression tested against the range. |
clause:orionis.orm.query.WhereClause | Range condition with lower and upper boundary values. |
| Returns | |
sqlalchemy.sql.elements.ColumnElement | Inclusive range predicate, negated for NOT BETWEEN. |
| Raises | |
orionis.database.QueryException | If the supplied value does not contain exactly two boundaries. |
Build a SELECT and resolve references to enclosing query sources.
| Parameters | |
plan:orionis.orm.query.SelectPlan | SELECT description whose sources and clauses are compiled. |
outerorionis.database.compiler.SourceMap | Source lookup from the enclosing query, or an empty mapping. |
| Returns | |
sqlalchemy.sql.Select | SELECT with projection, filters, grouping, paging, and requested locks. |
| Raises | |
orionis.database.QueryException | If references or clauses are invalid, or a Redshift lock is requested. |
SourceMap, default: SqlSource, clause: WhereClause) -> ColumnElement[ bool]:
(source)
¶
Dispatch a WHERE condition to its matching SQL predicate builder.
| Parameters | |
sources:orionis.database.compiler.SourceMap | Sources indexed by alias or logical table name. |
default:typing.Any | Fallback source for unqualified column names. |
clause:orionis.orm.query.WhereClause | Condition type, column reference, operator, and comparison value. |
| Returns | |
sqlalchemy.sql.elements.ColumnElement or TextClause | Compiled condition, including nested, raw, and subquery predicates. |
| Raises | |
orionis.database.QueryException | If the clause type, references, comparison operator, or range shape is invalid. |
Compile a SELECT value or return a non-query value unchanged.
| Parameters | |
sources:orionis.database.compiler.SourceMap | Enclosing query sources available for subquery correlation. |
value:typing.Any | Condition value, which may itself be a SELECT plan. |
| Returns | |
typing.Any | Compiled SELECT for a plan value; the original object otherwise. |
| Raises | |
orionis.database.QueryException | If a nested SELECT contains invalid clauses or unresolved references. |
Collect explicit column references from conditions and nested groups.
| Parameters | |
clauses:collections.abc.Sequence of orionis.orm.query.WhereClause | WHERE or HAVING conditions to inspect recursively. |
names:set of str | Mutable accumulator for left-hand and column-comparison references. |
| Returns | |
None | No return value. |
Collect explicit column references from the current SELECT plan.
Inspect projection names, conditions, ordering, grouping, aggregates, and joins without parsing raw SQL or traversing subquery plans.
| Parameters | |
plan:orionis.orm.query.SelectPlan | SELECT plan whose direct references will be collected. |
| Returns | |
set of str | Qualified and unqualified names used by the current plan's clauses. |
SourceMap, default: SqlSource, column: ColumnElement[ Any], clause: WhereClause) -> ColumnElement[ bool]:
(source)
¶
Compare two resolved columns using the clause's operator.
| Parameters | |
sources:orionis.database.compiler.SourceMap | Sources indexed by alias or logical table name. |
default:typing.Any | Fallback source for the right-hand column reference. |
column:sqlalchemy.sql.elements.ColumnElement | Already-resolved left-hand column expression. |
clause:orionis.orm.query.WhereClause | Comparison operator and right-hand column reference. |
| Returns | |
sqlalchemy.sql.elements.ColumnElement | Boolean comparison between the two column expressions. |
| Raises | |
orionis.database.QueryException | If the right-hand column cannot be resolved or the operator is unsupported. |
SourceMap, default: SqlSource, clause: WhereClause) -> ColumnElement[ bool] | None:
(source)
¶
Compile nested groups, raw predicates, and EXISTS subqueries.
Represent an empty nested group as a true predicate.
| Parameters | |
sources:orionis.database.compiler.SourceMap | Sources available for column resolution and subquery correlation. |
default:typing.Any | Fallback source for unqualified names inside nested conditions. |
clause:orionis.orm.query.WhereClause | Condition whose type determines whether this helper can handle it. |
| Returns | |
sqlalchemy.sql.elements.ColumnElement or TextClause or None | Predicate for a supported kind, or None for a column-based kind. |
ColumnDefinition, column_type: TypeEngine[ Any]) -> dict[ str, Any]:
(source)
¶
Build column constraints, identity options and static defaults.
| Parameters | |
definition:orionis.orm.schema.column.ColumnDefinition | Logical column flags and client default value. |
columnsqlalchemy.types.TypeEngine | Resolved type used to render a static server default. |
| Returns | |
dict[str, typing.Any] | Keyword arguments passed to the SQLAlchemy column constructor. |
SelectPlan, outer_sources: SourceMap) -> Select[ Any] | CompoundSelect:
(source)
¶
Compile every branch while retaining enclosing correlation sources.
| Parameters | |
plan:orionis.orm.query.SelectPlan | Query description, including aggregation and union branches. |
outerorionis.database.compiler.SourceMap | Enclosing sources available to every nested branch. |
| Returns | |
sqlalchemy.sql.Select or sqlalchemy.sql.CompoundSelect | Complete query with its requested branches and global bounds. |
Declare missing referenced columns on a schemaless table.
Declare columns before creating aliases, whose column collections are cached.
| Parameters | |
table:orionis.orm.schema.TableDefinition | Table definition; declared schemas are left unchanged. |
alias:str or None | Query alias used to match qualified references, or None. |
names:set of str | Collected qualified or unqualified references from the owning plan. |
| Returns | |
None | No return value. |
Extend undeclared target metadata with missing foreign-key columns.
Keep declared schemas authoritative while extending temporary targets.
| Parameters | |
tablestr | Logical table name, optionally qualified as schema.table. |
columns:collections.abc.Sequence of str | Target columns to declare with temporary integer types. |
| Returns | |
None | No return value. |
Register missing metadata for a single-column foreign-key target.
| Parameters | |
reference:orionis.orm.schema.constraints.ForeignReference | Logical target table, optional schema qualifier, and referenced column. |
| Returns | |
None | No return value. |
Declare referenced columns for schemaless SELECT and JOIN sources.
| Parameters | |
plan:orionis.orm.query.SelectPlan | SELECT plan supplying source definitions and column references. |
| Returns | |
None | No return value. |
SourceMap, joined_name: str, joined_source: SqlSource, join: JoinExpression) -> ColumnElement[ bool]:
(source)
¶
Combine a join's ON conditions into one boolean expression.
| Parameters | |
sources:orionis.database.compiler.SourceMap | Sources available before adding the joined source. |
joinedstr | Identifier used to qualify columns from the new source. |
joinedtyping.Any | Table or derived query introduced by this join. |
join:orionis.orm.query.expressions.JoinExpression | Join description containing one or more ON conditions. |
| Returns | |
sqlalchemy.sql.elements.ColumnElement | ON expression, using the joined source for unqualified column names. |
| Raises | |
orionis.database.QueryException | If ON conditions are absent, references are unknown, or operators are unsupported. |
SourceMap, default: SqlSource, condition: JoinCondition) -> ColumnElement[ bool]:
(source)
¶
Compile an ON condition as a comparison between two columns.
| Parameters | |
sources:orionis.database.compiler.SourceMap | Sources indexed by alias or logical table name. |
default:typing.Any | Source used to resolve unqualified column names. |
condition:orionis.orm.query.expressions.JoinCondition | Left reference, comparison operator, and right reference. |
| Returns | |
sqlalchemy.sql.elements.ColumnElement | Boolean comparison between the resolved column expressions. |
| Raises | |
orionis.database.QueryException | If either reference is unknown or the comparison operator is unsupported. |
Build a joined table or an aliased subquery source.
| Parameters | |
join:orionis.orm.query.expressions.JoinExpression | Table or SELECT plan to join, with an optional source alias. |
| Returns | |
tuple of (str, typing.Any) | Source identifier and table, table alias, or compiled derived query. |
| Raises | |
orionis.database.QueryException | If a subquery has no alias or its SELECT plan cannot be compiled. |
SourceMap, default: SqlSource, entry: str | SubQueryColumn | RawExpression) -> ColumnElement[ Any]:
(source)
¶
Compile one projection entry into a SQL expression.
| Parameters | |
sources:orionis.database.compiler.SourceMap | Sources indexed by alias or logical table name. |
default:typing.Any | Fallback source for unqualified column names. |
entry:str | SubQueryColumn | RawExpression | Column reference, correlated scalar subquery, or trusted SQL fragment. |
| Returns | |
sqlalchemy.sql.elements.ColumnElement or TextClause | Resolved column, labeled scalar subquery, or compiled raw expression. |
SourceMap, default: SqlSource, name: str) -> ColumnElement[ Any]:
(source)
¶
Resolve a column by source qualifier or default table.
Look up qualified references in sources and unqualified names in default.
| Parameters | |
sources:orionis.database.compiler.SourceMap | Available tables or derived sources indexed by query identifier. |
default:typing.Any | Source used for unqualified column names. |
name:str | Bare column name or dot-qualified source reference. |
| Returns | |
sqlalchemy.sql.elements.ColumnElement | Column exposed by the selected source's column collection. |
| Raises | |
orionis.database.QueryException | If the source identifier or column name is unknown. |
Build SELECT sources and assemble the FROM clause.
Index each source by its alias, or by its logical table name when no alias is supplied.
| Parameters | |
plan:orionis.orm.query.SelectPlan | Main table, optional alias, and ordered join descriptions. |
| Returns | |
tuple of (typing.Any, orionis.database.compiler.SourceMap, typing.Any) | Main source, source lookup map, and complete FROM/JOIN expression. |
| Raises | |
orionis.database.QueryException | If a joined source or its ON conditions cannot be compiled. |
SqlSource, sources: SourceMap, plan: SelectPlan) -> Select[ Any]:
(source)
¶
Build a SELECT projection from an aggregate or projected entries.
| Parameters | |
default:typing.Any | Main query source and fallback for unqualified references. |
sources:orionis.database.compiler.SourceMap | Sources indexed by alias or logical table name. |
plan:orionis.orm.query.SelectPlan | Aggregate, explicit projections, or default table selection. |
| Returns | |
sqlalchemy.sql.Select | SELECT of the requested projection; use literal * for raw tables. |
ColumnDefinition, name: str | None = None) -> SqlColumn[ Any]:
(source)
¶
Translate a column definition into SQLAlchemy column metadata.
Apply backend identity options and emit non-null static defaults both as client defaults and SQL server defaults.
| Parameters | |
definition:orionis.orm.schema.column.ColumnDefinition | Type options, constraints, foreign key, defaults, and identity settings. |
name:str or None, optional | Override the definition's name; use definition.name when None. |
| Returns | |
sqlalchemy.Column | Column with resolved type, constraints, defaults, and backend options. |
| Raises | |
orionis.database.QueryException | If the logical column type has no registered SQL type builder. |
orionis.database.MissingDatabaseDependencyException | If Redshift column options require a missing dialect package. |
Resolve cached table metadata or rebuild it for a new definition.
Reuse metadata for raw definitions or the same declared definition instance; rebuild it for a different definition with declared columns. Treat a declared definition and its columns as stable after compilation. In-place edits are not tracked; use a new definition for a schema version.
| Parameters | |
definition:orionis.orm.schema.TableDefinition | Logical table description, including columns, constraints, and schema. |
| Returns | |
sqlalchemy.Table | Prefixed table registered in this compiler's metadata and table cache. |
| Raises | |
orionis.database.QueryException | If a column type has no registered SQL type builder. |
Build a SQLAlchemy type with any required backend variants.
| Parameters | |
definition:orionis.orm.schema.column.ColumnDefinition | Logical column type and its conversion or precision options. |
| Returns | |
sqlalchemy.types.TypeEngine | Configured type, with Oracle FLOAT precision or SQLite auto-increment variants when applicable. |
| Raises | |
orionis.database.QueryException | If no builder is registered for the declared column type. |
Build table-level keys, foreign keys, and indexes.
| Parameters | |
definition:orionis.orm.schema.TableDefinition | Composite primary key, unique constraints, foreign keys, and indexes. |
| Returns | |
list of typing.Any | SQLAlchemy schema items with prefixed foreign-key targets and generated names for unnamed indexes. |
Reject a SELECT row lock when the backend is Redshift.
| Parameters | |
plan:orionis.orm.query.SelectPlan | Current SELECT plan whose lock setting is checked. |
| Returns | |
None | No return value. |
| Raises | |
orionis.database.QueryException | If plan.lock is set for the Redshift backend. |
SourceMap, default: SqlSource, clauses: Sequence[ WhereClause]) -> ColumnElement[ bool] | None:
(source)
¶
Compile ordered WHERE or HAVING clauses into one predicate.
Use each clause after the first to select its AND or OR connector.
| Parameters | |
sources:orionis.database.compiler.SourceMap | Sources indexed by alias or logical table name. |
default:typing.Any | Fallback source for unqualified column names. |
clauses:collections.abc.Sequence of orionis.orm.query.WhereClause | Ordered conditions and their boolean connectors. |
| Returns | |
sqlalchemy.sql.elements.ColumnElement or TextClause or None | Compiled predicate, or None when no clauses are supplied. |
| Raises | |
orionis.database.QueryException | If a condition has unknown references or unsupported clause semantics. |
TableDefinition, *, if_not_exists: bool = True) -> Executable:
(source)
¶
Compile table metadata into a CREATE TABLE DDL object.
| Parameters | |
definition:orionis.orm.schema.TableDefinition | Logical table name, columns, constraints, schema, and comment. |
ifbool, optional | Request IF NOT EXISTS in the generated DDL. Defaults to True. |
| Returns | |
sqlalchemy.sql.expression.Executable | CREATE TABLE object using the compiler's prefix and cached metadata. |
| Raises | |
orionis.database.QueryException | If a declared column type has no SQL type builder. |
Compile filtering conditions into a DELETE statement.
| Parameters | |
plan:orionis.orm.query.DeletePlan | Target table and WHERE conditions selecting rows to delete. |
| Returns | |
sqlalchemy.sql.Delete | DELETE filtered by the plan's conditions, or unrestricted without them. |
| Raises | |
orionis.database.QueryException | If column references, types, or filtering conditions cannot be compiled. |
str, schema: str | None = None, *, if_exists: bool = True) -> Executable:
(source)
¶
Compile a DROP TABLE DDL object for a logical table name.
| Parameters | |
name:str | Logical name to prefix before resolving table metadata. |
schema:str or None, optional | Owning schema, or None to use the default schema. |
ifbool, optional | Request IF EXISTS in the generated DDL. Defaults to True. |
| Returns | |
sqlalchemy.sql.expression.Executable | DROP TABLE object using cached metadata or a lightweight table stub. |
Compile row mappings into an executable INSERT statement.
| Parameters | |
plan:orionis.orm.query.InsertPlan | Target table and one or more row mappings. |
parameterized:bool, optional | Leave values to execution-time bindings. Defaults to False. |
| Returns | |
sqlalchemy.sql.Insert | INSERT with attached row values, or a parameterized template. Parameterized PostgreSQL statements include RETURNING 1. |
| Raises | |
orionis.database.QueryException | If the plan has no rows or a column type has no SQL type builder. |
Compile a SELECT plan, including aggregates and union branches.
Use a derived query for aggregates over unions and COUNT(*) over distinct or grouped results.
| Parameters | |
plan:orionis.orm.query.SelectPlan | Projection, sources, conditions, grouping, unions, paging, and locks. |
| Returns | |
sqlalchemy.sql.Select or sqlalchemy.sql.CompoundSelect | Executable SELECT; union branches are wrapped in a derived table. |
| Raises | |
orionis.database.QueryException | If sources or columns are unknown, clauses are invalid, or a Redshift row lock is requested. |
Compile replacement values and filters into an UPDATE statement.
| Parameters | |
plan:orionis.orm.query.UpdatePlan | Target table, nonempty assignment mapping, and WHERE conditions. |
| Returns | |
sqlalchemy.sql.Update | UPDATE filtered by the plan's conditions, or unrestricted without them. |
| Raises | |
orionis.database.QueryException | If assignments are empty or columns, types, or conditions are invalid. |
Factories translating logical column definitions into SQLAlchemy types.
| Value |
|