mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-11-30 13:20:40 +03:00
format
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# for Alembic and unit tests
|
||||
from app.models.stuff import * # noqa
|
||||
from app.models.nonsense import * # noqa
|
||||
from app.models.shakespeare import * # noqa
|
||||
from app.models.shakespeare import * # noqa
|
||||
from app.models.stuff import * # noqa
|
||||
|
||||
@@ -13,8 +13,8 @@ class BaseReadOnly:
|
||||
# Generate __tablename__ automatically
|
||||
|
||||
@declared_attr
|
||||
def __tablename__(cls) -> str:
|
||||
return cls.__name__.lower()
|
||||
def __tablename__(self) -> str:
|
||||
return self.__name__.lower()
|
||||
|
||||
|
||||
@as_declarative()
|
||||
@@ -24,8 +24,8 @@ class Base:
|
||||
# Generate __tablename__ automatically
|
||||
|
||||
@declared_attr
|
||||
def __tablename__(cls) -> str:
|
||||
return cls.__name__.lower()
|
||||
def __tablename__(self) -> str:
|
||||
return self.__name__.lower()
|
||||
|
||||
async def save(self, db_session: AsyncSession):
|
||||
"""
|
||||
|
||||
@@ -10,9 +10,7 @@ from app.models.base import Base
|
||||
|
||||
class Nonsense(Base):
|
||||
__tablename__ = "nonsense"
|
||||
__table_args__ = (
|
||||
{"schema": "happy_hog"},
|
||||
)
|
||||
__table_args__ = ({"schema": "happy_hog"},)
|
||||
id = Column(UUID(as_uuid=True), unique=True, default=uuid.uuid4, autoincrement=True)
|
||||
name = Column(String, nullable=False, primary_key=True, unique=True)
|
||||
description = Column(String, nullable=False)
|
||||
|
||||
@@ -10,9 +10,7 @@ from app.models.base import Base
|
||||
|
||||
class Stuff(Base):
|
||||
__tablename__ = "stuff"
|
||||
__table_args__ = (
|
||||
{"schema": "happy_hog"},
|
||||
)
|
||||
__table_args__ = ({"schema": "happy_hog"},)
|
||||
id = Column(UUID(as_uuid=True), unique=True, default=uuid.uuid4, autoincrement=True)
|
||||
name = Column(String, nullable=False, primary_key=True, unique=True)
|
||||
description = Column(String, nullable=False)
|
||||
|
||||
Reference in New Issue
Block a user