0

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.

Ben
  • 51,770
  • 36
  • 127
  • 149
Gekitsuu
  • 87
  • 1
  • 9

1 Answers1

1

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
Wolph
  • 78,177
  • 11
  • 137
  • 148
  • Well the metadata.bind exists in my model.py but not in the controller part of my code. I tried adding that line to the function for the page to update the rssitems but it produced the same error – Gekitsuu Nov 27 '10 at 04:03
  • @Gekitsuu: in that case you might have forgotten the `elixir.setup_all()` call at the bottom of the models file. – Wolph Nov 27 '10 at 04:07
  • I have setup_all() and create_all() at the bottom of my model.py – Gekitsuu Nov 27 '10 at 04:11
  • @Gekitsuu: in that case I can't really think of a reason why it shouldn't work. Just maybe it's not working because of some other elixir imports or something, but that's just a wild guess. – Wolph Nov 27 '10 at 04:15