again, no reason why that should be the case from an ORM perspective, please provide a succinct and full working test case and I can evaluate what you're doing.
On Oct 28, 2010, at 3:24 PM, Thadeus Burgess wrote: > The only way around this is to do two separate commits > > record.approved = True > db.session.commit() > record.tested = True > db.session.commit() > > record.approved is True > record.tested is True > > -- > Thadeus > > > > > On Thu, Oct 28, 2010 at 2:22 PM, Thadeus Burgess <[email protected]> > wrote: > I actually have this same issue as well.. > > I have a field that means the record has been tested. Any updates to the > field make tested = False, all except for one other field. However when I > updated that field and this field it still gets reset to false.. > > > record.approved=True > record.tested=True > > db.session.commit() > > record.approved is True > record.tested is False > > -- > Thadeus > > > > > > On Thu, Oct 28, 2010 at 10:15 AM, Alexandre Conrad > <[email protected]> wrote: > Not sure on this one, but are you passing a formatted date string? Maybe you > should set a datetime object directly and let SA do the string conversion > during flush. > > Alex > > Sent from my fantastic HTC Hero > > >> On Oct 28, 2010 1:41 AM, "KLEIN Stéphane" <[email protected]> wrote: >> >> Hi, >> >> in my project, I use "onupdate" attribute : >> >> foobar_table = Table("FooBar", meta.metadata, >> ... >> Column("created", DateTime(), default=datetime.datetime.now), >> Column("modified", DateTime(), default=datetime.datetime.now, >> onupdate=datetime.datetime.now), >> ... >> ) >> >> All work great. >> >> However, my project have an importation feature and I need to set >> original "modified" field value. >> >> To do that, I've try this solution : >> >> my_foobar_obj.modifield = >> datetime.datetime.strptime(source_date_value, '%Y-%m-%d %H:%M:%S') >> session.commit() >> >> => not success, "modified" field not contain "source_date_value" but >> current date >> >> Other solution : >> >> foobar_table.update().\ >> where(foobar_table.c.id==my_foobar_obj.id).\ >> >> values(modified=datetime.datetime.strptime(source_date_value, '%Y-%m- >> %d %H:%M:%S')) >> >> => not success, "modified" field not contain "source_date_value" but >> current date >> >> Have you a tips to manually change "modified" field value ? >> >> Thanks for your help, >> Stephane >> >> -- >> 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. >> > > -- > 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. > > > > -- > 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. -- 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.
