Hello,
i'm new on sqlalchemy and i have a problem.
I want to update the entry in a column of a table of a row using the info
of a new row. For example, i could have measured a value in a certain date
class Phototubes(Base):
__tablename__ = 'MaPMTs'
SerialNumber = Column(String,
Hi,
I've encountered a situation where I don't know if this is a bug or it is
the correct behavior. It is about association_proxy. Please see the
User.__init__ and Department.__init__ methods.
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import
Ok my test case was not reproducing the error as in my previous post, but
consider this one it is generating the IntegrityError
if __name__ == __main__:
database_engine_settings = {
sqlalchemy.url: sqlite:///:memory:,
sqlalchemy.echo: False,
}
engine =
take a look at the stack trace (or send it along). Do you see autoflush in it?
If so, you should use “with session.no_autoflush” around the area where you
are likely triggering a lazy load of an attribute or collection.
Yes it recommends using ``no_autoflush`` and:
with DBSession.no_autoflush:
dep1.users.append(user2)
fixes it.
So is this the correct way appending to the collection, and should I wrap
all code that is manipulating ``Department.users`` with a ``no_autoflush``?
Erkan Ozgur Yilmaz
On Thu,
well depending on when you last loaded that collection and/or committed it
might already be loaded. but if it isn’t loaded, autoflush is pretty
simplistic, it flushes before the collection is loaded.
other things you can look into for tuning this are to make it less likely for
the object to