Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session.merge() doesn't work for objects that are mapped against multiple tables #236

Closed
sqlalchemy-bot opened this issue Jul 11, 2006 · 6 comments
Labels
bug Something isn't working high priority orm

Comments

@sqlalchemy-bot
Copy link
Collaborator

Migrated issue, originally created by Anonymous

If you have an object that is mapped against more than one table, code like

  pickledObj = pickle.dumps(obj)
  unpickledObj = pickle.loads(pickledObj)
  obj2 = session.merge(unpickledObj)

fails with an error because too many arguments are being passed to the session.get() function.


Attachments: sqla-merge.diff | merge.py

@sqlalchemy-bot
Copy link
Collaborator Author

Anonymous wrote:

Patch to fix the problem

@sqlalchemy-bot
Copy link
Collaborator Author

Changes by Anonymous:

  • attached file sqla-merge.diff

@sqlalchemy-bot
Copy link
Collaborator Author

Anonymous wrote:

session.merge() test case

@sqlalchemy-bot
Copy link
Collaborator Author

Changes by Anonymous:

  • attached file merge.py

@sqlalchemy-bot
Copy link
Collaborator Author

Michael Bayer (@zzzeek) wrote:

patched this in changeset:1702

@sqlalchemy-bot
Copy link
Collaborator Author

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

@sqlalchemy-bot sqlalchemy-bot added high priority bug Something isn't working orm labels Nov 27, 2018
sqlalchemy-bot pushed a commit that referenced this issue Jan 18, 2023
Adjustments made to the mypy plugin to accommodate for some potential
changes being made for issue #236 sqlalchemy2-stubs when using SQLAlchemy
1.4. These changes are being kept in sync within SQLAlchemy 2.0.
The changes are also backwards compatible with older versions of
sqlalchemy2-stubs.

Fixed crash in mypy plugin which could occur on both 1.4 and 2.0 versions
if a decorator for the :func:`_orm.registry.mapped` decorator were used
that was referenced in an expression with more than two components (e.g.
``@Backend.mapper_registry.mapped``). This scenario is now ignored; when
using the plugin, the decorator expression needs to be two components (i.e.
``@reg.mapped``).

References: sqlalchemy/sqlalchemy2-stubs#236
Fixes: #9102
Change-Id: Ieb1bf7bf8184645bcd43253e57f1c267b2640537
sqlalchemy-bot pushed a commit that referenced this issue Jan 18, 2023
Adjustments made to the mypy plugin to accommodate for some potential
changes being made for issue #236 sqlalchemy2-stubs when using SQLAlchemy
1.4. These changes are being kept in sync within SQLAlchemy 2.0.
The changes are also backwards compatible with older versions of
sqlalchemy2-stubs.

Fixed crash in mypy plugin which could occur on both 1.4 and 2.0 versions
if a decorator for the :func:`_orm.registry.mapped` decorator were used
that was referenced in an expression with more than two components (e.g.
``@Backend.mapper_registry.mapped``). This scenario is now ignored; when
using the plugin, the decorator expression needs to be two components (i.e.
``@reg.mapped``).

References: sqlalchemy/sqlalchemy2-stubs#236
Fixes: #9102
Change-Id: Ieb1bf7bf8184645bcd43253e57f1c267b2640537
(cherry picked from commit cf64582f61b15716228302f669322d7efa1003c1)
(cherry picked from commit 36285760238314f70eed4532ca2c2c0c2d684609)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority orm
Projects
None yet
Development

No branches or pull requests

1 participant