mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-11-30 13:20:40 +03:00
wip: add import endpoint
This commit is contained in:
@@ -63,6 +63,7 @@ class Wordform(Base):
|
||||
- `occurrences` (int): The number of occurrences of the word form.
|
||||
|
||||
"""
|
||||
|
||||
__tablename__ = "wordform"
|
||||
__table_args__ = (PrimaryKeyConstraint("id", name="wordform_pkey"), {"schema": "shakespeare"})
|
||||
|
||||
@@ -133,6 +134,7 @@ class Chapter(Base):
|
||||
- `paragraph` (list[Paragraph]): The paragraphs associated with the chapter.
|
||||
|
||||
"""
|
||||
|
||||
__tablename__ = "chapter"
|
||||
__table_args__ = (
|
||||
ForeignKeyConstraint(["work_id"], ["shakespeare.work.id"], name="chapter_work_id_fkey"),
|
||||
@@ -193,6 +195,7 @@ class Paragraph(Base):
|
||||
- `find(cls, db_session: AsyncSession, character: str) -> List[Paragraph]`: A class method that finds paragraphs associated with a specific character. It takes a database session and the name of the character as arguments, and returns a list of matching paragraphs.
|
||||
|
||||
"""
|
||||
|
||||
__tablename__ = "paragraph"
|
||||
__table_args__ = (
|
||||
ForeignKeyConstraint(["character_id"], ["shakespeare.character.id"], name="paragraph_character_id_fkey"),
|
||||
|
||||
@@ -27,11 +27,7 @@ class Stuff(Base):
|
||||
:param name:
|
||||
:return:
|
||||
"""
|
||||
stmt = (
|
||||
select(cls)
|
||||
.options(joinedload(cls.nonsense))
|
||||
.where(cls.name == name)
|
||||
)
|
||||
stmt = select(cls).options(joinedload(cls.nonsense)).where(cls.name == name)
|
||||
result = await db_session.execute(stmt)
|
||||
instance = result.scalars().first()
|
||||
if instance is None:
|
||||
|
||||
Reference in New Issue
Block a user