Re: Strange behavior with flask and sqlalchemy
- From:
- Dominique Schramm
- Date:
- 2012-10-11 @ 23:24
Hi there,
i found the answer: it was just an error with
sqlalchemy :( Now everything works perfectly.
Kind regards
> -----Original Message-----
> From: flask@librelist.com [mailto:flask@librelist.com] On Behalf Of
> Dominique Schramm
> Sent: Thursday, October 11, 2012 8:02 PM
> To: flask@librelist.com
> Subject: [flask] Strange behavior with flask and sqlalchemy
>
> Hi there,
>
> i am new to flask. Before flask I worked with bottle.
>
> My problem is, I think so, the understanding how flask
> works with sqlalchemy.
>
> I created a small Flask app for using it as a restful api.
> The inbound of sqlalchemy was made with this tutorial:
>
> http://flask.pocoo.org/docs/patterns/sqlalchemy/#sql-abstraction-layer
>
> I use only the abstraction layer, no orm and - I will still use
> the abstraction layer and don't want to move to the orm.
>
> If I start the application with python myapp.py and query the
> route with the browser I got a result:
>
> [{"faqentry_id": 1}, {"faqentry_id": 3}]
>
> This result ist from the database and correct. But if I change
> a value in the database, for example faq_entry = 3 -> 4 and
> query the route via the browser again I got:
>
> [{"faqentry_id": 1}, {"faqentry_id": 3}]
>
> and not
>
> [{"faqentry_id": 1}, {"faqentry_id": 4}]
>
> The correct result will only appear, if I restart the application,
> but this cannot be the right way, to restart always the application.
>
> Can you help me?
>
> Thanks and Cheers,
>
> Dominique
Re: Strange behavior with flask and sqlalchemy
- From:
- Steven Kryskalla
- Date:
- 2012-10-12 @ 00:04
On Thu, Oct 11, 2012 at 4:24 PM, Dominique Schramm <info@schramm.by> wrote:
> Hi there,
>
> i found the answer: it was just an error with
> sqlalchemy :( Now everything works perfectly.
>
In case anyone has the same problem in the future, can you explain
what your fix was?
I think this same issue has been posted on the list before, e.g. here:
http://flask.pocoo.org/mailinglist/archive/2012/8/27/flask-sqlalchemy-caching-results/
-Steve
Re: Strange behavior with flask and sqlalchemy
- From:
- Dominique Schramm
- Date:
- 2012-10-13 @ 06:22
Hi,
i am not sure whether my coding failure is the same as in the link
mentioned.
my fault was: instead of executing the query with the engine, I
executed it with the database.
right: engine.execute
false: db.execute
Cheers
> -----Original Message-----
> From: flask@librelist.com [mailto:flask@librelist.com] On Behalf Of
> Steven Kryskalla
> Sent: Friday, October 12, 2012 2:04 AM
> To: flask@librelist.com
> Subject: Re: [flask] Strange behavior with flask and sqlalchemy
>
> On Thu, Oct 11, 2012 at 4:24 PM, Dominique Schramm <info@schramm.by>
> wrote:
> > Hi there,
> >
> > i found the answer: it was just an error with
> > sqlalchemy :( Now everything works perfectly.
> >
>
> In case anyone has the same problem in the future, can you explain
> what your fix was?
>
> I think this same issue has been posted on the list before, e.g. here:
>
> http://flask.pocoo.org/mailinglist/archive/2012/8/27/flask-sqlalchemy-
> caching-results/
>
> -Steve