it depends on who is generating the error. in 0.3.0 we have some more automated code for reconciling two objects, one of which is deleted and the other saved, with the same primary key value. this is handy for association object mappings in particular. so when detecting an invalid condition related to that, it raises a FlushError, which is an error that was raised without issuing any SQL to the database. Whereas a SQLError is always generated by the database in response to a SQL execution, and someday we hope to even have the databases' error codes attached to those as well (which is hard becuase none of the DBAPIs seem to support this, with the possible exception of psycopg which doesnt document it).
I dont think its appropriate for a non-SQL operation to raise a SQLError. also for the flush-time SQLErrors to be FlushErrors, we'd have to wrap one inside the other. which seems a little weird to me since we arent wrapping any other kind of errors into FlushError. the only solution i can see is that we dont actually raise the FlushError when we detect that condition and just let the bad primary key go through. but that doenst fix anything beyond this issue; im sure theres a lot of other conditions that are on the borderline between being detected at organization time vs. sql execution time. On Nov 10, 2006, at 11:18 PM, Sol wrote: > > Hello list, > while migrating from 0.2.8 to 0.3.0 I realized some changes in (error > raising) behavior. > > If you try to flush an object with a duplicated primary key and the > object > (the one that existed first!) is in your session you get a FlushError > (previously you got SQLError). > > If you do the same with the other object not in your session you > get a SQLError. > > If you try to flush with a conflicts due to an unique constraint > you alway > get a SQLError. > > Bug or feature? > -- > Cheers, Sol. > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
