sqlalchemy: add generic repr to base model
Instead of `<manila.db.sqlalchemy.models.ShareServer object at 0x7f603645bf40>` we now get ``` ShareServer(created_at=datetime.datetime(2023, 4, 18, 15, 44, 43, 741302), updated_at=datetime.datetime(2023, 4, 19, 10, 18, 59, 614018), deleted_at=datetime.datetime(2023, 4, 19, 10, 18, 59, 613577), id='3363dcd4-fcdd-4cfa-b02d-5899fba3d413', deleted='3363dcd4-fcdd-4cfa-b02d-5899fba3d413', share_network_subnet_id='8d4365dc-0869-4896-8049-6455f84ad08f', ...) ``` e.g. in error messages of failed purges or in interactive shell sessions. Change-Id: I5e6513e7ca7b4a9d4d7261f873cbf3f5bf3c83ab
This commit is contained in:
parent
15b4b39eb5
commit
e34e8f7fc3
@ -25,6 +25,7 @@ from sqlalchemy import Column, Integer, String, schema
|
|||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
from sqlalchemy import orm
|
from sqlalchemy import orm
|
||||||
from sqlalchemy import ForeignKey, DateTime, Boolean, Enum
|
from sqlalchemy import ForeignKey, DateTime, Boolean, Enum
|
||||||
|
from sqlalchemy_utils import generic_repr
|
||||||
|
|
||||||
from manila.common import constants
|
from manila.common import constants
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ CONF = cfg.CONF
|
|||||||
BASE = declarative_base()
|
BASE = declarative_base()
|
||||||
|
|
||||||
|
|
||||||
|
@generic_repr
|
||||||
class ManilaBase(models.ModelBase,
|
class ManilaBase(models.ModelBase,
|
||||||
models.TimestampMixin,
|
models.TimestampMixin,
|
||||||
models.SoftDeleteMixin):
|
models.SoftDeleteMixin):
|
||||||
|
@ -42,6 +42,7 @@ requests>=2.23.0 # Apache-2.0
|
|||||||
tenacity>=6.3.1 # Apache-2.0
|
tenacity>=6.3.1 # Apache-2.0
|
||||||
Routes>=2.4.1 # MIT
|
Routes>=2.4.1 # MIT
|
||||||
SQLAlchemy>=1.3.17 # MIT
|
SQLAlchemy>=1.3.17 # MIT
|
||||||
|
SQLAlchemy-Utils>=0.38.3 # BSD License
|
||||||
stevedore>=3.2.2 # Apache-2.0
|
stevedore>=3.2.2 # Apache-2.0
|
||||||
tooz>=2.7.1 # Apache-2.0
|
tooz>=2.7.1 # Apache-2.0
|
||||||
python-cinderclient!=4.0.0,>=3.3.0 # Apache-2.0
|
python-cinderclient!=4.0.0,>=3.3.0 # Apache-2.0
|
||||||
|
Loading…
Reference in New Issue
Block a user