websauna.system.model.sanitycheck module

websauna.system.model.sanitycheck.is_sane_database(Base, session)[source]

Check whether the current database matches the models declared in model base.

Currently we check that all tables exist with all columns. What is not checked

  • Column types are not verified

  • Relationships are not verified at all (TODO)

Parameters
  • Base – Declarative Base for SQLAlchemy models to check

  • session (Session) – SQLAlchemy session bound to an engine

Returns

True if all declared models have corresponding tables and columns.