On Aug 3, 2010, at 10:50 AM, Benjamin Peterson wrote:

> Is there a way to force the ORM to insert a new row instead of updating?
> Something like the must_insert argument to model's save method in Django's 
> ORM.
> The use case is I must create a unique session key (for a cookie) and want an
> error when the key isn't unique, so perhaps there's a better way?

Use make_transient().   

http://www.sqlalchemy.org/docs/reference/orm/sessions.html?highlight=make_transient#sqlalchemy.orm.session.make_transient

An example usage is at 
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/VersionedRows


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

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

Reply via email to