You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with db_session:
a = A(name='name')
b = B(a=a, x='x')
with db_session:
b = B.get(x='x')
#b.a.load()
b.a.name = 'sss'
====================>
Traceback (most recent call last):
File "/mnt/hgfs/share/pony_orm_unique_keys_not_loaded.py", line 22, in
b.a.name = 'sss'
File "/usr/local/lib/python2.7/dist-packages/pony/orm/core.py", line 2357, in set
for undo_func in reversed(undo_funcs): undo_func()
File "/usr/local/lib/python2.7/dist-packages/pony/orm/core.py", line 2323, in undo_func
if old_val is NOT_LOADED: obj.vals.pop(attr)
KeyError: A.name
If I uncomment << b.a.load() >> everything works as expected;
If I use << b.a.set(name='sss') >> everything works as expected.
If I make name attribute not unique everything works as expected.
If I specify lazy=False for name it is still lazy loaded.
The text was updated successfully, but these errors were encountered:
# Features
* Add Python 3.9 support
* Allow to use kwargs in select: Entity.select(**kwargs) and obj.collection.select(**kwargs), a feature that was announced but actually missed from 0.7.7
* Add support for volatile collection attributes that don't throw "Phantom object appeared/disappeared" exceptions
# Bugfixes
* Fix negative timedelta conversions
* Pony should reconnect to PostgreSQL when receiving 57P01 error (AdminShutdown)
* Allow mixing compatible types (like int and float) in coalesce() arguments
* Support of subqueries in coalesce() arguments
* Fix using aggregated subqueries in ORDER BY section
* Fix queries with expressions like `(x, y) in ((a, b), (c, d))`
* #451: KeyError for seeds with unique attributes in SessionCache.update_simple_index()
python2.7
pony orm 0.7.10
from pony.orm import *
db = Database()
class A(db.Entity):
name=Required(str, unique=True)
b = Set('B')
class B(db.Entity):
x = Required(str)
a = Required('A')
db.bind('sqlite', ':memory:')
db.generate_mapping(create_tables=True)
with db_session:
a = A(name='name')
b = B(a=a, x='x')
with db_session:
b = B.get(x='x')
#b.a.load()
b.a.name = 'sss'
====================>
Traceback (most recent call last):
File "/mnt/hgfs/share/pony_orm_unique_keys_not_loaded.py", line 22, in
b.a.name = 'sss'
File "/usr/local/lib/python2.7/dist-packages/pony/orm/core.py", line 2357, in set
for undo_func in reversed(undo_funcs): undo_func()
File "/usr/local/lib/python2.7/dist-packages/pony/orm/core.py", line 2323, in undo_func
if old_val is NOT_LOADED: obj.vals.pop(attr)
KeyError: A.name
If I uncomment << b.a.load() >> everything works as expected;
If I use << b.a.set(name='sss') >> everything works as expected.
If I make name attribute not unique everything works as expected.
If I specify lazy=False for name it is still lazy loaded.
The text was updated successfully, but these errors were encountered: