[sqlalchemy] Re: SQLAlchemy returns stale data in celery tasks

2015-06-21 Thread Rick Mak
It is very common problem and been covered at the pooling doc. You may take a look at http://docs.sqlalchemy.org/en/latest/core/pooling.html#disconnect-handling-pessimistic Personally, I don't use connection pool for celery task. Since the task is often long running and only need one connectio

Re: [sqlalchemy] joined table inheritance child table query return different object after insertion

2015-06-21 Thread Mike Bayer
On 6/21/15 1:46 PM, Kevin Qiu wrote: It's a test db, there's only one record being added to the table. And I ensure that with a assertIn() test and it passes. The original code was: class Application(mydb.Model): __tablename__ = 'APPLICATION' app_id = mydb.Column(mydb.Integer, primary_key = Tr

Re: [sqlalchemy] joined table inheritance child table query return different object after insertion

2015-06-21 Thread Mike Bayer
is it the same row? same primary key? otherwise what is the SQL being emitted, what are the results? try echo='debug'? On 6/21/15 1:46 PM, Kevin Qiu wrote: It's a test db, there's only one record being added to the table. And I ensure that with a assertIn() test and it passes. The original

Re: [sqlalchemy] joined table inheritance child table query return different object after insertion

2015-06-21 Thread Kevin Qiu
It's a test db, there's only one record being added to the table. And I ensure that with a assertIn() test and it passes. The original code was: class Application(mydb.Model): __tablename__ = 'APPLICATION' app_id = mydb.Column(mydb.Integer, primary_key = True)#app_id = mydb.Column(mydb.String(30

Re: [sqlalchemy] joined table inheritance child table query return different object after insertion

2015-06-21 Thread Mike Bayer
did you try adding an ORDER BY to that query? calling query.first() will return only the first result in an unordered list. It is essentially random. On 6/21/15 12:45 PM, Kevin Qiu wrote: I create a unit test that add new ProjApp object to the database, but the returned object shows it is n

[sqlalchemy] joined table inheritance child table query return different object after insertion

2015-06-21 Thread Kevin Qiu
I create a unit test that add new ProjApp object to the database, but the returned object shows it is not the same object inserted, I don't follow why it's like this because I have others tests on inserting a row to a different table, and returned shows the same row object. Test result:

[sqlalchemy] Retrieving ORM object while submitting WTForms

2015-06-21 Thread sudheesh ks
I am developing a blog application in flask. In html file to display posts there is option for commenting. But I am not able to retrieve the ORM object 'post' corrresponding to comment form while submitting form. My index.html file: {% extends "base.html" %}{% block content %} Hi, {{

[sqlalchemy] Retriving ORM object while submitting form

2015-06-21 Thread sudheesh ks
Please help with this question in stack overflow:http://stackoverflow.com/questions/30961876/how-to-retrieve-orm-object-in-scope-while-submitting-a-form-in-flask -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and s