开发者

How to perform an "UPDATE" with elixir

I'm using elixir/flask in a small web app I wrote for my own personal aggregator.

I'm trying to create a restful call to mark all items of a particular rssfeed as read.

The SQL statement would look something like UPDATE model_rssitems set hasbeenseen = 1 where rssfeed_id = '%s' % feedid

I don't know how to write the code to make elixir perform that 开发者_开发技巧action and when I tried to use session.execute I get an error saying UnboundExecutionError: Could not locate a bind configured on SQL expression or this Session

I'm sure I'm doing something wrong but I can't figure out what.


I assume you haven't used the bind expression yet :)

Your code requires something like this to tell Elixir what database you're using.

from elixir import metadata
metadata.bind = 'sqlite:///your_database_file.sqlite'
metadata.bind.echo = True
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜