On Nov 18, 2007, at 10:15 PM, Matt wrote:

>
> I have some classes that inherit from one another, here are the
> mappers:
>
> mapper(Content, content, polymorphic_on=content.c.type,
> polymorphic_identity='content')
> mapper(TvContent, content_tv_metadata, inherits=Content,
> polymorphic_identity='tv show')
> mapper(SoftwareContent, content_software_metadata, inherits=Content,
> polymorphic_identity='software')
> mapper(MusicContent, content_music_metadata, inherits=Content,
> polymorphic_identity='music')
> mapper(MovieContent, content_movie_metadata, inherits=Content,
> polymorphic_identity='movie')
>
> And the error I'm getting?
>
> Traceback (most recent call last):
>  File "./test_sahara_content.py", line 19, in ?
>    x = q.get(16634)
>  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
> python2.4/site-packages/SQLAlchemy-0.4.1-py2.4.egg/sqlalchemy/orm/
> query.py", line 96, in get
>    return self._get(key, ident, **kwargs)
>  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
> python2.4/site-packages/SQLAlchemy-0.4.1-py2.4.egg/sqlalchemy/orm/
> query.py", line 778, in _get
>    return q.all()[0]
>  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
> python2.4/site-packages/SQLAlchemy-0.4.1-py2.4.egg/sqlalchemy/orm/
> query.py", line 608, in all
>    return list(self)
>  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
> python2.4/site-packages/SQLAlchemy-0.4.1-py2.4.egg/sqlalchemy/orm/
> query.py", line 656, in __iter__
>    return self._execute_and_instances(context)
>  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
> python2.4/site-packages/SQLAlchemy-0.4.1-py2.4.egg/sqlalchemy/orm/
> query.py", line 661, in _execute_and_instances
>    return iter(self.instances(result, querycontext=querycontext))
>  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
> python2.4/site-packages/SQLAlchemy-0.4.1-py2.4.egg/sqlalchemy/orm/
> query.py", line 727, in instances
>    context.attributes.get(('populating_mapper', id(instance)),
> object_mapper(instance))._post_instance(context, instance)
>  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
> python2.4/site-packages/SQLAlchemy-0.4.1-py2.4.egg/sqlalchemy/orm/
> mapper.py", line 1549, in _post_instance
>    p(instance)
>  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
> python2.4/site-packages/SQLAlchemy-0.4.1-py2.4.egg/sqlalchemy/orm/
> mapper.py", line 1568, in post_execute
>    self.populate_instance(selectcontext, instance, row, isnew=False,
> instancekey=identitykey, ispostselect=True)
>  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
> python2.4/site-packages/SQLAlchemy-0.4.1-py2.4.egg/sqlalchemy/orm/
> mapper.py", line 1519, in populate_instance
>    (newpop, existingpop, post_proc) =
> selectcontext.exec_with_path(self, prop.key,
> prop.create_row_processor, selectcontext, self, row)
>  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
> python2.4/site-packages/SQLAlchemy-0.4.1-py2.4.egg/sqlalchemy/orm/
> query.py", line 1243, in exec_with_path
>    return func(*args, **kwargs)
>  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
> python2.4/site-packages/SQLAlchemy-0.4.1-py2.4.egg/sqlalchemy/orm/
> interfaces.py", line 487, in create_row_processor
>    return
> self
> ._get_context_strategy
> (selectcontext).create_row_processor(selectcontext,
> mapper, row)
>  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
> python2.4/site-packages/SQLAlchemy-0.4.1-py2.4.egg/sqlalchemy/orm/
> strategies.py", line 75, in create_row_processor
>    elif self.columns[0] in row:
> TypeError: iterable argument required
>
> Any ideas?  This is using 0.4.1

my idea is that the mapper is trying to load the row for a subclass  
table, such as content_software_metadata, and its getting back None  
for the row....which should ideally raise an assertion error.  but its  
not so its going much deeper before it craps out.   As to why the row  
is None, from what you've shown ive no idea (unless you've manipulated  
those tables externally to the ORM, that would do it).  Im looking at  
unit tests which have essentially the exact same code.   So, youd have  
to tell me if this error occurs with 0.4.0 as well, and you also need  
to send me the full structure of your tables and the code that exactly  
produces the error. if its actualy a bug which was introduced in  
0.4.1, you can look forward to 0.4.2 by tomorrow at the latest.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to