mss_dataserver.core.database_util.add_foreign_key

mss_dataserver.core.database_util.add_foreign_key(engine, table, columns, target_table, target_columns, on_update, on_delete)[source]

Add a foreign key constraint.

Parameters
  • engine (sqlalchemy.engine.Engine) – The sqlalchemy database Engine.

  • table (sqlalchemy.schema.Table) – The table to migrate.

  • columns (list of String) – The column names.

  • target_table (String) – The name of the table, that the foreign key references.

  • target_columns (list of String) – The names of the columns, that the foreign key references.

  • on_update (String) – The action to perform on update (sql ON UPDATA).

  • on_delete (String) – The action to perform on delete (sql ON DELETE).