From dieter at handshake.de Sun Jul 1 13:21:10 2007 From: dieter at handshake.de (Dieter Maurer) Date: Sun, 1 Jul 2007 13:21:10 +0200 Subject: [DB-SIG] what is: backwards compatibility In-Reply-To: <467EA7DD.6090105@personnelware.com> References: <467A92EE.5070207@personnelware.com> <467EA7DD.6090105@personnelware.com> Message-ID: <18055.36390.640540.275925@gargle.gargle.HOWL> Carl Karsten wrote at 2007-6-24 12:20 -0500: >I'm still trying to come up with a set of possible meanings for backwards >compatibility, something like > >doesn't break: > >any existing code >any conceivable code >reasonable code >code that conforms to any documentation found, including module code. >code that conforms to the docs bundled with the module +1 >code that conforms to the docs found under python.org +1 >code that conforms to pep 249 +1 -- Dieter From vernondcole at gmail.com Thu Jul 12 20:13:44 2007 From: vernondcole at gmail.com (Vernon Cole) Date: Thu, 12 Jul 2007 12:13:44 -0600 Subject: [DB-SIG] adodbapi version 2.1 released. Message-ID: Hello. My name is Vernon, and I am a python-oholic. I needed a MS-SQL api which would return decimal data from a numeric (currency) column, so I made one. That may have been a bad decision, because it has resulted in me becoming the new admin for the adodbapi project on sourceforge. (Like I didn't have enough to do.) Here goes... adobpapi is a DB-API 2.0 compliant module, written in pure python, which uses Microsoft ADO to connect with data sources. Version 2.1 includes all of the patches and bug fixes I could locate, and incorporates all of the feature requests I could get in. My new work consists of modification of the method used to return values from currency and numeric columns. They are now returned as Decimal values, rather than floats. I also cleaned up the "execute helper" routine so that it is implemented in a more straight-forward manner. (Those of you who have looked at the source code will know what I mean.) The new version is available at http://www.sourceforge.net/projects/adodbapi . I have not updated the source code on the CVS, yet, (must learn that first) so just read the source from the zip file. There is limited documentation, a set of unit tests, and a small sample script in the zip. This release has been tested against Python 2.3 and 2.5 on Windows 2000, Python 2.4 and 2.5 on XP, and Python 2.4 on Windows 2003 server -- all using Access and Microsoft SQL server -- and against mySQL with Python 2.5 and XP. My future goals for this project are: Inclusion in the release package of pywin32. (Thanks to Mark Hammond for this.) Inclusion in a future release of FePy (for Iron Python.) Better support for SQLalchemy. Full support of STORM. (Storm is the new object-relational mapper from Canonical, https://storm.canonical.com , which I want to use on Windows, which is why I need to support it ...) -- Vernon Cole kf7xm at users.sourceforge.net Peppermill Casinos, Inc. http://wendoverfun.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/db-sig/attachments/20070712/03890131/attachment.html From mal at egenix.com Fri Jul 13 10:43:57 2007 From: mal at egenix.com (M.-A. Lemburg) Date: Fri, 13 Jul 2007 10:43:57 +0200 Subject: [DB-SIG] adodbapi version 2.1 released. In-Reply-To: References: Message-ID: <46973B4D.6090407@egenix.com> On 2007-07-12 20:13, Vernon Cole wrote: > Hello. > My name is Vernon, and I am a python-oholic. > I needed a MS-SQL api which would return decimal data from a numeric > (currency) column, so I made one. That may have been a bad decision, > because > it has resulted in me becoming the new admin for the adodbapi project on > sourceforge. (Like I didn't have enough to do.) Here goes... FWIW: You could have used mxODBC 3.0 which support fetching numeric data as decimals out of the box. Would have probably saved you a few hours work, I guess :-) -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jul 13 2007) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From v-nijs at kellogg.northwestern.edu Fri Jul 20 16:17:15 2007 From: v-nijs at kellogg.northwestern.edu (Vincent Nijs) Date: Fri, 20 Jul 2007 09:17:15 -0500 Subject: [DB-SIG] Pickle and sqlite - loading and saving recarray's In-Reply-To: Message-ID: I posted the message below on the numpy discussion list. Few if any people there seem to use sqlite. I am interesting in using sqlite to store data for scientific research. I wrote the attached test program to save and load a simulated 11x500,000 recarray. Average save and load times are given below (timeit with 20 repetitions). The save time for sqlite is not really fair because I have to delete the data table each time before I create the new one. It is still pretty slow in comparison. Loading the recarray from sqlite is significantly slower than cPickle. I am hoping there may be more efficient ways to save and load recarray?s from/to sqlite than what I am now doing. Note that I infer the variable names and types from the data rather than specifying them manually. saving recarray with cPickle: 1.448568 sec/pass saving recarray with sqlite: 193.286204 sec/pass loading recarray using cPickle: 0.471365 sec/pass loading recarray with sqlite: 15.977018 sec/pass To run the test you do need numpy (http://www.scipy.org/Download) Best, Vincent -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/db-sig/attachments/20070720/a6e8e33b/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: load_sqlite_test.py Type: application/octet-stream Size: 3391 bytes Desc: not available Url : http://mail.python.org/pipermail/db-sig/attachments/20070720/a6e8e33b/attachment.obj From andy47 at halfcooked.com Sat Jul 21 14:02:15 2007 From: andy47 at halfcooked.com (Andy Todd) Date: Sat, 21 Jul 2007 22:02:15 +1000 Subject: [DB-SIG] Other extensions In-Reply-To: <7C1B5950-163A-4BCF-92EF-CC9356CFE6A0@zzzcomputing.com> References: <435DF58A933BA74397B42CDEB8145A860BFCF8AE@ex9.hostedexchange.local> <7C1B5950-163A-4BCF-92EF-CC9356CFE6A0@zzzcomputing.com> Message-ID: <46A1F5C7.5060504@halfcooked.com> Michael Bayer wrote: > 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 at python.org > http://mail.python.org/mailman/listinfo/db-sig Stuart Bishop did some work a couple of years ago as part of the Gadfly project. You can see the test code via CVS here; http://gadfly.cvs.sourceforge.net/gadfly/gadfly/test/dbapi20.py?view=log It could be used as a starting point for a compliance test suite. An idea I think should certainly be given some serious consideration. Regards, Andy -- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ From carsten at uniqsys.com Mon Jul 23 19:32:27 2007 From: carsten at uniqsys.com (Carsten Haese) Date: Mon, 23 Jul 2007 13:32:27 -0400 Subject: [DB-SIG] Article about performing queries with parameters Message-ID: <1185211947.3378.13.camel@dot.uniqsys.com> Hiya all: I apologize in advance for tooting my own horn, but maybe there are people on this list who find this valuable. I write a blog about developing Informix applications in Python, whenever my spare time permits, and the current edition covers how to perform queries with variable parameters. This may be a good place to point the next newbie who stuffs values into a query with %s. The article has a slight InformixDB slant, but the basic ideas apply to other DB-API modules. Here's the link to the article: http://informixdb.blogspot.com/2007/07/filling-in-blanks.html Best regards, -- Carsten Haese http://informixdb.sourceforge.net From anthony.tuininga at gmail.com Thu Jul 26 16:24:07 2007 From: anthony.tuininga at gmail.com (Anthony Tuininga) Date: Thu, 26 Jul 2007 08:24:07 -0600 Subject: [DB-SIG] ceODBC 1.0 Message-ID: <703ae56b0707260724y654f1fefw8409a9e75d639e81@mail.gmail.com> What is ceODBC? ceODBC is a Python extension module that enables access to databases using the ODBC API and conforms to the Python database API 2.0 specifications with a few exceptions. I have tested this on Windows against SQL Server, Access and Oracle. On Linux I have tested this against PostgreSQL. Where do I get it? http://ceodbc.sourceforge.net Background I recently had the need for accessing SQL Server and Access databases and checked out the available options. The odbc module that comes with the win32 extensions worked reasonably well but it had a number of deficiencies and it was clear from the documentation that no further work was intended. I then checked out mxODBC. It is a great module but for my purposes the cost was too great to warrant purchasing it. I decided to see how much effort writing my own module would take and discovered that, with a copy of cx_Oracle as a starting point, the effort was minimal. With the hope that this module might prove useful to others as it already has to me, I am making this release. Any and all feedback welcome. Anthony Tuininga From phd at phd.pp.ru Thu Jul 26 16:30:49 2007 From: phd at phd.pp.ru (Oleg Broytmann) Date: Thu, 26 Jul 2007 18:30:49 +0400 Subject: [DB-SIG] SQLObject 0.8.5 Message-ID: <20070726143048.GG30176@phd.pp.ru> Hello! I'm pleased to announce the 0.8.5 release of SQLObject. What is SQLObject ================= SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use and quick to get started with. SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite, and Firebird. It also has newly added support for Sybase, MSSQL and MaxDB (also known as SAPDB). Where is SQLObject ================== Site: http://sqlobject.org Development: http://sqlobject.org/devel/ Mailing list: https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss Archives: http://news.gmane.org/gmane.comp.python.sqlobject Download: http://cheeseshop.python.org/pypi/SQLObject/0.8.5 News and changes: http://sqlobject.org/News.html What's New ========== News since 0.8.4 ---------------- Bug Fixes ~~~~~~~~~ * Replaced calls to style.dbColumnToPythonAttr() in joins.py by name/dbName lookup in case the user named columns differently using dbName. * Minor correction in the tests: we fully support EnumCol in Postgres. * MySQLConnection now recognizes Enum, Double and Time columns when drawing the database scheme from DB. * Minor fix in FirebirdConnection.fromDatabase. * Fixed a bug with default field values for columns for firebird connection. * Prevent a deadlock in declarative.threadSafeMethod() by not reacquiring the class lock. * Run post_funcs after sending RowCreatedSignal. * Suppress the second RowUpdateSignal in .set() called from ._SO_setValue(). * Fixed a bug in col.createSQL(). * Fixed a bug in converting date/time for years < 1000 (time.strptime() requires exactly 4 digits for %Y, hence a year < 1000 must be 0-padded). Other Changes ~~~~~~~~~~~~~ * Changed string quoting style for PostgreSQL and MySQL from \' to ''. For a more complete list, please see the news: http://sqlobject.org/News.html Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From phd at phd.pp.ru Thu Jul 26 16:36:42 2007 From: phd at phd.pp.ru (Oleg Broytmann) Date: Thu, 26 Jul 2007 18:36:42 +0400 Subject: [DB-SIG] SQLObject 0.9.1 Message-ID: <20070726143642.GJ30176@phd.pp.ru> Hello! I'm pleased to announce the 0.9.1 release of SQLObject. What is SQLObject ================= SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use and quick to get started with. SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite, and Firebird. It also has newly added support for Sybase, MSSQL and MaxDB (also known as SAPDB). Where is SQLObject ================== Site: http://sqlobject.org Development: http://sqlobject.org/devel/ Mailing list: https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss Archives: http://news.gmane.org/gmane.comp.python.sqlobject Download: http://cheeseshop.python.org/pypi/SQLObject/0.9.1 News and changes: http://sqlobject.org/News.html What's New ========== News since 0.9.0 ---------------- Bug Fixes ~~~~~~~~~ * Replaced calls to style.dbColumnToPythonAttr() in joins.py by name/dbName lookup in case the user named columns differently using dbName. * Minor correction in the tests: we fully support EnumCol in Postgres. * MySQLConnection now recognizes Enum, Double and Time columns when drawing the database scheme from DB. * Fixed misspelled methods in col.py. * Minor fix in FirebirdConnection.fromDatabase. * Fixed a bug with default field values for columns for firebird connection. * Prevent a deadlock in declarative.threadSafeMethod() by not reacquiring the class lock. * Run post_funcs after sending RowCreatedSignal. * Suppress the second RowUpdateSignal in .set() called from ._SO_setValue(). * Fixed a bug in col.createSQL(). * Fixed a bug in converting date/time for years < 1000 (time.strptime() requires exactly 4 digits for %Y, hence a year < 1000 must be 0-padded). Other Changes ~~~~~~~~~~~~~ * Changed string quoting style for PostgreSQL and MySQL from \' to ''. For a more complete list, please see the news: http://sqlobject.org/News.html Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From phd at phd.pp.ru Thu Jul 26 16:23:38 2007 From: phd at phd.pp.ru (Oleg Broytmann) Date: Thu, 26 Jul 2007 18:23:38 +0400 Subject: [DB-SIG] SQLObject 0.7.8 Message-ID: <20070726142338.GD30176@phd.pp.ru> Hello! I'm pleased to announce the 0.7.8 release of SQLObject. What is SQLObject ================= SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use and quick to get started with. SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite, and Firebird. It also has newly added support for Sybase, MSSQL and MaxDB (also known as SAPDB). Where is SQLObject ================== Site: http://sqlobject.org Mailing list: https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss Archives: http://news.gmane.org/gmane.comp.python.sqlobject Download: http://cheeseshop.python.org/pypi/SQLObject/0.7.8 News and changes: http://sqlobject.org/docs/News.html What's New ========== News since 0.7.7 ---------------- Bug Fixes ~~~~~~~~~ * Replaced calls to style.dbColumnToPythonAttr() in joins.py by name/dbName lookup in case the user named columns differently using dbName. * Minor correction in the tests: we fully support EnumCol in Postgres. * MySQLConnection now recognizes Enum, Double and Time columns when drawing the database scheme from DB. * Minor fix in FirebirdConnection.fromDatabase. * Fixed a bug with default field values for columns for firebird connection. * Prevent a deadlock in declarative.threadSafeMethod() by not reacquiring the class lock. * Fixed a bug in col.createSQL(). * Fixed a bug in converting date/time for years < 1000 (time.strptime() requires exactly 4 digits for %Y, hence a year < 1000 must be 0-padded). Other Changes ~~~~~~~~~~~~~ * Changed string quoting style for PostgreSQL and MySQL from \' to ''. For a more complete list, please see the news: http://sqlobject.org/docs/News.html Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From ramonllari16359 at itc.nl Fri Jul 27 11:19:44 2007 From: ramonllari16359 at itc.nl (Ervin Ramonllari) Date: Fri, 27 Jul 2007 11:19:44 +0200 Subject: [DB-SIG] Running shp2pgsql from Python Message-ID: Hello all, I' trying to run PostGIS Loader (shp2pgsql) from python using the following syntax: import os os.execv('mydir/shp2pgsql.exe', args) *args is a list of arguments, the same as I pass them using cmd.exe Is it correct or I'm doing sth wrong because it runs but there is no result, no error either? Any help would be really appreciated :-) Cheers, Ervin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/db-sig/attachments/20070727/f930fd3f/attachment.html From fumanchu at aminus.org Sun Jul 29 05:57:22 2007 From: fumanchu at aminus.org (Robert Brewer) Date: Sat, 28 Jul 2007 20:57:22 -0700 Subject: [DB-SIG] Running shp2pgsql from Python References: Message-ID: <9BBC2D2B2CCF7E4DA0E212D1BD0CC6FA1FEE7B@ex10.hostedexchange.local> Ervin Ramonllari wrote: > import os > os.execv('mydir/shp2pgsql.exe', args) > > *args is a list of arguments, the same as I pass them using cmd.exe >From the docs on os.execv: "In either case, the arguments to the child process should start with the name of the command being run, but this is not enforced." Are you doing that? e.g.: cmd = 'mydir/shp2pgsql.exe' os.execv(cmd, [cmd] + args) Robert Brewer fumanchu at aminus.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/db-sig/attachments/20070728/5b1301e8/attachment.html From ramonllari16359 at itc.nl Mon Jul 30 11:00:32 2007 From: ramonllari16359 at itc.nl (Ervin Ramonllari) Date: Mon, 30 Jul 2007 11:00:32 +0200 Subject: [DB-SIG] Running shp2pgsql from Python Message-ID: Hello all, thank you for your answer. I resolve that problem in this way import os cmd='dir/sh2pgsql.exe ' + option + shpafile + ' > '+ sqlfile os.system(cmd) option - one of the options accepted by shp2pgsql, it can be ommited, by default is '-c' shpafile - full path of shape file sqlfile - full path of sql file that will be written Regards, Ervin