S P <[email protected]> wrote:

> I am using SQLAlchemy version 0.9.7.  I have ~ 400 tables that I 
> automatically reflect from the database.  I would like to cPickle the 
> metadata after reflection and store this, then subsequently unpickle the 
> metadata and use it (for speedup) rather than use reflection again.
>  
> The pickle goes fine.  When trying to unpickle and assign to metadata for 
> subsequent use, I get the following error:
>  
>     metadata_cached = cPickle.load(cache)
> TypeError: ('__new__() takes exactly 2 arguments (3 given)', <class 
> 'sqlalchemy.sql.elements._defer_name'>, (u'material_type', None))
>  
> material_type is one of several custom Postgres types we have defined on our 
> database.  I have searched but cannot find a way to address this.  Has anyone 
> else tried to do a similar thing?

this construct refers to the Enum or Boolean types regarding a CheckConstraint 
that is generated behind the scenes corresponding to these types.    It creates 
a construct called “_defer_name()” which refers to the fact that the name of 
the constraint is not known for sure yet.  This object is not pickleable in 
0.9.7 due the regression introduced by 
https://bitbucket.org/zzzeek/sqlalchemy/issue/3067 and this was repaired for 
issue https://bitbucket.org/zzzeek/sqlalchemy/issue/3144/, released in 0.9.8.


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to