How about just a:

cities = session.query(City).all()
for city in cities:
    session.delete(city)

or

for city in session.query(City):   #actually fires the query
    session.delete(city)

or even (never tried that, read from the docs):

session.query(City).delete()

Alex

2010/2/26 Marcin Krol <[email protected]>:
> Hello Michael,
>
> When I do:
>
>    cities = session.query(City).all()
>    session.delete(cities)
>
> I get:
>
> sqlalchemy.orm.exc.UnmappedInstanceError: Class '__builtin__.list' is not
> mapped
>
> Unless it's some sort of a problem, it would be nifty of SQLAlchemy to be
> able to add/delete in a session a list of SQA-mapped objects: from the POV
> of a noob like me just using this engine as a sort of 'black box' it would
> be rather logical.
>
> Regards,
> mk
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>
>



-- 
Alex
twitter.com/alexconrad

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to