On May 15, 2007, at 3:29 PM, Michael Bayer wrote: > DBAPI needs to remain as the most minimal layer of standardization > possible (and i think it should remain about SQL. to support other > query languages would invariably require much richer APIs)...it just > would be nice to iron out the API variances in implementations a > little better...particularly things like dates, floats/Decimal, more > accurate method specifications (like explictly requiring the named > argument "size" when the spec says "fetchmany(size=x)"), expected > return results of execute()/executemany(), unicode. >
also on this subject, has there been any thought given to creating a DBAPI "compliance test" suite ? one that does all the regular things a DBAPI should provide and produces a report of what percentage of required functionality is met ? this would be something you could send to a DBAPI author to...erm "encourage" him or her to get in line with a standard methodology rather than making arbitrary decisions. the current PEP does seem to encourage editorializing so its not all their fault. examples would include: - update several rows of a table, where not all rows actually get modified. ensure that cursor.rowcount meets the number of rows matched (not only those modified). MySQLDB will fail this unless a special argument is sent to connect(). check that it works for executemany() too (most DBAPIs dont seem to get this one right). - test all the functions (like fetchmany(), etc.) using named arguments as well as positional arguments. several DBAPIs dont recognize the named parameter "size" to fetchmany() for example, other DBAPIs choke when "parameters" is not present on execute(). - test that all required types (e.g. Binary, Timestamp, etc.) are present. cx_Oracle doesnt provide Binary for example (even though it has plenty of binary support?!) - test that the return result of a BLOB/CLOB/binary column is a python buffer (cx_Oracle returns the surprising LOB object, MySQLDB returns a non-buffer object). of course this would be better suited if words like "preferred" were replaced with "expected" in the PEP. - test that cursor.description works immediately (psycopg2 has special requirements in this regard when using server-side cursors) - test that an OperationalError is raised immediately upon execute (), cursor(), etc. when the database has been disconnected (theyre all over the map on this one). _______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig