idmtools_platform_local.internals.workers.database module

idmtools local platform database configuration.

Copyright 2021, Bill & Melinda Gates Foundation. All rights reserved.

idmtools_platform_local.internals.workers.database.create_db(engine)

Create our db if it doesn’t exist.

idmtools_platform_local.internals.workers.database.get_session() sqlalchemy.orm.session.Session

Get our DB session.

idmtools_platform_local.internals.workers.database.get_db() sqlalchemy.engine.base.Engine

Get our db connection.

idmtools_platform_local.internals.workers.database.reset_db()

Restart postgres db connection.

idmtools_platform_local.internals.workers.database.get_or_create(session: sqlalchemy.orm.session.Session, model, filter_args: List[str], **model_args)

Get or create our model.

Parameters:
  • session – db session

  • model – model to get/create

  • filter_args – filters to look for item with

  • **model_args – model args for creating

Returns:

Instance