Hi all,
I'm starting to have a look at sqlalchemy and Flask and have a problem I
can't figure out. I have a set of models and am trying to play with the
corresponding database in a python console. Here is my models file:
http://snipurl.com/297pxcw
The following query will execute as expected and return a list of Series
objects, as present in the database
from book_catalog import models, db
series = models.Series.query.all()
for serie in series:
print serie.id, serie.name
1 Nikopol
But executing the following query will return an error:
nikopol = models.Series.query.filter(Series.name == 'Nikopol')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'Series' is not defined
I tried the following, which is executing, but returning a Query object
(not exactly what I'm trying to do ;) )
nikopol = models.Series.query.filter(models.Series.name == 'Nikopol')
print nikopol
SELECT series.id AS series_id, series.name AS series_name
FROM series
WHERE series.name = :name_1
Can anyone explain what I'm doing wrong here? I'm using SqlAlchemy 0.9.7
sqlalchemy.__version__
'0.9.7'
Thanks a lot in advance.
Gilles
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.