Skip to content

AssertionError #238

@p-hash

Description

@p-hash

I am migrating lots of data from mongodb to postgresql using ponyorm in custom migration script.
After some work it fails with this error:

Traceback (most recent call last):
  File "orm.py", line 252, in <module>
    migrate_botdata(bot_db.common, newbot)
  File "orm.py", line 226, in migrate_botdata
    block_msg=block,
  File "<string>", line 2, in __init__
  File "/home/paul/tmp/mpb_migration/env/lib/python3.4/site-packages/pony/utils/utils.py", line 58, in cut_traceback
    return func(*args, **kwargs)
  File "/home/paul/tmp/mpb_migration/env/lib/python3.4/site-packages/pony/orm/core.py", line 4199, in __init__
    entity._get_from_identity_map_(pkval, 'created', undo_funcs=undo_funcs, obj_to_init=obj)
  File "/home/paul/tmp/mpb_migration/env/lib/python3.4/site-packages/pony/orm/core.py", line 3992, in _get_from_identity_map_
    if attr.reverse: attr.update_reverse(obj, NOT_LOADED, val, undo_funcs)
  File "/home/paul/tmp/mpb_migration/env/lib/python3.4/site-packages/pony/orm/core.py", line 2131, in update_reverse
    if new_val is not None: reverse.__set__(new_val, obj, undo_funcs)
  File "<string>", line 2, in __set__                                                                                                                                       File "/home/paul/tmp/mpb_migration/env/lib/python3.4/site-packages/pony/utils/utils.py", line 58, in cut_traceback
    return func(*args, **kwargs)                                                                                                                                            File "/home/paul/tmp/mpb_migration/env/lib/python3.4/site-packages/pony/orm/core.py", line 2000, in __set__                                                                 old_val = attr.load(obj)
  File "/home/paul/tmp/mpb_migration/env/lib/python3.4/site-packages/pony/orm/core.py", line 1936, in load
    dbval = reverse.entity._find_in_db_({reverse : obj})
  File "/home/paul/tmp/mpb_migration/env/lib/python3.4/site-packages/pony/orm/core.py", line 3730, in _find_in_db_
    objects = entity._fetch_objects(cursor, attr_offsets, 1, for_update, avdict)
  File "/home/paul/tmp/mpb_migration/env/lib/python3.4/site-packages/pony/orm/core.py", line 3862, in _fetch_objects
    obj._db_set_(avdict)
  File "/home/paul/tmp/mpb_migration/env/lib/python3.4/site-packages/pony/orm/core.py", line 4367, in _db_set_
    assert obj._status_ not in created_or_deleted_statuses
AssertionError

I understand that there can be duplicates in my old data which can violate constraints in posgresql, but how am i supposed to find them basing on that error?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions