Skip to content

SQLAlchemy AssociationProxy creator lambda vs pickle #4147

Closed

Description

@benedikt-bartscher

Describe the bug
In SQLAlchemy AssociationProxy it's a common pattern to set the creator to an lambda like this:

class User(Base):
    ...

    # use Keyword(keyword=kw) on append() events
    keywords: AssociationProxy[List[str]] = association_proxy(
        "kw", "keyword", creator=lambda kw: Keyword(keyword=kw)
    )

(ref: https://docs.sqlalchemy.org/en/20/orm/extensions/associationproxy.html#creation-of-new-values)
Since reflex uses bare pickle again, this causes issues with Redis State Manager

Expected behavior
Raise a better exception by either improving the PicklingError exception or checking all SQLAlchemy models before compile

Specifics (please complete the following information):

  • Python Version: 3.12.7
  • Reflex Version: main branch
  • OS: arch

Activity

  1. added
    bug
    on Oct 10, 2024
  2. added a commit that references this issue on Oct 24, 2024
    eec3098
  3. added a commit that references this issue on Oct 24, 2024
    d85236b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions