Hi,

I'm new to SQLAlchemy, and I was wondering if there's a way to test a
condition while inserting.  I'm trying to make my application use as
few separate queries at the same time as possible.  Here's a couple
cases I have had issues with:
Inserting something with a unique column if it doesn't exist.  Right
now, I am doing a select with a count() call.
If I just insert it if it already exists I get an exception, but the
exception doesn't propogate until the session is flushed.  Also, I am
having a tough time catching the SQLAlchemy exceptions.  What's the
best way to go about this?
I have a join table where you have tags and things, and the join table
tags the things.  I want to test if it already exists and whatnot, and
insert it in the same query if it doesn't.

Are there any good articles on optimizing your SQL queries and such?

Thanks,
Mike Lewis


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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