Am 26.02.2011 um 01:31 schrieb Magnus Pettersson:

Just tested the tips:
Library.query.filter_by(media["path"]).items.append(item)

but i get TypeError: filter_by() takes exactly 1 argument (2 given)

Yeah, because I forgot the parameter name "path"

filter_by(path=...).first()

The first was also missing.



Oh what the heck, while im writing here, should i use the filter_by function (when i get this to work) to see if i get empty list to check if a Item already exists (matching primary keys) before i create the new Item instance (otherwise i get exception) or is it just best to just do a try except block?

No, checking first - the try/except could make the current transaction invalid.

Diez

--
You received this message because you are subscribed to the Google Groups 
"SQLElixir" 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/sqlelixir?hl=en.

Reply via email to