Hi all,
this comment on Github is well formatted:
https://github.com/zzzeek/sqlalchemy/pull/295#issuecomment-242834334
I see the wrong todo.id after the commit (a log string instead 1)
[...]
2016-08-26 21:36:56,071 INFO sqlalchemy.engine.base.Engine COMMIT
######### before commit - id: None
2016-08-26 21:36:56,073 INFO sqlalchemy.engine.base.Engine BEGIN (implicit)
2016-08-26 21:36:56,073 INFO sqlalchemy.engine.base.Engine INSERT INTO todo
(description, done, user_id) VALUES (?, ?, ?)
2016-08-26 21:36:56,073 INFO sqlalchemy.engine.base.Engine ('TODO test', None,
None)
2016-08-26 21:36:56,074 INFO sqlalchemy.engine.base.Engine COMMIT
######### after commit - id: 2016-08-26 21:36:56,075 INFO
sqlalchemy.engine.base.Engine BEGIN (implicit)
2016-08-26 21:36:56,076 INFO sqlalchemy.engine.base.Engine SELECT todo.id AS
todo_id, todo.description AS todo_description, todo.done AS todo_done,
todo.user_id AS todo_user_id
FROM todo
WHERE todo.id = ?
2016-08-26 21:36:56,076 INFO sqlalchemy.engine.base.Engine (1,)
1
2016-08-26 21:36:56,077 INFO sqlalchemy.engine.base.Engine SELECT todo.id AS
todo_id, todo.description AS todo_description, todo.done AS todo_done,
todo.user_id AS todo_user_id
FROM todo
2016-08-26 21:36:56,077 INFO sqlalchemy.engine.base.Engine ()
1 TODO test
running this code on MAC (Python 2.7.10) with SQLAlchemy version 1.0.14
https://github.com/rognoni/adaptable/blob/master/Backend/Python-Flask/storage/sqlalchemy_sqlite.py
[...]
### test
session = db_schemas.examples.session()
todo = db_schemas.examples.classes.todo(description="TODO test")
session.add(todo)
print "######### before commit - id: ", todo.id
session.commit()
print "######### after commit - id: ", todo.id
for instance in session.query(db_schemas.examples.classes.todo):
print instance.id, instance.description
Using the query the instance.id is correct: 1
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.