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.
Fluent collector of column definitions for a single table.
Instances are yielded by Schema.create(name) when used as an async context manager (async with schema.create(name) as table:), allowing columns to be declared one call at a time instead of passing every definition up front. Table-level constraints (Comment, ForeignKey, Index, PrimaryKey, Unique) are declared the same way, via table.comment(...), table.foreignKey(...), table.index(...), table.primaryKey(...) and table.unique(...).
| Method | __getattr__ |
Proxy a column-factory call to Column, recording it. |
| Method | __init__ |
Initialize the blueprint with no columns declared yet. |
| Method | columns |
Return the columns declared so far, in declaration order. |
| Method | comment |
Attach a table-level comment. |
| Method | definitions |
Return every column and table-level constraint declared so far. |
| Method | foreign |
Declare a foreign key constraint on this table. |
| Method | index |
Declare an index over one or more columns. |
| Method | primary |
Declare a (composite) primary key over one or more columns. |
| Method | timestamps |
Add nullable created_at and updated_at columns. |
| Method | unique |
Declare a unique constraint over one or more columns. |
| Class Variable | __slots__ |
Undocumented |
| Instance Variable | __columns |
Undocumented |
| Instance Variable | __constraints |
Undocumented |
| Instance Variable | __factory |
Undocumented |
Proxy a column-factory call to Column, recording it.
This is what powers calls such as table.string("username") or
table.boolean("is_admin"): any factory exposed by
Column becomes available on the blueprint, and the
resulting column is appended to this table automatically.
| Parameters | |
name:str | Name of the Column factory method being invoked. |
| Returns | |
Callable[..., ColumnDefinition] | Wrapper that builds the column and appends it to this table. |
| Raises | |
AttributeError | If name does not match a known Column factory method. |
Initialize the blueprint with no columns declared yet.
| Returns | |
None | This method does not return a value. |
Return the columns declared so far, in declaration order.
| Returns | |
tuple of ColumnDefinition | Snapshot of every column recorded on this blueprint. |
tuple[ ColumnDefinition | Comment | ForeignKey | Index | PrimaryKey | Unique, ...]:
(source)
¶
Return every column and table-level constraint declared so far.
| Returns | |
tuple | Columns followed by constraints, in the order each group was recorded on this blueprint. |
str, ref_table: str, ref_column: str, name: str | None = None) -> ForeignKey:
(source)
¶
Declare a foreign key constraint on this table.
| Parameters | |
column:str | The local column name. |
refstr | The referenced table name. |
refstr | The referenced column name. |
name:str | None, optional | The constraint name. Defaults to None. |
| Returns | |
ForeignKey | The constraint recorded on this blueprint. |
Declare an index over one or more columns.
| Parameters | |
*columns:str | Column names to include in the index. |
name:str | None, optional | Name of the index. If not provided, a default name will be generated. |
unique:bool, optional | Whether the index should enforce uniqueness. Default is False. |
| Returns | |
Index | The constraint recorded on this blueprint. |
Declare a (composite) primary key over one or more columns.
| Parameters | |
*columns:str | Column names that compose the primary key. |
| Returns | |
PrimaryKey | The constraint recorded on this blueprint. |