Skip to content

Speed slowdown issue while opening edit page in model #1000

@BrikozO

Description

@BrikozO

Checklist

  • The bug is reproducible against the latest release or master.
  • There are no similar issues or pull requests to fix it yet.

Describe the bug

Hello! I am using sqladmin and there is a problem: when i am creating model which linked with other model (many to many, many to one, doesn't matter) and create more than 1000 objects in DB, speed of page loading extremely go down.

Steps to reproduce the bug

For example, i have table users:

class User(SQLAlchemyBaseUserTableUUID, Base):
    roles: Mapped[list['Role']] = relationship(secondary='user_role', back_populates='users')

Roles and user_role (many to many):

class Role(Base):
    name: Mapped[str] = mapped_column(unique=True, nullable=False)

    users: Mapped[list['User']] = relationship(secondary='user_role', back_populates='roles')

    def __str__(self):
        return self.name


user_role = Table(
    'user_role',
    EmptyBase.metadata,
    Column('user_id', ForeignKey('user.id'), primary_key=True),
    Column('role_id', ForeignKey('role.id'), primary_key=True),
)

I create 3000 roles to test it and link with one user. Try to open page and then - it loads very very slow :(

Expected behavior

No response

Actual behavior

No response

Debugging material

No response

Environment

Python 3.12.12

sqladmin 0.21.0 (i am trying to use 0.23 but there is a problem with uuid, i don't think that there is a big difference for my case)

Additional context

Is there any options to optimize some code inside library? I saw same question in another issue: #704

But it's very old, and there are no any status update yet

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions