Skip to main content

Moonstream database

Project description

moonstream db

Setting up moonstreamdb

Copy sample.env to a new file and set the environment variables to appropriate values. This new file should be sourced every time you want to access the database with the moonstreamdb application or any dependents.

To be able to run migrations, copy alembic.sample.ini to a separate file (e.g. ./secrets/alembic.dev.ini) and modify the sqlalchemy.url setting in the new file to point at your database.

Make sure your database is at the latest alembic migration:

alembic -c ./secrets/alembic.dev.ini upgrade head

Adding a new table to database

Add SQLAlchemy model in moonstreamdb/models.py

Import new model and add tablename to whitelist in alembic/env.py

Create a migration:

alembic -c <alembic config file> revision -m "<revision message>" --autogenerate

Always check the autogenerated file to make sure that it isn't performing any actions that you don't want it to. A good policy is to delete any operations that don't touch the tables that you created.

Then run the migration:

alembic -c <alembic config file> upgrade head

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moonstreamdb-0.4.2.tar.gz (11.6 kB view hashes)

Uploaded Source

Built Distribution

moonstreamdb-0.4.2-py3-none-any.whl (12.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page