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.
Apply new seeders exactly once on the selected database connection.
Files under database/seeders are discovered in lexical filename order. The application container builds each seeder so constructors can receive dependencies. Each seeder and its tracking row commit in the same transaction. The unique tracking key acts as a database-level claim when runs overlap.
| Method | __discover |
Find local Seeder subclasses in deterministic filename order. |
| Async Method | __ensure |
Create the tracking table, tolerating a concurrent creator. |
| Async Method | __get |
Read committed tracking rows in insertion order. |
| Method | __init__ |
Initialize the runner with the application and connection manager. |
| Async Method | __is |
Check whether another transaction committed this seeder. |
| Async Method | __run |
Claim, run and commit one seeder and its tracking row. |
| Method | __seeders |
Return the application's configured seeder directory. |
| Async Method | seed |
Run every discovered seeder that has no committed tracking row. |
| Class Variable | __slots__ |
Declare the instance attribute slots reserved by this class. |
| Instance Variable | __app |
Application providing the seeder directory. |
| Instance Variable | __conn |
Manager resolving configured database connections. |
| Instance Variable | __discovered |
Cached results of filesystem discovery. |
Find local Seeder subclasses in deterministic filename order.
| Returns | |
dict of str to type of orionis.database.seeders.Seeder | Seeder classes keyed by persisted filename stem. |
| Raises | |
ValueError | If more than one class resolves to the same persisted name. |
Create the tracking table, tolerating a concurrent creator.
| Parameters | |
connection:orionis.database.contracts.IConnection | Selected database connection. |
| Returns | |
None | No return value. |
Read committed tracking rows in insertion order.
| Parameters | |
connection:orionis.database.contracts.IConnection | Connection holding the tracking table. |
| Returns | |
list of dict | Tracking rows ordered by primary key. |
Initialize the runner with the application and connection manager.
| Parameters | |
app:orionis.IApplication | Application providing the seeder directory. |
connorionis.database.contracts.IConnectionManager | Manager resolving configured database connections. |
| Returns | |
None | No return value. |
Check whether another transaction committed this seeder.
Observe a failed recovery read without replacing the pending claim error. The caller propagates that original error when recovery is unconfirmed. Return False after observing a QueryException that prevents the lookup.
| Parameters | |
connection:orionis.database.contracts.IConnection | Connection holding the tracking table. |
name:str | Seeder filename stem. |
| Returns | |
bool | Whether a committed tracking row was confirmed by the recovery read. |
IConnection, name: str, seeder_cls: type[ Seeder], batch: int, events: SeederEvents) -> bool:
(source)
¶
Claim, run and commit one seeder and its tracking row.
| Parameters | |
connection:orionis.database.contracts.IConnection | Connection shared by the seeder and tracking transaction. |
name:str | Persisted seeder filename stem. |
seedertype of orionis.database.seeders.Seeder | Class to instantiate and execute. |
batch:int | Batch assigned to this invocation. |
events:orionis.database.seeders.events.SeederEvents | Progress callbacks. |
| Returns | |
bool | Whether this call executed the seeder. |
Return the application's configured seeder directory.
| Returns | |
pathlib.Path | Absolute path under database/seeders. |
str | None = None, events: SeederEvents | None = None) -> list[ str]:
(source)
¶
Run every discovered seeder that has no committed tracking row.
| Parameters | |
connection:str or None, optional | Named database connection, or the configured default. |
events:orionis.database.seeders.events.SeederEvents or None, optional | Progress callbacks for executed seeders. |
| Returns | |
list of str | Seeder names completed by this call, in execution order. |