From 695c4bc12649332e739b917496389b8546547439 Mon Sep 17 00:00:00 2001 From: Erling Mathias Staff Date: Sat, 20 Apr 2024 16:32:09 +0200 Subject: [PATCH] Testing: Add type annotations and improved docstrings; #6677 --- lib/rucio/db/sqla/models.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/rucio/db/sqla/models.py b/lib/rucio/db/sqla/models.py index 036b24b119..527f2d0d3e 100644 --- a/lib/rucio/db/sqla/models.py +++ b/lib/rucio/db/sqla/models.py @@ -1690,15 +1690,25 @@ class FollowEvents(BASE, ModelBase): Index('DIDS_FOLLOWED_EVENTS_ACC_IDX', 'account')) -def register_models(engine): +def register_models(engine: Engine) -> None: """ - Creates database tables for all models with the given engine + Creates database tables for all models in the `BASE.metadata` schema with the given engine. + Functionally this creates all models, as they all inherit from BASE and exist in the same `BASE.metadata` schema. + + :param engine: engine to register the models with + :type engine: sqlalchemy.engine.Engine + :returns: None """ BASE.metadata.create_all(engine) -def unregister_models(engine): +def unregister_models(engine: Engine) -> None: """ - Drops database tables for all models with the given engine + Drops database tables for all models in the `BASE.metadata` schema with the given engine. + Functionally this drops all models, as they all inherit from BASE and exist in the same `BASE.metadata` schema. + + :param engine: The engine to unregister the models with + :type engine: sqlalchemy.engine.Engine + :returns: None """ BASE.metadata.drop_all(engine)