Unpickling/pickling MetaData dosn't work if we have tables and columns.

Issue #762 resolved
Former user created an issue

I found that pickling eariler unpickled MetaData doesn't work if with have MetaData with some Table and Columns.

If I run test:

from sqlalchemy import Column, Integer, Table, MetaData
from pickle import dumps,dump,load,loads
metadata = MetaData()
table = Table('Foo',metadata,Column('Bar',Integer))
s = dumps(metadata)
del metadata
del table
metadata = loads(s)
s2 = dumps(metadata)

i got:

  File "C:\python251\Lib\site-packages\sqlalchemy\util.py", line 286, in __getattr__
    return self._data[key](key)
  File "C:\python251\Lib\site-packages\sqlalchemy\util.py", line 286, in __getattr__
    return self._data[key](key)
RuntimeError: maximum recursion depth exceeded

There is something wrong with ColumnCollection.getstate method. Probably unpickled MetaData isn't correct.

Tested on trunk r3416 and with Python 2.5.1 on Windows.

Comments (2)

  1. Log in to comment