Hello, while I've just begun using SQLAlchemy, I already love it ^_^.
It's just missing one feature I'd really see in it, since it's an evergreen: consistent error handling. I can't find a tracker for this piece of software, so I don't know if it's already in the want list for 1.0. The basic idea is: errors may happen. Sometimes you will insert an illegal value (e.g. a string where a int column has been declared), or you will insert a duplicate value in a primary key column, or you may try inserting a non-existent value for a FK. Those behaviour will usually raise an error from the DB-adapter in use. It is especially useful if you're constructing a webapp or any other app where input may come from an untrusted user. Of course, you could use a parameter-checking utility, something like formencode, and bind it to the opportune methods of your user-specified types, but this will help on type mismatch only. I'm currently using psycopg 1.1.21 with pgsql 8.0.6, and it's not really 'informative': it usually raises a psycopg.ProgrammingError, and you need to parse the exception text in order to understand what's happened. I guess other databases and/or db-adapters (psycopg2 seems to use a wider number of errors) may be better. So: why shouldn't we let sqlalchemy catch most common errors and return an exception of its own? This would help handling multiple DB systems without the harass of parsing different exceptions. It's just a matter of thinking about what errors are worth catching (not-worth errors should be but in a generic category anyway, i.e. sqlalchemy.ProgrammingError, so you don't have to use the db adapter to catch it) There're of course tons of possible errors ( I think pgsql alone has more than 100 error codes), but some candidates may be: TypeMismatchError - type mismatch NotNullError - if trying to insert None in a NOT NULL column ForeignKeyError - if trying to insert a non-existent FK ID IntegrityError - trying to remove a referenced row UniqueError - if violating an Unique constraint. CheckError - generic check violation ConstraintError - generic constraint violation We should also think something about the accessible data of the exception instance, i.e. it should contain useful info to tell the user what's going on and help him track down the problem. -- Alan Franzoni <[EMAIL PROTECTED]> - Togli .xyz dalla mia email per contattarmi. To contact me, remove .xyz from my email address. - GPG Key Fingerprint: 5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ Sqlalchemy-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

