Hi there.

I have searched but I haven't found an answer to my issue.

I have this code:

  metadata = sqlalchemy.MetaData(bind=self.engine)
  metadata.reflect()
  table_user = self.metadata.tables['USER']

Now, how can I issue a SQL update over the table table_user (using the 
variable table_user)?

With SQL, this works:

     result = session.execute('UPDATE USER SET balance = :balance where 
id_user=:id_user',  {'balance' : new_balance,   'id_user' : id_user})

I'm using MySQL with the latest sqlalchemy.

I can perform selects, but not updates. The select worked like this:

    user_record = session.query(table_user).filter(table_user.c.id_user == 
id_user).first()

I wonder if there is a better way to do this.

Regards,
Nelson.-

-- 
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/d/optout.

Reply via email to