Again, stupid me. A return in a @declared_attr helps sometimes ... Sorry
to bother :)
Best regards,
Richard.
On 11/06/2013 03:21 PM, Richard Gerd Kuesters wrote:
Reworking:
*-> entity_cls =
self.session.query(EntityClass).filter(EntityClass.name ==
struct.get('name')).first()**
**(Pdb) bla = EntityClass({'name':u'blaaa'})**
***** TypeError: __init__() takes exactly 1 argument (2 given)*
But my __init__ looks like this:
* def __init__(self, *args, **kwargs):**
** ...*
It doesn't matter which is my parameter: I always get the same error
(even without any params). Creepy.
On 11/06/2013 03:12 PM, Richard Gerd Kuesters wrote:
Hello all!
I don't know if this is something that may happen if I mixup my code
too much (or bad patterns), but I'm having the following error using
0.8.3:
*-> entity_cls =
self.session.query(EntityClass).filter(EntityClass.name ==
struct.get('name')).first()**
**(Pdb) EntityClass**
**<class 'generator.htcad.EntityClass'>**
**(Pdb) dir(EntityClass)**
**['__class__', '__delattr__', '__dict__', '__doc__', '__format__',
'__getattribute__', '__hash__', '__init__', '__mapper__',
'__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__sizeof__', '__str__', '__subclasshook__',
'__table__', '__tablename__', '__weakref__', '_cls_id',
'_decl_class_registry', '_has', '_sa_class_manager', 'add_attribute',
'description', 'entity_class_id', 'get_attribute', 'has_attribute',
'id_', 'metadata', 'name']**
**(Pdb) EntityClass.name**
**<sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x15b5f90>**
**(Pdb) self.session.query(EntityClass)**
***** TypeError: __init__() takes exactly 2 arguments (1 given)**
**(Pdb) self.session.query(EntityClass.name)**
**<sqlalchemy.orm.query.Query object at 0x165e410>**
**(Pdb) self.session.query(EntityClass.id_)**
**<sqlalchemy.orm.query.Query object at 0x165e490>**
**(Pdb) c**
**Traceback (most recent call last):**
** File "tmp_func.py", line 87, in <module>**
** eav.define_entity_structure(page_json)**
** File
"/home/richard/work/projects/htcad-tupy-ui/generator/eav.py", line
62, in define_entity_structure**
** entity_cls =
self.session.query(EntityClass).filter(EntityClass.name ==
struct.get('name')).first()**
** File
"/home/richard/.pyenv/versions/htcaddb/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py",
line 1107, in query**
** return self._query_cls(entities, self, **kwargs)**
** File
"/home/richard/.pyenv/versions/htcaddb/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py",
line 115, in __init__**
** self._set_entities(entities)**
** File
"/home/richard/.pyenv/versions/htcaddb/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py",
line 124, in _set_entities**
**self._set_entity_selectables(self._entities)**
** File
"/home/richard/.pyenv/versions/htcaddb/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py",
line 157, in _set_entity_selectables**
** ent.setup_entity(*d[entity])**
** File
"/home/richard/.pyenv/versions/htcaddb/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py",
line 2913, in setup_entity**
** self._with_polymorphic = ext_info.with_polymorphic_mappers**
** File
"/home/richard/.pyenv/versions/htcaddb/local/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py",
line 612, in __get__**
** obj.__dict__[self.__name__] = result = self.fget(obj)**
** File
"/home/richard/.pyenv/versions/htcaddb/local/lib/python2.7/site-packages/sqlalchemy/orm/mapper.py",
line 1458, in _with_polymorphic_mappers**
** configure_mappers()**
** File
"/home/richard/.pyenv/versions/htcaddb/local/lib/python2.7/site-packages/sqlalchemy/orm/mapper.py",
line 2150, in configure_mappers**
** raise e**
**sqlalchemy.exc.InvalidRequestError: One or more mappers failed to
initialize - can't proceed with initialization of other mappers.
Original exception was: __init__() takes exactly 2 arguments (1 given)*
Any ideas? Or ... Where to find that mapper(s) that didn't initialize?
Best regards,
Richard.
--
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.
--
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.
--
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.