no UPDATE after flush, close, commit

5 views
Skip to first unread message

Tamas

unread,
Feb 3, 2012, 6:27:48 PM2/3/12
to SQLElixir
Hi,

I am using Elixir 0.7.1 with MySQL (and TurboGears) for a couple of
months.
Now I have a new project and I could insert data/object into my
database. But now I would like to update an integer value of my object
and it does not happen.

1. If I retrieve the object and set the member to 1, followed by a
session.flush() and session.commit() the UPDATE is not performed.

2. If I retrieve the object and set the member to 1, followed by a
query for another object then the UPDATE is issued.

What can be the problem? Do you have any idea?

Thanks for your help in advance,
Tamas

1.
p = UniProt.query.filter(UniProt.entry_name=="VPS4A_HUMAN").one()
p.isMembrane=1
session.flush()
session.commit()
session.close()

2012-02-04 00:12:41,558 INFO sqlalchemy.engine.base.Engine.0x...6fd0
BEGIN (implicit)
2012-02-04 00:12:41,559 INFO sqlalchemy.engine.base.Engine.0x...6fd0
SELECT rbc_uniprot.id ...
FROM rbc_uniprot
WHERE rbc_uniprot.entry_name = %s
2012-02-04 00:12:41,560 INFO sqlalchemy.engine.base.Engine.0x...6fd0
('VPS4A_HUMAN',)

2.
p = UniProt.query.filter(UniProt.entry_name=="VPS4A_HUMAN").one()
p.isMembrane=1
q = UniProt.query.filter(UniProt.entry_name=="ABCG2_HUMAN").one()
session.commit()

2012-02-04 00:13:28,166 INFO sqlalchemy.engine.base.Engine.0x...9fd0
BEGIN (implicit)
2012-02-04 00:13:28,169 INFO sqlalchemy.engine.base.Engine.0x...9fd0
SELECT rbc_uniprot.id ...
FROM rbc_uniprot
WHERE rbc_uniprot.entry_name = %s
2012-02-04 00:13:28,169 INFO sqlalchemy.engine.base.Engine.0x...9fd0
('VPS4A_HUMAN',)
2012-02-04 00:13:28,175 INFO sqlalchemy.engine.base.Engine.0x...9fd0
UPDATE rbc_uniprot SET `isMembrane`=%s WHERE rbc_uniprot.id = %s
2012-02-04 00:13:28,176 INFO sqlalchemy.engine.base.Engine.0x...9fd0
(1, 399L)
2012-02-04 00:13:28,178 INFO sqlalchemy.engine.base.Engine.0x...9fd0
SELECT rbc_uniprot.id ...
FROM rbc_uniprot
WHERE rbc_uniprot.entry_name = %s
2012-02-04 00:13:28,179 INFO sqlalchemy.engine.base.Engine.0x...9fd0
('ABCG2_HUMAN',)
Reply all
Reply to author
Forward
0 new messages