From mike.guice at rbc.com Tue May 3 23:14:45 2005 From: mike.guice at rbc.com (mike.guice@rbc.com) Date: Tue, 3 May 2005 17:14:45 -0400 Subject: [DB-SIG] Oracle API Message-ID: <12C2B8E4DF512A408A4D0BA223AF032F0C78576E@SEW80008.palm.fg.rbc.com> Is it necessary to have the Oracle Client installed in a machine that wishes to connect to an Oracle database? If not, what are the requisite files for making the connection? Thanks Mike Guice Oracle DBA IBM USA __________________________________________________________________________________________________________________________________ This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/db-sig/attachments/20050503/c2ed9787/attachment.html From shday at yahoo.com Thu May 5 05:28:45 2005 From: shday at yahoo.com (Stephen Day) Date: Wed, 4 May 2005 20:28:45 -0700 (PDT) Subject: [DB-SIG] Oracle API In-Reply-To: <12C2B8E4DF512A408A4D0BA223AF032F0C78576E@SEW80008.palm.fg.rbc.com> Message-ID: <20050505032845.33468.qmail@web51006.mail.yahoo.com> No need the have the Oracle client. There are a few modules that should work listed here (not all Oracle!): http://www.python.org/topics/database/modules.html I've used cx_Oracle with success. Stephen Day --- mike.guice at rbc.com wrote: > Is it necessary to have the Oracle Client installed > in a machine that wishes to connect to an Oracle > database? If not, what are the requisite files for > making the connection? > > Thanks > > Mike Guice > Oracle DBA > IBM USA > > __________________________________________________________________________________________________________________________________ > > This e-mail may be privileged and/or confidential, > and the sender does not waive any related rights and > obligations. > Any distribution, use or copying of this e-mail or > the information it contains by other than an > intended recipient is unauthorized. > If you received this e-mail in error, please advise > me (by return e-mail or otherwise) immediately. > > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > http://mail.python.org/mailman/listinfo/db-sig > From gh at ghaering.de Thu May 5 02:23:53 2005 From: gh at ghaering.de (Gerhard Haering) Date: Thu, 5 May 2005 02:23:53 +0200 Subject: [DB-SIG] Oracle API In-Reply-To: <12C2B8E4DF512A408A4D0BA223AF032F0C78576E@SEW80008.palm.fg.rbc.com> References: <12C2B8E4DF512A408A4D0BA223AF032F0C78576E@SEW80008.palm.fg.rbc.com> Message-ID: <20050505002353.GB16262@mylene.ghaering.de> On Tue, May 03, 2005 at 05:14:45PM -0400, mike.guice at rbc.com wrote: > Is it necessary to have the Oracle Client installed in a machine that > wishes to connect to an Oracle database? Yes, but a minimal install will do. > If not, what are the requisite files for making the connection? It's possible to strip down the Oracle installation even more, but that's more a less a manual cycle of delete-and-see-if-it-still works. I bothered once to do this, but wouldn't bother any more. -- Gerhard H?ring - gh at ghaering.de - Python, web & database development pysqlite - Powerful and fast embedded database engine "SQLite" for Python. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.python.org/pipermail/db-sig/attachments/20050505/111b5ef6/attachment.pgp From andy47 at halfcooked.com Thu May 5 11:07:21 2005 From: andy47 at halfcooked.com (Andy Todd) Date: Thu, 05 May 2005 19:07:21 +1000 Subject: [DB-SIG] Oracle API In-Reply-To: <20050505032845.33468.qmail@web51006.mail.yahoo.com> References: <20050505032845.33468.qmail@web51006.mail.yahoo.com> Message-ID: <4279E249.4090509@halfcooked.com> Stephen Day wrote: > No need the have the Oracle client. There are a few > modules that should work listed here (not all > Oracle!): > > http://www.python.org/topics/database/modules.html > > I've used cx_Oracle with success. > > Stephen Day > > > --- mike.guice at rbc.com wrote: > > >>Is it necessary to have the Oracle Client installed >>in a machine that wishes to connect to an Oracle >>database? If not, what are the requisite files for >>making the connection? >> >>Thanks >> >>Mike Guice >>Oracle DBA >>IBM USA >> The Python db-api modules (such as cx_Oracle and DCOracle2) still require you to have the Oracle client software installed. Oracle do ship a class (III or is it IV?) pure Java JDBC driver which you can use from Jython. The only other way I'm aware of that you can connect to an Oracle database is via ODBC. mxODBC is the cream of the Python crop here. Regards, Andy -- -------------------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ From gh at ghaering.de Thu May 5 12:34:54 2005 From: gh at ghaering.de (=?ISO-8859-1?Q?Gerhard_H=E4ring?=) Date: Thu, 05 May 2005 12:34:54 +0200 Subject: [DB-SIG] Oracle API In-Reply-To: <4279E249.4090509@halfcooked.com> References: <20050505032845.33468.qmail@web51006.mail.yahoo.com> <4279E249.4090509@halfcooked.com> Message-ID: <4279F6CE.2080204@ghaering.de> Andy Todd wrote: > [...] The Python db-api modules (such as cx_Oracle and DCOracle2) still > require you to have the Oracle client software installed. > > Oracle do ship a class (III or is it IV?) pure Java JDBC driver which > you can use from Jython. > > The only other way I'm aware of that you can connect to an Oracle > database is via ODBC. mxODBC is the cream of the Python crop here. The Oracle ODBC driver (be it from Microsoft or from Oracle) both need an Oracle client installation, too. I've also once seen a third-party offering a commercial Oracle client library with small footprint that does *not* depend on any client stuff from Oracle corp. IIRC they had C and/or C++ bindings. But I don't know the exact Google triggers for finding it ... -- Gerhard From andy47 at halfcooked.com Thu May 5 14:27:42 2005 From: andy47 at halfcooked.com (Andy Todd) Date: Thu, 05 May 2005 22:27:42 +1000 Subject: [DB-SIG] Oracle API In-Reply-To: <4279F6CE.2080204@ghaering.de> References: <20050505032845.33468.qmail@web51006.mail.yahoo.com> <4279E249.4090509@halfcooked.com> <4279F6CE.2080204@ghaering.de> Message-ID: <427A113E.7090103@halfcooked.com> Gerhard H?ring wrote: > Andy Todd wrote: > >>[...] The Python db-api modules (such as cx_Oracle and DCOracle2) still >>require you to have the Oracle client software installed. >> >>Oracle do ship a class (III or is it IV?) pure Java JDBC driver which >>you can use from Jython. >> >>The only other way I'm aware of that you can connect to an Oracle >>database is via ODBC. mxODBC is the cream of the Python crop here. > > > The Oracle ODBC driver (be it from Microsoft or from Oracle) both need > an Oracle client installation, too. > > I've also once seen a third-party offering a commercial Oracle client > library with small footprint that does *not* depend on any client stuff > from Oracle corp. IIRC they had C and/or C++ bindings. But I don't know > the exact Google triggers for finding it ... > > -- Gerhard Or you could just download the ODBC driver itself (which I presume comes bundled with the appropriate Oracle DLLs); http://www.oracle.com/technology/software/tech/windows/odbc/index.html Personally, I'd bite the bullet and install the Oracle client and cx_Oracle, it's how I do all of my Oracle work. Regards, Andy -- -------------------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ From mbennett at ideaeng.com Thu May 5 15:02:22 2005 From: mbennett at ideaeng.com (Mark Bennett) Date: Thu, 5 May 2005 09:02:22 -0400 Subject: [DB-SIG] cx_Oracle and Unicode ??? Message-ID: Good morning Folks, I've looked around on Google for this a few times and really haven't come up with anything definitive. I'm trying to update values in Oracle with the .execute() method from cx_Oracle. If I create a Python unicode string object and try to pass it in, Python complains that .execute() expects a None or string. If I convert the unicode string to a regular "byte" string beforehand with .encode() and utf-8, Python accepts it but when we pull the data back from Oracle we get garbage characters. Some details: Python 2.4 with a recent version of cx_Oracle (don't have the exact version here) Running on Solaris. And from our DBA: Oracle 9 on Solaris. The database was told to support Unicode. The character fields are currently VARCHAR2; he believes he's seen conflicting evidence online about whether or not that is supposed to work. We've also talked about using NVARCHAR2 and NCLOB. We have not set any environment variables on Solaris. Thanks in advance, Mark -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/db-sig/attachments/20050505/a94a10f9/attachment.htm From shday at yahoo.com Thu May 5 15:10:11 2005 From: shday at yahoo.com (Stephen Day) Date: Thu, 5 May 2005 06:10:11 -0700 (PDT) Subject: [DB-SIG] Oracle API In-Reply-To: 6667 Message-ID: <20050505131011.75864.qmail@web51004.mail.yahoo.com> Sorry about that, I have the Oracle client installed... but didn't know it was needed. --- Stephen Day wrote: > No need the have the Oracle client. There are a few > modules that should work listed here (not all > Oracle!): > > http://www.python.org/topics/database/modules.html > > I've used cx_Oracle with success. > > Stephen Day > > > --- mike.guice at rbc.com wrote: > > > Is it necessary to have the Oracle Client > installed > > in a machine that wishes to connect to an Oracle > > database? If not, what are the requisite files for > > making the connection? > > > > Thanks > > > > Mike Guice > > Oracle DBA > > IBM USA > > > > > __________________________________________________________________________________________________________________________________ > > > > This e-mail may be privileged and/or confidential, > > and the sender does not waive any related rights > and > > obligations. > > Any distribution, use or copying of this e-mail or > > the information it contains by other than an > > intended recipient is unauthorized. > > If you received this e-mail in error, please > advise > > me (by return e-mail or otherwise) immediately. > > > _______________________________________________ > > DB-SIG maillist - DB-SIG at python.org > > http://mail.python.org/mailman/listinfo/db-sig > > > > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > http://mail.python.org/mailman/listinfo/db-sig > From jnoster at gmail.com Thu May 5 15:59:38 2005 From: jnoster at gmail.com (jno) Date: Thu, 5 May 2005 17:59:38 +0400 Subject: [DB-SIG] cx_Oracle and Unicode ??? In-Reply-To: References: Message-ID: db-sig ping -- sorry guys... From gvanrossum at gmail.com Thu May 5 17:43:03 2005 From: gvanrossum at gmail.com (Guido van Rossum) Date: Thu, 5 May 2005 08:43:03 -0700 Subject: [DB-SIG] cx_Oracle and Unicode ??? In-Reply-To: References: Message-ID: Maybe this is more an issue for the cx-oracle mailing list? (Google for it.) I'd be interested in hearing the answer too. On 5/5/05, Mark Bennett wrote: > > Good morning Folks, > > I've looked around on Google for this a few times and really haven't come up > with anything definitive. > > I'm trying to update values in Oracle with the .execute() method from > cx_Oracle. > > If I create a Python unicode string object and try to pass it in, Python > complains that .execute() expects a None or string. > > If I convert the unicode string to a regular "byte" string beforehand with > .encode() and utf-8, Python accepts it but when we pull the data back from > Oracle we get garbage characters. > > Some details: > > Python 2.4 with a recent version of cx_Oracle (don't have the exact version > here) Running on Solaris. > > And from our DBA: > > Oracle 9 on Solaris. The database was told to support Unicode. > > The character fields are currently VARCHAR2; he believes he's seen > conflicting evidence online about whether or not that is supposed to work. > We've also talked about using NVARCHAR2 and NCLOB. > > We have not set any environment variables on Solaris. > > Thanks in advance, > Mark > > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > http://mail.python.org/mailman/listinfo/db-sig > > > -- --Guido van Rossum (home page: http://www.python.org/~guido/) From markrages at gmail.com Fri May 6 00:28:16 2005 From: markrages at gmail.com (Mark Rages) Date: Thu, 5 May 2005 17:28:16 -0500 Subject: [DB-SIG] Dealing with bogus date in MySql Message-ID: <74ee72ca05050515282ccfee3d@mail.gmail.com> Hi, I hope this list can help me. I have a MySQL table with some dates, like this: mysql> select MIN(change_date),MAX(change_date) from status_history; +---------------------+---------------------+ | MIN(change_date) | MAX(change_date) | +---------------------+---------------------+ | 2000-11-14 74:17:72 | 2005-05-05 17:17:43 | +---------------------+---------------------+ 1 row in set (0.34 sec) Notice that first date is kind of funky; most days don't have 72 hours. I'm trying to get the information out with MySQLdb: self.conn=MySQLdb.connect(db=db,user=dbuser,host=dbhost,passwd=dbpass) self.cur=self.conn.cursor() self.cur.execute("select MIN(change_date),MAX(change_date) from status_history") print self.cur.fetchone() which gives: (None, ) Is there some way I can get the date with MySQLdb? "None" just isn't helpful for my application. Regards, Mark markrages at gmail -- You think that it is a secret, but it never has been one. - fortune cookie From farcepest at gmail.com Fri May 6 01:10:08 2005 From: farcepest at gmail.com (Andy Dustman) Date: Thu, 5 May 2005 19:10:08 -0400 Subject: [DB-SIG] Dealing with bogus date in MySql In-Reply-To: <74ee72ca05050515282ccfee3d@mail.gmail.com> References: <74ee72ca05050515282ccfee3d@mail.gmail.com> Message-ID: <9826f38005050516106729b021@mail.gmail.com> Follow-up off-list or on the mysql-python sourceforge Help forum. On 5/5/05, Mark Rages wrote: > Hi, > > I hope this list can help me. > > I have a MySQL table with some dates, like this: > mysql> select MIN(change_date),MAX(change_date) from status_history; > +---------------------+---------------------+ > | MIN(change_date) | MAX(change_date) | > +---------------------+---------------------+ > | 2000-11-14 74:17:72 | 2005-05-05 17:17:43 | > +---------------------+---------------------+ > 1 row in set (0.34 sec) > > Notice that first date is kind of funky; most days don't have 72 hours. > > I'm trying to get the information out with MySQLdb: > self.conn=MySQLdb.connect(db=db,user=dbuser,host=dbhost,passwd=dbpass) > self.cur=self.conn.cursor() > self.cur.execute("select MIN(change_date),MAX(change_date) from status_history") > print self.cur.fetchone() > which gives: > > (None, ) > > Is there some way I can get the date with MySQLdb? "None" just isn't > helpful for my application. MySQLdb is using Python datetime objects, and apparently they are rejecting the bad date. If you look at MySQLdb.pytimes, you'll see a DateTime_or_None() function. This is the default converter for DATETIME columns. What you can do is create a new function, DateTime_or_str(), which returns the original string value instead of None, and then put this function in the converter dictionary. MySQLdb.converters.conversions is where this dictionary is built; study that for an example. You can modify conversions directly, or modify a copy of it, and pass it to connect() via the conv parameter. Of course you have a new problem now: How to deal with the case where your date comes back as a string instead of a datetime object. -- Computer interfaces should never be made of meat. http://www.terrybisson.com/meat.html From brunson at brunson.com Fri May 6 01:27:21 2005 From: brunson at brunson.com (Eric Brunson) Date: Thu, 05 May 2005 17:27:21 -0600 Subject: [DB-SIG] Oracle API In-Reply-To: <20050505002353.GB16262@mylene.ghaering.de> References: <12C2B8E4DF512A408A4D0BA223AF032F0C78576E@SEW80008.palm.fg.rbc.com> <20050505002353.GB16262@mylene.ghaering.de> Message-ID: <427AABD9.7020706@brunson.com> Gerhard Haering wrote: >On Tue, May 03, 2005 at 05:14:45PM -0400, mike.guice at rbc.com wrote: > > >>Is it necessary to have the Oracle Client installed in a machine that >>wishes to connect to an Oracle database? >> >> > >Yes, but a minimal install will do. > > > >>If not, what are the requisite files for making the connection? >> >> > >It's possible to strip down the Oracle installation even more, but >that's more a less a manual cycle of delete-and-see-if-it-still works. > >I bothered once to do this, but wouldn't bother any more. > > > > With Oracle 9i I was able to take the 140MB client install and pare it down to about 3.5MB of shared libraries that were actually needed. Pretty much oracle client lib, TLS lib and some config files, but I don't remember exactly. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/db-sig/attachments/20050505/c0772793/attachment.html From mal at egenix.com Fri May 6 08:37:54 2005 From: mal at egenix.com (M.-A. Lemburg) Date: Fri, 06 May 2005 08:37:54 +0200 Subject: [DB-SIG] Dealing with bogus date in MySql In-Reply-To: <9826f38005050516106729b021@mail.gmail.com> References: <74ee72ca05050515282ccfee3d@mail.gmail.com> <9826f38005050516106729b021@mail.gmail.com> Message-ID: <427B10C2.9090408@egenix.com> Andy Dustman wrote: > Follow-up off-list or on the mysql-python sourceforge Help forum. > > On 5/5/05, Mark Rages wrote: > >>Hi, >> >>I hope this list can help me. >> >>I have a MySQL table with some dates, like this: >>mysql> select MIN(change_date),MAX(change_date) from status_history; >>+---------------------+---------------------+ >>| MIN(change_date) | MAX(change_date) | >>+---------------------+---------------------+ >>| 2000-11-14 74:17:72 | 2005-05-05 17:17:43 | >>+---------------------+---------------------+ >>1 row in set (0.34 sec) >> >>Notice that first date is kind of funky; most days don't have 72 hours. >> >>I'm trying to get the information out with MySQLdb: >>self.conn=MySQLdb.connect(db=db,user=dbuser,host=dbhost,passwd=dbpass) >>self.cur=self.conn.cursor() >>self.cur.execute("select MIN(change_date),MAX(change_date) from status_history") >>print self.cur.fetchone() >>which gives: >> >>(None, ) >> >>Is there some way I can get the date with MySQLdb? "None" just isn't >>helpful for my application. > > > MySQLdb is using Python datetime objects, and apparently they are > rejecting the bad date. FWIW, the above repr() output indicates that it is using mxDateTime objects and, yes, mxDateTime raises an exception for bad dates or times. > If you look at MySQLdb.pytimes, you'll see a DateTime_or_None() > function. This is the default converter for DATETIME columns. What you > can do is create a new function, DateTime_or_str(), which returns the > original string value instead of None, and then put this function in > the converter dictionary. MySQLdb.converters.conversions is where this > dictionary is built; study that for an example. > > You can modify conversions directly, or modify a copy of it, and pass > it to connect() via the conv parameter. > > Of course you have a new problem now: How to deal with the case where > your date comes back as a string instead of a datetime object. Wouldn't it be more appropriate to *correct* the wrong date/time value in the database ?! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 06 2005) >>> 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,FreeBSD for free ! :::: From farcepest at gmail.com Fri May 6 15:43:43 2005 From: farcepest at gmail.com (Andy Dustman) Date: Fri, 6 May 2005 09:43:43 -0400 Subject: [DB-SIG] Dealing with bogus date in MySql In-Reply-To: <427B10C2.9090408@egenix.com> References: <74ee72ca05050515282ccfee3d@mail.gmail.com> <9826f38005050516106729b021@mail.gmail.com> <427B10C2.9090408@egenix.com> Message-ID: <9826f38005050606431ca9b26@mail.gmail.com> On 5/6/05, M.-A. Lemburg wrote: > Andy Dustman wrote: > > MySQLdb is using Python datetime objects, and apparently they are > > rejecting the bad date. > > FWIW, the above repr() output indicates that it is using > mxDateTime objects and, yes, mxDateTime raises an exception for > bad dates or times. You're right, of course, but the rest of the comments still apply, except he should look at MySQLdb.mxdatetime instead. > Wouldn't it be more appropriate to *correct* the wrong > date/time value in the database ?! Yes, but my guess is he has rejected the obvious solution for some non-obvious reason. -- Computer interfaces should never be made of meat. http://www.terrybisson.com/meat.html From mike.guice at rbc.com Thu May 5 14:26:06 2005 From: mike.guice at rbc.com (mike.guice@rbc.com) Date: Thu, 5 May 2005 08:26:06 -0400 Subject: [DB-SIG] Oracle API Message-ID: <12C2B8E4DF512A408A4D0BA223AF032F0C78577F@SEW80008.palm.fg.rbc.com> Thanks all for your advice. Python is a really useful (down and dirty) language but is of course, still evolving. Mike -----Original Message----- From: Andy Todd [mailto:andy47 at halfcooked.com] Sent: Thursday, May 05, 2005 5:07 AM To: Stephen Day Cc: Guice, Mike (Liberty); db-sig at python.org Subject: Re: [DB-SIG] Oracle API Stephen Day wrote: > No need the have the Oracle client. There are a few > modules that should work listed here (not all > Oracle!): > > http://www.python.org/topics/database/modules.html > > I've used cx_Oracle with success. > > Stephen Day > > > --- mike.guice at rbc.com wrote: > > >>Is it necessary to have the Oracle Client installed >>in a machine that wishes to connect to an Oracle >>database? If not, what are the requisite files for >>making the connection? >> >>Thanks >> >>Mike Guice >>Oracle DBA >>IBM USA >> The Python db-api modules (such as cx_Oracle and DCOracle2) still require you to have the Oracle client software installed. Oracle do ship a class (III or is it IV?) pure Java JDBC driver which you can use from Jython. The only other way I'm aware of that you can connect to an Oracle database is via ODBC. mxODBC is the cream of the Python crop here. Regards, Andy -- -------------------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ __________________________________________________________________________________________________________________________________ This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. From gh at ghaering.de Sun May 8 04:37:34 2005 From: gh at ghaering.de (Gerhard Haering) Date: Sun, 8 May 2005 04:37:34 +0200 Subject: [DB-SIG] [ANN] pysqlite 2.0.beta1 Message-ID: <20050508023734.GA4109@mylene.ghaering.de> ================== pysqlite 2.0.beta1 ================== I'm glad to announce pysqlite 2.0.beta1. The API is 98 % stable now. And pysqlite itself should be a lot more stable too, now. The most notable changes are a lot of fixed refcount bugs, and the added documentation. Download the release here: Sources: http://initd.org/pub/software/pysqlite/releases/2.0/2.0.beta1/pysqlite-2.0.beta1.tar.gz win32 binaries for Python 2.3: http://initd.org/pub/software/pysqlite/releases/2.0/2.0.beta1/pysqlite-2.0.beta1.win32-py2.3.exe win32 binaries for Python 2.4: http://initd.org/pub/software/pysqlite/releases/2.0/2.0.beta1/pysqlite-2.0.beta1.win32-py2.4.exe pysqlite homepage, bug tracker, wiki: http://pysqlite.org/ Changes since 2.0.alpha4: ========================= - Added pysqlite 2.0 documentation: usage guide and source installation guide. Adapted from kinterbasdb documentation with the permission of David Rushby. - Fixed several refcount problems. Per test suite run, lose 0 references instead of 550 per test suite run like in alpha4. - If a database file cannot be opened, raise an OperationalError specifically instead of a DatabaseError. - Call the row factory with (cursor, row_tuple) instead of (row_tuple). - Fixed a crash in .connect() when you tried to set a keyword argument. It's quite annoying that Python doesn't offer a method to extract a single keyword argument at C-level easily. Argh! So I bit the bullet and duplicated the parameter extraction code. - The type name of PrepareProtocol was corrected. Only interesting for introspection. - Added more tests to the test suite. - Implemented cursor.arraysize. - cursor.rowcount is now -1 instead of None in case of "not determined", like the DB-API requires. - Implemented autocommit mode which replaces the ''no_implicit_begin'' parameter to the module-level connect(). This way, we're more compatible with other DB-API modules. autocommit parameter in module-level connect and also an autocommit property of connections. -- The "begin" method of connections is gone. - Completely reworked the advanced type detection: o connection.register_converter is gone o instead, the dictionary connection.converters is exposed directly. o The parameter more_types to the module-level connect is gone. o Instead, use any combination of PARSE_DECLTYPES and PARSE_COLNAMES for the new paramter detect_types. PARSE_DECLTYPES will parse out the first word of a declared type and look up a converter in connection.converters: create table foo(col mytype not null) The decltype would be "mytype not null", but PARSE_DECLTYPES will cut out "mytype" and look for a converter in converters["mytype"]. If it finds any, it will use it to convert the value. Otherwise, the standard SQLite manifest typing will be used. PARSE_COLNAMES will parse out the column names and look up a converter in connection.converters: cur.execute("select 1 as "colname [mytype]") the column names will be parsed for [...], in this case mytype will be found as the type for the colum, and the converters dictionary will be consulted for an appropriate converter function. If none is found, the standard SQLite manifest typing will be used. Also, the column names in cursor.description will only consist of the first word. So it would be "colname" in our example, not "colname [mytype]". - cursor.coltypes is gone. - The connection attribute of cursors is now made available at Python level. That's an optional DB-API extension. - The exception classes are now attributes of the connection objects. That's an optional DB-API extension. - Optimized the _sqlite_step_with_busyhandler() function by making time.time() and time.sleep() available at module import instead of importing the "time" module each time and getting out the "time" and "sleep" functions each time. Big performance improvement. - Some work on the benchmarks. - Made the destructor of the Cursor class more stable. It used to crash when an error occured in the Cursor *constructor*. - Implemented a check that the parameter for Cursor() is actually an instance of the Connection class (or a subclass thereof). - Allow long integers as parameters. Re-enable test cases for this. -- Gerhard H?ring - gh at ghaering.de - Python, web & database development pysqlite - Powerful and fast embedded database engine "SQLite" for Python. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.python.org/pipermail/db-sig/attachments/20050508/f1379448/attachment.pgp From miroslav.siket at gmail.com Mon May 9 09:32:34 2005 From: miroslav.siket at gmail.com (Miroslav Siket) Date: Mon, 9 May 2005 09:32:34 +0200 Subject: [DB-SIG] Oracle API In-Reply-To: <12C2B8E4DF512A408A4D0BA223AF032F0C78577F@SEW80008.palm.fg.rbc.com> References: <12C2B8E4DF512A408A4D0BA223AF032F0C78577F@SEW80008.palm.fg.rbc.com> Message-ID: <878b9ee05050900325f85d2dc@mail.gmail.com> You can download Oracle Instant client with minimal set of required libraries needed for either cx_Oracle od DCOracle2 to work. You can download them directly from the Oracle web site. They have the rpms ready... Miro On 5/5/05, mike.guice at rbc.com wrote: > Thanks all for your advice. Python is a really useful (down and dirty) language but is of course, still evolving. > > Mike > > -----Original Message----- > From: Andy Todd [mailto:andy47 at halfcooked.com] > Sent: Thursday, May 05, 2005 5:07 AM > To: Stephen Day > Cc: Guice, Mike (Liberty); db-sig at python.org > Subject: Re: [DB-SIG] Oracle API > > Stephen Day wrote: > > No need the have the Oracle client. There are a few > > modules that should work listed here (not all > > Oracle!): > > > > http://www.python.org/topics/database/modules.html > > > > I've used cx_Oracle with success. > > > > Stephen Day > > > > > > --- mike.guice at rbc.com wrote: > > > > > >>Is it necessary to have the Oracle Client installed > >>in a machine that wishes to connect to an Oracle > >>database? If not, what are the requisite files for > >>making the connection? > >> > >>Thanks > >> > >>Mike Guice > >>Oracle DBA > >>IBM USA > >> > > The Python db-api modules (such as cx_Oracle and DCOracle2) still > require you to have the Oracle client software installed. > > Oracle do ship a class (III or is it IV?) pure Java JDBC driver which > you can use from Jython. > > The only other way I'm aware of that you can connect to an Oracle > database is via ODBC. mxODBC is the cream of the Python crop here. > > Regards, > Andy > -- > -------------------------------------------------------------------------------- > From the desk of Andrew J Todd esq - http://www.halfcooked.com/ > __________________________________________________________________________________________________________________________________ > > This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. > Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. > If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > http://mail.python.org/mailman/listinfo/db-sig > -- Miroslav Siket CERN, IT/FIO, CH-1211, Suisse e-mail:Miroslav.Siket at cern.ch Web: http://cern.ch/mirsi phone: +41 22 76 73068 fax: +41 22 76 77155 From mike.guice at rbc.com Mon May 9 14:20:46 2005 From: mike.guice at rbc.com (mike.guice@rbc.com) Date: Mon, 9 May 2005 08:20:46 -0400 Subject: [DB-SIG] Oracle API Message-ID: <12C2B8E4DF512A408A4D0BA223AF032F19ADC7E7@SEW80008.palm.fg.rbc.com> Thanks -----Original Message----- From: Miroslav Siket [mailto:miroslav.siket at gmail.com] Sent: Monday, May 09, 2005 3:33 AM To: Guice, Mike (Liberty) Cc: andy47 at halfcooked.com; shday at yahoo.com; db-sig at python.org Subject: Re: [DB-SIG] Oracle API You can download Oracle Instant client with minimal set of required libraries needed for either cx_Oracle od DCOracle2 to work. You can download them directly from the Oracle web site. They have the rpms ready... Miro On 5/5/05, mike.guice at rbc.com wrote: > Thanks all for your advice. Python is a really useful (down and dirty) language but is of course, still evolving. > > Mike > > -----Original Message----- > From: Andy Todd [mailto:andy47 at halfcooked.com] > Sent: Thursday, May 05, 2005 5:07 AM > To: Stephen Day > Cc: Guice, Mike (Liberty); db-sig at python.org > Subject: Re: [DB-SIG] Oracle API > > Stephen Day wrote: > > No need the have the Oracle client. There are a few > > modules that should work listed here (not all > > Oracle!): > > > > http://www.python.org/topics/database/modules.html > > > > I've used cx_Oracle with success. > > > > Stephen Day > > > > > > --- mike.guice at rbc.com wrote: > > > > > >>Is it necessary to have the Oracle Client installed > >>in a machine that wishes to connect to an Oracle > >>database? If not, what are the requisite files for > >>making the connection? > >> > >>Thanks > >> > >>Mike Guice > >>Oracle DBA > >>IBM USA > >> > > The Python db-api modules (such as cx_Oracle and DCOracle2) still > require you to have the Oracle client software installed. > > Oracle do ship a class (III or is it IV?) pure Java JDBC driver which > you can use from Jython. > > The only other way I'm aware of that you can connect to an Oracle > database is via ODBC. mxODBC is the cream of the Python crop here. > > Regards, > Andy > -- > -------------------------------------------------------------------------------- > From the desk of Andrew J Todd esq - http://www.halfcooked.com/ > __________________________________________________________________________________________________________________________________ > > This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. > Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. > If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > http://mail.python.org/mailman/listinfo/db-sig > -- Miroslav Siket CERN, IT/FIO, CH-1211, Suisse e-mail:Miroslav.Siket at cern.ch Web: http://cern.ch/mirsi phone: +41 22 76 73068 fax: +41 22 76 77155 __________________________________________________________________________________________________________________________________ This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. From gh at ghaering.de Mon May 16 20:30:06 2005 From: gh at ghaering.de (Gerhard Haering) Date: Mon, 16 May 2005 20:30:06 +0200 Subject: [DB-SIG] [ANN] pysqlite 2.0.0 final released! Message-ID: <20050516183006.GA4284@mylene.ghaering.de> Hello everyone, After pondering about a redesign of pysqlite for years, and now after half a year of development, I am happy to finally announce the first stable release of pysqlite2. pysqlite a DB-API 2.0-compliant database interface for SQLite. SQLite is a relational database management system contained in a relatively small C library. It is a public domain project created by D. Richard Hipp. Unlike the usual client-server paradigm, the SQLite engine is not a standalone process with which the program communicates, but is linked in and thus becomes an integral part of the program. The library implements most of SQL-92 standard, including transactions, triggers and most of complex queries. pysqlite makes this powerful embedded SQL engine available to Python programmers. It stays compatible with the Python database API specification 2.0 as much as possible, but also exposes most of SQLite's native API, so that it is for example possible to create user-defined SQL functions and aggregates in Python. If you need a relational database for your applications, or even small tools or helper scripts, pysqlite is often a good fit. It's easy to use, easy to deploy, and does not depend on any other Python libraries or platform libraries, except SQLite. SQLite itself is ported to most platforms you'd ever care about. It's often a good alternative to MySQL, the Microsoft JET engine or the MSDE, without having any of their license and deployment issues. pysqlite homepage: http://pysqlite.org/ On the homepage, there's also a bug tracking system and a wiki. Sources: http://initd.org/pub/software/pysqlite/releases/2.0/2.0.0/pysqlite-2.0.0.tar.gz Windows binaries for Python 2.3: http://initd.org/pub/software/pysqlite/releases/2.0/2.0.0/pysqlite-2.0.0.win32-py2.3.exe Windows binaries for Python 2.4: http://initd.org/pub/software/pysqlite/releases/2.0/2.0.0/pysqlite-2.0.0.win32-py2.4.exe Advantages of pysqlite 2.0 over pysqlite 1.x ============================================ - Straightforward: No surprises: pysqlite 2.0 does not convert any types behind your back. With default settings, it only supports the database types SQLite supports out of the box: INTEGER, REAL, TEXT, BLOB and NULL. - Documentation: pysqlite 2.0 now has usable documentation. The usage manual covers the full API. - Advanced type system: It is, however, possible to turn on type detection like in the old pysqlite. Types can be detected by their declared type in the "CREATE TABLE" statement. Or, for values that don't originate directly from tables or views, it's possible to detect the type from the column name via a neat trick. For details, look into the pysqlite usage manual. No more "-- types" hack like in the old pysqlite. Type conversion from Python to SQLite works via PEP-246-like object adaptation. - Fine-grained transaction control: pysqlite 2.0 allows to control which type of transactions are opened via the transaction_isolation property - None for auto-commit mode or one of SQLite's transaction types "DEFERRED", "IMMEDIATE", "EXCLUSIVE". - executemany() uses precompiled statements for optimal speed. - Result sets are not prefetched any more, rows are only fetched on demand. So, pysqlite 2.0 behaves a lot nicer with respect to memory usage. - pysqlite 2.0 supports both the "qmark" and "named" paramstyle. So you can supply query parameters as sequences or as mappings. - Performance: pysqlite 2.0 is almost entirely written in hand-coded C. Under most circumstances, it is noticeably faster than the old pysqlite. On the pysqlite wiki, there's a page with benchmarks: http://initd.org/tracker/pysqlite/wiki/PysqliteBenchmarks The benchmark shows that executemany() is 5 times as fast as in pysqlite 1.1. Open issues: ============ pysqlite 2.0 does currently not compile under MacOS X Tiger (10.2 seems to work for me on the SF compile farm), because of unresolved symbols. Unfortunately, I don't have access to that platform. I will need a patch with a real fix from a MacOS X users to fix the problem. And, for those who have followed the alpha/beta testing: Changes since pysqlite 2.0beta1 =============================== - Removed dead code. - Improved error handling. - Fixed a leak that occurred when erroneous SQL was sent to execute(many)(). - Recognize REPLACE as DML statement and start transactions appropriately. - Issue a Warning when users send more than one SQL statement to execute(many)(). - Changed a few mappings SQLite error => DB-API exception. - Added lots of new unit tests so all testable code paths are tested/executed. This was done when doing coverage testing using gcov. - Implemented a nonstandard convenience method cursor.executescript(sql) to execute several SQL statements in a bunch, for example for creating a database initially. - The converters dictionary was moved from the Connection object into the DB-API module. Register converters with register_converter(converter_name, callable). - the prepareProtocol parameter is gone. - instead, register adapters directly with register_adapter(type, adapter_callable) in the DB-API module. - check for closed connections - make sure it's impossible to destroy connections as long as there are still cursors using them - fixed a crash when a converter returned None - fixes to MANIFEST.in - default converters and adapters for date/date and datetime/timestamp - Replaced autocommit flag with isolation_level flag. This way, it's possible to use no transaction handling at all (autocommit), or control the types of transactions that are created (DEFERRED, IMMEDIATE, EXCLUSIVE). - thread_id is now long instead of int - so pysqlite compiles on 64-bit platforms, too. -- Gerhard H?ring - gh at ghaering.de - Python, web & database development -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.python.org/pipermail/db-sig/attachments/20050516/28a078b7/attachment.pgp From Michael.Coll-Barth at VerizonWireless.com Tue May 17 15:13:37 2005 From: Michael.Coll-Barth at VerizonWireless.com (Michael.Coll-Barth@VerizonWireless.com) Date: Tue, 17 May 2005 09:13:37 -0400 Subject: [DB-SIG] a little trouble passing values to Oracle using bind variables Message-ID: <20050517131339.3BAAD1E4006@bag.python.org> All, As the subject line says, I am having some trouble passing bind variables to Oracle. When I pass a printable string value, such as 'NM', I get data. When I try to pass a non-printable character, such as 'return' - chr(13), I get no data back. I can't simply make NactionCode = chr(13), as python would change the value of NactionCode to '\r' and Oracle sees this as a two byte character, and not chr(13). I have looked into how Oracle might accept something like '\x00' for chr(0), but to no avail. Any thoughts? thanks, Michael def goGetIt( NactivityDt, NactionCode ): dataQuery = '''select a, b, c from %s where activityDt = :NactivityDt and actionCode = :NactionCode order by %s ''' % ( schema.tableName ) dbm.cursor.execute(dataQuery, NactivityDt = activityDt, NactionCode = actionCode ) result = dbm.cursor.fetchall() return result NactivityDt = '12-apr-2005' NactionCode = 'NM' act1 = goGetIt( NactivityDt, NactionCode ) NactivityDt = '12-apr-2005' NactionCode = 'chr(13)' act2 = goGetIt( NactivityDt, NactionCode ) NactivityDt = '12-apr-2005' NactionCode = chr(13) act3 = goGetIt( NactivityDt, NactionCode ) ___________________________________________________________________ The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. From gvanrossum at gmail.com Tue May 17 16:21:17 2005 From: gvanrossum at gmail.com (Guido van Rossum) Date: Tue, 17 May 2005 07:21:17 -0700 Subject: [DB-SIG] a little trouble passing values to Oracle using bind variables In-Reply-To: <20050517131339.3BAAD1E4006@bag.python.org> References: <20050517131339.3BAAD1E4006@bag.python.org> Message-ID: Are you *sure* the 3rd variant doesn't work? I'd expect that to work. '\r' should work just as well. Which Oracle interface are you using? On 5/17/05, Michael.Coll-Barth at verizonwireless.com wrote: > All, > > As the subject line says, I am having some trouble passing bind variables to > Oracle. When I pass a printable string value, such as 'NM', I get data. > When I try to pass a non-printable character, such as 'return' - chr(13), I > get no data back. I can't simply make NactionCode = chr(13), as python > would change the value of NactionCode to '\r' and Oracle sees this as a two > byte character, and not chr(13). I have looked into how Oracle might accept > something like '\x00' for chr(0), but to no avail. > > Any thoughts? > > thanks, > Michael > > def goGetIt( NactivityDt, NactionCode ): > > dataQuery = '''select a, b, c > from %s > where activityDt = :NactivityDt > and actionCode = :NactionCode > order by %s > ''' % ( schema.tableName ) > > dbm.cursor.execute(dataQuery, NactivityDt = activityDt, NactionCode = > actionCode ) > result = dbm.cursor.fetchall() > > return result > > NactivityDt = '12-apr-2005' > NactionCode = 'NM' > act1 = goGetIt( NactivityDt, NactionCode ) > > NactivityDt = '12-apr-2005' > NactionCode = 'chr(13)' > act2 = goGetIt( NactivityDt, NactionCode ) > > NactivityDt = '12-apr-2005' > NactionCode = chr(13) > act3 = goGetIt( NactivityDt, NactionCode ) -- --Guido van Rossum (home page: http://www.python.org/~guido/)