I know what this is and it should be working in r5280. I don't have access to firebird here so we weren't able to run the tests on it before rc3 was out.
On Nov 10, 2008, at 7:39 AM, Werner F. Bruhin wrote: > > I am getting sometimes the following exception with rc3 which I did > not > see with rc2 when I do something like this: > > > engine = sa.create_engine(dburl, encoding='utf8', echo=False) > # connect to the database > ##connection = engine.connect() > Session = sao.sessionmaker() > Session.configure(bind=engine) > ##Session.configure(bind=connection) > session = Session() > query = session.query(db.Preferences).get(1) > lang = session.query(db.Language).get(2) > query.language = lang > session.commit() > > Am I doing which I should not, which now causes this or ...? > > Best regards > Werner > > Following the traceback and part of my model. > > Traceback (most recent call last): > File "saTest.py", line 56, in <module> > session.commit() > File > "c:\python25\lib\site-packages\sqlalchemy-0.5.0rc3-py2.5.egg > \sqlalchemy\orm\session.py", > line 670, in commit > self.transaction.commit() > File > "c:\python25\lib\site-packages\sqlalchemy-0.5.0rc3-py2.5.egg > \sqlalchemy\orm\session.py", > line 375, in commit > self._prepare_impl() > File > "c:\python25\lib\site-packages\sqlalchemy-0.5.0rc3-py2.5.egg > \sqlalchemy\orm\session.py", > line 359, in _prepare_impl > self.session.flush() > File > "c:\python25\lib\site-packages\sqlalchemy-0.5.0rc3-py2.5.egg > \sqlalchemy\orm\session.py", > line 1354, in flush > self._flush(objects) > File > "c:\python25\lib\site-packages\sqlalchemy-0.5.0rc3-py2.5.egg > \sqlalchemy\orm\session.py", > line 1424, in _flush > flush_context.execute() > File > "c:\python25\lib\site-packages\sqlalchemy-0.5.0rc3-py2.5.egg > \sqlalchemy\orm\unitofwork.py", > line 260, in execute > UOWExecutor().execute(self, tasks) > File > "c:\python25\lib\site-packages\sqlalchemy-0.5.0rc3-py2.5.egg > \sqlalchemy\orm\unitofwork.py", > line 723, in execute > self.execute_save_steps(trans, task) > File > "c:\python25\lib\site-packages\sqlalchemy-0.5.0rc3-py2.5.egg > \sqlalchemy\orm\unitofwork.py", > line 738, in execute_save_steps > self.save_objects(trans, task) > File > "c:\python25\lib\site-packages\sqlalchemy-0.5.0rc3-py2.5.egg > \sqlalchemy\orm\unitofwork.py", > line 729, in save_objects > task.mapper._save_obj(task.polymorphic_tosave_objects, trans) > File > "c:\python25\lib\site-packages\sqlalchemy-0.5.0rc3-py2.5.egg > \sqlalchemy\orm\mapper.py", > line 1318, in _save_obj > rows += c.rowcount > File > "c:\python25\lib\site-packages\sqlalchemy-0.5.0rc3-py2.5.egg > \sqlalchemy\engine\base.py", > line 1397, in rowcount > return self.context.get_rowcount() > File > "c:\python25\lib\site-packages\sqlalchemy-0.5.0rc3-py2.5.egg > \sqlalchemy\engine\default.py", > line 279, in get_rowcount > return self.cursor.rowcount > File > "c:\python25\lib\site-packages\sqlalchemy-0.5.0rc3-py2.5.egg > \sqlalchemy\pool.py", > line 466, in __getattr__ > return getattr(self.cursor, key) > kinterbasdb.ProgrammingError: (0, 'Invalid cursor state. The cursor > must be open to perform this operation.') > > The relevant part of my model are: > class BaseExt(object): > def __repr__(self): > return "%s(%s)" % ( > (self.__class__.__name__), > ', '.join(["%s=%r" % (key, getattr(self, key)) > for key in sorted(self.__dict__.keys()) > if not key.startswith('_')])) > > Base = sad.declarative_base(cls=BaseExt) > metadata = Base.metadata > > > class Language(Base): > __table__ = sa.Table(u'language', metadata, > sa.Column(u'langid', sa.Integer(), > sa.Sequence('gen_language_langid'), primary_key=True, nullable=False), > sa.Column(u'name', sa.String(length=50, convert_unicode=False), > nullable=False), > sa.Column(u'locales', sa.String(length=2, convert_unicode=False)), > sa.Column(u'created', sa.Date()), > sa.Column(u'updated', sa.Date()), > ) > > class Preferences(Base): > __table__ = sa.Table(u'preferences', metadata, > sa.Column(u'prefid', sa.Integer(), > sa.Sequence('gen_preferences_prefid'), primary_key=True, > nullable=False), > ... > sa.Column(u'fk_langid', sa.Integer(), > sa.ForeignKey(u'language.langid'), nullable=False), > ... > ) > > cellar = sao.relation(Cellar) > language = sao.relation(Language) > reason_ls = sao.relation(Reason_Ls) > displayformats = sao.relation(Displayformats) > measure_ls = sao.relation(Measure_Ls) > ingr_ls = sao.relation(Ingr_Ls) > tastingsys = sao.relation(Tastingsys) > imagetype_ls = sao.relation(Imagetype_Ls, primaryjoin= > ('Preferences.fk_imagetypeid==Imagetype_Ls.imagetypeid')) > filters = sao.relation(Filters) > ratingtype_ls = sao.relation(Ratingtype_Ls) > container_ls = sao.relation(Container_Ls) > imagetype_ls_rec = sao.relation(Imagetype_Ls, primaryjoin= > > ('Preferences.rec_fk_imagetypeid==Imagetype_Ls.imagetypeid')) > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---