From 5d42f2c54bc60a213701bb6b77bf810835a280b4 Mon Sep 17 00:00:00 2001 From: Eric Banzuzi Date: Wed, 21 Aug 2024 15:42:17 +0200 Subject: [PATCH] Database: Standardize sqla model name LifetimeExceptions to singular #6717 --- lib/rucio/core/lifetime_exception.py | 12 ++++++------ lib/rucio/db/sqla/models.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/rucio/core/lifetime_exception.py b/lib/rucio/core/lifetime_exception.py index a8f83eefc7..4a96e91444 100644 --- a/lib/rucio/core/lifetime_exception.py +++ b/lib/rucio/core/lifetime_exception.py @@ -56,9 +56,9 @@ def list_exceptions( state_clause = [] if states: - state_clause = [models.LifetimeExceptions.state == state for state in states] + state_clause = [models.LifetimeException.state == state for state in states] - query = select(models.LifetimeExceptions) + query = select(models.LifetimeException) if state_clause != []: query = query.where(or_(*state_clause)) if exception_id: @@ -201,8 +201,8 @@ def __add_exception( did_type = DIDType[did['did_type']] else: did_type = did['did_type'] - new_exception = models.LifetimeExceptions(id=exception_id, scope=did['scope'], name=did['name'], did_type=did_type, - account=account, pattern=pattern, comments=reason, state=LifetimeExceptionsState.WAITING, expires_at=lifetime) + new_exception = models.LifetimeException(id=exception_id, scope=did['scope'], name=did['name'], did_type=did_type, + account=account, pattern=pattern, comments=reason, state=LifetimeExceptionsState.WAITING, expires_at=lifetime) if len(text) < 3000: text += '%s %s %s\n' % (str(did_type), did['scope'], did['name']) else: @@ -250,9 +250,9 @@ def update_exception( raise UnsupportedOperation query = update( - models.LifetimeExceptions + models.LifetimeException ).where( - models.LifetimeExceptions.id == exception_id + models.LifetimeException.id == exception_id ).values( state=state, updated_at=datetime.utcnow() diff --git a/lib/rucio/db/sqla/models.py b/lib/rucio/db/sqla/models.py index c3135fd467..920b561d59 100644 --- a/lib/rucio/db/sqla/models.py +++ b/lib/rucio/db/sqla/models.py @@ -1646,7 +1646,7 @@ class NamingConvention(BASE, ModelBase): ForeignKeyConstraint(['scope'], ['scopes.scope'], name='NAMING_CONVENTIONS_SCOPE_FK')) -class LifetimeExceptions(BASE, ModelBase): +class LifetimeException(BASE, ModelBase): """Represents the exceptions to the lifetime model""" __tablename__ = 'lifetime_except' id: Mapped[uuid.UUID] = mapped_column(GUID(), default=utils.generate_uuid)