From info at egenix.com Thu Jan 29 09:38:15 2009 From: info at egenix.com (eGenix Team: M.-A. Lemburg) Date: Thu, 29 Jan 2009 09:38:15 +0100 Subject: [DB-SIG] ANN: eGenix mx Base Distribution 3.1.2 Message-ID: <49816AF7.6070501@egenix.com> ________________________________________________________________________ ANNOUNCING eGenix.com mx Base Distribution Version 3.1.2 for Python 2.3 - 2.6 Open Source Python extensions providing important and useful services for Python programmers. This announcement is also available on our web-site for online reading: http://www.egenix.com/company/news/eGenix-mx-Base-Distribution-3.1.2-GA.html ________________________________________________________________________ ABOUT The eGenix.com mx Base Distribution for Python is a collection of professional quality software tools which enhance Python's usability in many important areas such as fast text searching, date/time processing and high speed data types. The tools have a proven record of being portable across many Unix and Windows platforms. You can write applications which use the tools on Windows and then run them on Unix platforms without change due to the consistent platform independent interfaces. Contents of the distribution: * mxDateTime - Date/Time Library for Python * mxTextTools - Fast Text Parsing and Processing Tools for Python * mxProxy - Object Access Control for Python * mxBeeBase - On-disk B+Tree Based Database Kit for Python * mxURL - Flexible URL Data-Type for Python * mxUID - Fast Universal Identifiers for Python * mxStack - Fast and Memory-Efficient Stack Type for Python * mxQueue - Fast and Memory-Efficient Queue Type for Python * mxTools - Fast Everyday Helpers for Python All available packages have proven their stability and usefulness in many mission critical applications and various commercial settings all around the world. For more information, please see the distribution page: http://www.egenix.com/products/python/mxBase/ ________________________________________________________________________ NEWS The 3.1.2 release of the eGenix mx Base Distribution is the latest release of our open-source Python extensions. We have fixed a number of small platform issues and added support for the strptime() function to mxDateTime on Windows. We have also enhanced the portability of our pre-built Mac OS X binaries. As always, we are providing pre-built binaries for all supported platforms, currently: Windows 32-bit, Linux 32-bit, Linux 64-bit, FreeBSD 32-bit, FreeBSD 64-bit, Mac OS X 32-bit Intel and PPC. Whether you are using a pre-built package or the source distribution, installation is a simple "python setup.py install" command in all cases. The only difference is that the pre-built packages do not require a compiler to be installed. For a list of changes, please refer to the eGenix mx Base Distribution change log at http://www.egenix.com/products/python/mxBase/changelog.html and the change logs of the various included Python packages. ________________________________________________________________________ DOWNLOADS The download archives and instructions for installing the packages can be found on the eGenix mx Base Distribution page: http://www.egenix.com/products/python/mxBase/ ________________________________________________________________________ LICENSE The eGenix mx Base package is distributed under the eGenix.com Public License 1.1.0 which is an Open Source license similar to the Python license. You can use the packages in both commercial and non-commercial settings without fee or charge. The package comes with full source code ________________________________________________________________________ SUPPORT Commercial support for this product is available from eGenix.com. Please see http://www.egenix.com/services/support/ for details about our support offerings. Enjoy, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jan 29 2009) >>> 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 our new mxODBC.Connect Python Database Interface 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 http://www.egenix.com/company/contact/ From vernondcole at gmail.com Thu Jan 29 19:25:36 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Thu, 29 Jan 2009 11:25:36 -0700 Subject: [DB-SIG] ANN: eGenix mx Base Distribution 3.1.2 In-Reply-To: <49816AF7.6070501@egenix.com> References: <49816AF7.6070501@egenix.com> Message-ID: Dear eGenix Team: >>> import mx.DateTime >>> import datetime >>> md = mx.DateTime.Timestamp(1950,6,12,12,30,0) >>> dd = datetime.datetime(1950,6,12,12,30,0) >>> if md == dd: print 'It works!' ... It works! Thank you on behalf of adodbapi users everywhere who's programs will no longer mysteriously raise errors when they install mx Base (and, by default, suddenly start getting SQL date-time values of an entirely different type). -- Vernon Cole -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Thu Jan 29 20:15:23 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Thu, 29 Jan 2009 12:15:23 -0700 Subject: [DB-SIG] PEP 249 in obsolete for Python 3000 Message-ID: I am busy hacking on code in an attempt to make adodbapi actually work in three environments: CPython 2.3 to 2.6, CPython 3.0, and IronPython. One of the first things that failed, when attempting to run on Python 3.0, was the test for exception definitions. I quote: The module should make all error information available through > these exceptions or subclasses thereof: > > Warning > > Exception raised for important warnings like data > truncations while inserting, etc. It must be a subclass of > the Python StandardError (defined in the module > exceptions). > > Error > > Exception that is the base class of all other error > exceptions. You can use this to catch all errors with one > single 'except' statement. Warnings are not considered > errors and thus should not use this class as base. It must > be a subclass of the Python StandardError (defined in the > module exceptions). > This is impossible with Python 3.0, since there is neither an "exceptions" module nor a "StandardError". Mark Hammond provided the following workaround: try: > from exceptions import StandardError as _BaseException > except ImportError: > # py3k > _BaseException = Exception > > class Error(_BaseException): > pass > > class Warning(_BaseException): > pass > This makes the code work fine, except that, by strict definition, it violates the api. So it would seem that we need to also patch the PEP. How is that done? -- Vernon Cole -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex at moreati.org.uk Thu Jan 29 21:15:52 2009 From: alex at moreati.org.uk (Alex Willmer) Date: Thu, 29 Jan 2009 20:15:52 +0000 Subject: [DB-SIG] Reuse of DB-API 2.0 cursors for multiple queries? Message-ID: <425e93af0901291215lf011736w7f8af1e558ec3061@mail.gmail.com> (Reposted to DB-SIG from clp) This week, I used the adodbapi module against an SQL Server Express database. I was surprised to get an exception, when I attempted to submit a second query with my cursor object. The full session is below. With cx_Oracle I've become used to reusing a cursor for subsequent queries. The PEP doesn't specify either way, that I can see. Is this behaviour left to the implementation, or should I be able to expect a cursor is reusable? With thanks, Alex Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import adodbapi >>> conn = adodbapi.connect('Provider=SQLOLEDB.1;Data Source=.\\SQLEXPRESS;Initial Catalog=MYDATABBASE;Integrated Security=SSPI;User Instance=False;') >>> curs = conn.cursor() >>> curs.execute('select * from localview_roles') >>> curs.execute('select * from localview_roles') Traceback (most recent call last): File "", line 1, in File "C:\Python25\Lib\site-packages\adodbapi\adodbapi.py", line 713, in execut e self._executeHelper(operation,False,parameters) File "C:\Python25\Lib\site-packages\adodbapi\adodbapi.py", line 664, in _execu teHelper self._raiseCursorError(DatabaseError,tracebackhistory) File "C:\Python25\Lib\site-packages\adodbapi\adodbapi.py", line 474, in _raise CursorError eh(self.conn,self,errorclass,errorvalue) File "C:\Python25\Lib\site-packages\adodbapi\adodbapi.py", line 60, in standar dErrorHandler raise errorclass(errorvalue) adodbapi.adodbapi.DatabaseError: --ADODBAPI Traceback (most recent call last): File "C:\Python25\Lib\site-packages\adodbapi\adodbapi.py", line 650, in _exec uteHelper adoRetVal=self.cmd.Execute() File "", line 3, in Execute File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", line 258, in _ApplyTypes_ result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, retType, argTypes ) + args) com_error: (-2147352567, 'Exception occurred.', (0, u'Microsoft OLE DB Provider for SQL Server', u'Cannot create new connection because in manual or distribute d transaction mode.', None, 0, -2147467259), None) -- on command: "select * from localview_roles" -- with parameters: None -------------- next part -------------- An HTML attachment was scrubbed... URL: From mal at egenix.com Thu Jan 29 21:44:49 2009 From: mal at egenix.com (M.-A. Lemburg) Date: Thu, 29 Jan 2009 21:44:49 +0100 Subject: [DB-SIG] Reuse of DB-API 2.0 cursors for multiple queries? In-Reply-To: <425e93af0901291215lf011736w7f8af1e558ec3061@mail.gmail.com> References: <425e93af0901291215lf011736w7f8af1e558ec3061@mail.gmail.com> Message-ID: <49821541.2050908@egenix.com> On 2009-01-29 21:15, Alex Willmer wrote: > (Reposted to DB-SIG from clp) > > This week, I used the adodbapi module against an SQL Server Express > database. I was surprised to get an exception, when I attempted to > submit a second query with my cursor object. The full session is > below. > > With cx_Oracle I've become used to reusing a cursor for subsequent > queries. The PEP doesn't specify either way, that I can see. Is this > behaviour left to the implementation, or should I be able to expect a > cursor is reusable? This should be possible. In fact the statement caching mechanism outlined in the DB-API spec relies on this: if you pass in the same query twice, the module can opt to reuse the already prepared statement. mxODBC works that way and we've been using this mechanism to cache pre-prepared cursors for common queries in our apps for years. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jan 29 2009) >>> 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 our new mxODBC.Connect Python Database Interface 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 http://www.egenix.com/company/contact/ From mal at egenix.com Thu Jan 29 21:47:03 2009 From: mal at egenix.com (M.-A. Lemburg) Date: Thu, 29 Jan 2009 21:47:03 +0100 Subject: [DB-SIG] PEP 249 in obsolete for Python 3000 In-Reply-To: References: Message-ID: <498215C7.8010506@egenix.com> On 2009-01-29 20:15, Vernon Cole wrote: > I am busy hacking on code in an attempt to make adodbapi actually work in > three environments: CPython 2.3 to 2.6, CPython 3.0, and IronPython. One of > the first things that failed, when attempting to run on Python 3.0, was the > test for exception definitions. I quote: > > The module should make all error information available through >> these exceptions or subclasses thereof: >> >> Warning >> >> Exception raised for important warnings like data >> truncations while inserting, etc. It must be a subclass of >> the Python StandardError (defined in the module >> exceptions). >> >> Error >> >> Exception that is the base class of all other error >> exceptions. You can use this to catch all errors with one >> single 'except' statement. Warnings are not considered >> errors and thus should not use this class as base. It must >> be a subclass of the Python StandardError (defined in the >> module exceptions). >> > > This is impossible with Python 3.0, since there is neither an "exceptions" > module nor a "StandardError". True, but that's render the whole PEP 249 obsolete ;-) Mark's proposal is the correct approach for Python 3.x (and as a matter of fact, the generally accepted way of porting apps using StandardError to Python 3.x, AFAIK). I'll add a note to the PEP. > Mark Hammond provided the following workaround: > > try: >> from exceptions import StandardError as _BaseException >> except ImportError: >> # py3k >> _BaseException = Exception >> >> class Error(_BaseException): >> pass >> >> class Warning(_BaseException): >> pass >> > > This makes the code work fine, except that, by strict definition, it > violates the api. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jan 29 2009) >>> 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 our new mxODBC.Connect Python Database Interface 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 http://www.egenix.com/company/contact/ From info at egenix.com Thu Jan 29 21:49:03 2009 From: info at egenix.com (eGenix Team: M.-A. Lemburg) Date: Thu, 29 Jan 2009 21:49:03 +0100 Subject: [DB-SIG] ANN: eGenix mx Base Distribution 3.1.2 In-Reply-To: References: <49816AF7.6070501@egenix.com> Message-ID: <4982163F.50507@egenix.com> On 2009-01-29 19:25, Vernon Cole wrote: > Dear eGenix Team: > >>>> import mx.DateTime >>>> import datetime >>>> md = mx.DateTime.Timestamp(1950,6,12,12,30,0) >>>> dd = datetime.datetime(1950,6,12,12,30,0) >>>> if md == dd: print 'It works!' > ... > It works! > > Thank you on behalf of adodbapi users everywhere who's programs will no > longer mysteriously raise errors when they install mx Base (and, by default, > suddenly start getting SQL date-time values of an entirely different type). FWIW: The above has worked ever since we released egenix-mx-base 3.0 in May 2007. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jan 29 2009) >>> 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 our new mxODBC.Connect Python Database Interface 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 http://www.egenix.com/company/contact/ From andy47 at halfcooked.com Thu Jan 29 22:05:47 2009 From: andy47 at halfcooked.com (Andy Todd) Date: Fri, 30 Jan 2009 08:05:47 +1100 Subject: [DB-SIG] Reuse of DB-API 2.0 cursors for multiple queries? In-Reply-To: <49821541.2050908@egenix.com> References: <425e93af0901291215lf011736w7f8af1e558ec3061@mail.gmail.com> <49821541.2050908@egenix.com> Message-ID: <49821A2B.4020704@halfcooked.com> M.-A. Lemburg wrote: > On 2009-01-29 21:15, Alex Willmer wrote: >> (Reposted to DB-SIG from clp) >> >> This week, I used the adodbapi module against an SQL Server Express >> database. I was surprised to get an exception, when I attempted to >> submit a second query with my cursor object. The full session is >> below. >> >> With cx_Oracle I've become used to reusing a cursor for subsequent >> queries. The PEP doesn't specify either way, that I can see. Is this >> behaviour left to the implementation, or should I be able to expect a >> cursor is reusable? > > This should be possible. In fact the statement caching mechanism outlined > in the DB-API spec relies on this: if you pass in the same query twice, > the module can opt to reuse the already prepared statement. > In that case shouldn't the DB-API be amended to say this? After all "explicit is better than implicit". Regards, Andy -- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ From mal at egenix.com Thu Jan 29 22:07:14 2009 From: mal at egenix.com (M.-A. Lemburg) Date: Thu, 29 Jan 2009 22:07:14 +0100 Subject: [DB-SIG] Reuse of DB-API 2.0 cursors for multiple queries? In-Reply-To: <49821A2B.4020704@halfcooked.com> References: <425e93af0901291215lf011736w7f8af1e558ec3061@mail.gmail.com> <49821541.2050908@egenix.com> <49821A2B.4020704@halfcooked.com> Message-ID: <49821A82.50303@egenix.com> On 2009-01-29 22:05, Andy Todd wrote: > M.-A. Lemburg wrote: >> On 2009-01-29 21:15, Alex Willmer wrote: >>> (Reposted to DB-SIG from clp) >>> >>> This week, I used the adodbapi module against an SQL Server Express >>> database. I was surprised to get an exception, when I attempted to >>> submit a second query with my cursor object. The full session is >>> below. >>> >>> With cx_Oracle I've become used to reusing a cursor for subsequent >>> queries. The PEP doesn't specify either way, that I can see. Is this >>> behaviour left to the implementation, or should I be able to expect a >>> cursor is reusable? >> >> This should be possible. In fact the statement caching mechanism outlined >> in the DB-API spec relies on this: if you pass in the same query twice, >> the module can opt to reuse the already prepared statement. >> > > In that case shouldn't the DB-API be amended to say this? After all > "explicit is better than implicit". Yes, I'll add a note. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jan 29 2009) >>> 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 our new mxODBC.Connect Python Database Interface 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 http://www.egenix.com/company/contact/