Hi,
I have a similar problem and I've found out one thing.

If I insert or update using Table (schema.Table) changes are not committed
to the database.

dbs = DBSession

meta = MetaData(bind=dbs.bind)
table = Table('foo', autoload=True)

dbs.execute(table.update(dict(foo_id=1), values=dict(bar='bar'))
dbs.commit()

But If I use a "declarative_base" class and I make a "fake" change like:

meta = MetaData(bind=dbs.bind)
table = Table('foo', autoload=True)

dbs.execute(table.update(dict(foo_id=1), values=dict(bar='bar'))

*o = dbs.query(AClass).get(1)
*
*o.id = o.id
dbs.add(o)
*
dbs.commit()

Then all the changes are commited to the database. May be the "first"
change doesn't change the "dirty state" of the session. I don't know.

Regards,
León

On 13 April 2013 12:46, Werner <[email protected]> wrote:

>  Hi,
>
> I don't use Pylons (at least not yet), but use SA.
>
>
> On 13/04/2013 12:12, Biswas, Pinakee wrote:
>
>  Hi,****
>
> ** **
>
> I need help with SQLAlchemy. I am not sure if this is the right forum to
> ask the query but since we are using Pylons and SQLAlchemy is part of the
> same, I thought asking here:****
>
> ** **
>
> I am using UPDATE query on SQLAlchemy session as follows:****
>
> ** **
>
> p = DBSession.query(Paymenttransaction).filter_by(id = 
> payment.id).update({"status":'success',
> "transactionid":’transaction_id’]}, synchronize_session=False)****
>
> ** **
>
> p is returning 1 (number of rows matching the query). There is also no
> exception thrown. But somehow the columns are not getting updated in the
> Database. I am not sure what is going wrong here.
>
> Is there a commit after this?
>
> If you activate logging on your DBSession you should be able to see this.
>
>  ****
>
> ** **
>
> I have used similar query elsewhere in the code where it is working fine.*
> ***
>
> ** **
>
> Would really appreciate if you could give me some pointers.****
>
> ** **
>
> We are using SQLAlchemy 0.6.
>
> This is a very very very old version of SQLAlchemy, any reason why you
> don't use 0.8?
>
> Werner
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to