views:

31

answers:

1

In this tutorial it says (http://www.rmunn.com/sqlalchemy-tutorial/tutorial.html) to select all rows of an entity like:

s = products.select()
rs = s.execute()

I get an error saying:

This select object is not bound and does not support direct execution ...

Do I need to reference the session object?

I just want to get all rows in my products table (i've already mapped everything, and I already inserted thousands of rows so that part works)

+2  A: 

Since that tutorial is built for SQLALchemy 0.2, it is likely that you aren't using that old of a version. In the latest documentation using the connection and passing the select statement to it is the preferred method. Try this instead:

query = users.select()
result = conn.execute(query)

Ref: http://www.sqlalchemy.org/docs/05/sqlexpression.html#selecting

excid3