A development repo for Prefect Orion; reference documentation can be found at https://orion-docs.prefect.io/
$ git clone https://github.com/PrefectHQ/orion.git
$ pip install -e "./orion[dev]"
Please note steps 1 and 2 are optional. The Orion server will use an in-memory SQLite database by default. If using the in-memory default database, migrations will occur automatically and the database will not persist data when the server is stopped.
Orion server works against SQLite and Postgresql. To specify which database to connect to, set the PREFECT_ORION_DATABASE_CONNECTION_URL
environment variable.
To connect to a SQLite database (easiest/recommended option):
export PREFECT_ORION_DATABASE_CONNECTION_URL=sqlite+aiosqlite:////tmp/orion.db
To connect to a Postgres database, the connection string should look something like this:
export PREFECT_ORION_DATABASE_CONNECTION_URL=postgresql+asyncpg://<username>:<password>@<hostname>/<dbname>'
For the time being, there is no framework for migrations. "Migrating" the database consists of creating the correct tables.
To migrate the database, run the following two lines in a python repl
import prefect, asyncio
asyncio.run(prefect.orion.utilities.database.create_db())
Note that for SQLite databases, models are created automatically if the database is in-memory or is being created for the first time.
Use the following command to run an Orion server locally:
uvicorn prefect.orion.api.server:app --reload
The --reload
flag will automatically reload when changes are made the source files.
The Orion server features interactive documentation, which will actually make requests against the server and trigger database changes.
After starting the server, navigate to localhost:8000/docs
. On this page, you'll find documentation of requests and responses for all endpoints. The docs also pre-populate example data you can use to test out requests.