From KuznecA@micex.com Mon Oct 2 08:25:57 2000 From: KuznecA@micex.com (=?koi8-r?Q?=EB=D5=DA=CE=C5=C3=CF=D7_=E1=CC=C5=CB=D3=C1=CE=C4=D2?=) Date: Mon, 2 Oct 2000 11:25:57 +0400 Subject: [DB-SIG] Kinterbasdb 2.0 alpha available Message-ID: This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C02C42.01B819C0 Content-Type: text/plain; charset="koi8-r" Sorry if you recieve the message twice or you are not interesting in database programming with Python. First of all we apologize for about year of silence. But now we are pleased to announce Kinterbasdb 2.0 alpha release. Kinterbasdb lives at Sourceforge http://kinterbasdb.sourceforge.net/ now. The main issues of Kinterbasdb 2.0 are: 1. Python DB-API 2.0. Programs which uses previos versions of Kinterbasdb is incompatible with DB-API 2.0 2. Support of most features of Interbase 6 (dialects, newer temporal datatype) 3. WIN32 is supported as one of the leading platforms (almost equal to Linux :) 4. Tested and prooved for Python 1.6 5. Development and support will be faster and now. Thanks to Sourgeforge services: forums, mailing lists, bug submit, etc. 6. Kinterbasdb now depends on mxDateTime package. For a tutorial on how to use Kinterbasdb 2.0 have a look on Kinterbasdb release notes in documentation link. All comments and feedback are highly appreciated. Use Kinterbasdb mailing lists and/or forums. Alexander Kuznetsov - The Kinterbasdb development KuznecA@micex.com ------_=_NextPart_001_01C02C42.01B819C0 Content-Type: text/html; charset="koi8-r" Content-Transfer-Encoding: quoted-printable Kinterbasdb 2.0 alpha available

Sorry if you recieve the message twice or you are not = interesting in database programming with Python.

First of all we apologize for about year of silence. =
But now we are pleased to announce Kinterbasdb 2.0 = alpha release.
Kinterbasdb lives at Sourceforge http://kinterbasdb.sourceforge.net/ now.

The main issues of Kinterbasdb 2.0 are:
        1. Python = DB-API 2.0. Programs which uses previos versions of Kinterbasdb is = incompatible with DB-API 2.0
        2. = Support of most features of Interbase 6 (dialects, newer temporal = datatype)
        3. WIN32 = is supported as one of the leading platforms (almost equal to Linux = :)
        4. Tested = and prooved for Python 1.6
        5. = Development and support will be faster and now. Thanks to Sourgeforge = services: forums, mailing lists, bug submit, etc.

        6. = Kinterbasdb now depends on mxDateTime package.

For a tutorial on how to use Kinterbasdb 2.0 have a = look on Kinterbasdb release notes in documentation link.

All comments and feedback are highly appreciated. Use = Kinterbasdb mailing lists and/or forums.

Alexander Kuznetsov - The Kinterbasdb = development
KuznecA@micex.com

------_=_NextPart_001_01C02C42.01B819C0-- From Billy G. Allie" --==_Exmh_-755385808P Content-Type: text/plain; charset=us-ascii Announce: First public release of PgSQL ======================================= PgSQL v1.0 has been released. This is the first public release of PgSQL. It is available at http://sourceforge.net/projects/pgsql. PgSQL is a package of two (2) modules that provide a Python DB-API 2.0 compliant interface to PostgreSQL databases. The first module, libpq, exports the PostgreSQL C API to Python. This module is written in C and can be compiled into Python or can be dynamically loaded on demand. The second module, PgSQL, provides the DB-API 2.0 compliant interface and support for various PostgreSQL data types, such as INT8, NUMERIC, MONEY, BOOL, ARRAYS, etc. This module is written in Python and works with PostgreSQL 6.5.2 or later and Python 1.5.2 or later. PostgreSQL is a sophisticated Object-Relational DBMS, supporting almost all SQL constructs, including sub-selects, transactions, and user-defined types and functions. It is the most advanced open-source database available anywhere More information about PostgreSQL can be found at the PostgreSQL home page at http://www.postgresql.org. Python is an interpreted, interactive, object-oriented programming lang- uage. It combines remarkable power with very clear syntax. It has modules, classes, exceptions, very high level dynamic data types, and dynamic typing. There are interfaces to many system calls and libraries, as well as to various windowing systems (X11, Motif, Tk, Mac, MFC). New builtin modules are easily written in C or C++. Python is also usable as an extension language for applications that need a programmable interface. Python is copyrighted but freely usable and distributable, even for commercial use. More information about Python can be found on the Python home page at http://www.python.org. -- ____ | Billy G. Allie | Domain....: Bill.Allie@mug.org | /| | 7436 Hartwell | Compuserve: 76337,2061 |-/-|----- | Dearborn, MI 48126| MSN.......: B_G_Allie@email.msn.com |/ |LLIE | (313) 582-1540 | --==_Exmh_-755385808P Content-Type: application/pgp-signature -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Content-Type: text/plain; charset=us-ascii Announce: First public release of PgSQL ======================================= PgSQL v1.0 has been released. This is the first public release of PgSQL. It is available at http://sourceforge.net/projects/pgsql. PgSQL is a package of two (2) modules that provide a Python DB-API 2.0 compliant interface to PostgreSQL databases. The first module, libpq, exports the PostgreSQL C API to Python. This module is written in C and can be compiled into Python or can be dynamically loaded on demand. The second module, PgSQL, provides the DB-API 2.0 compliant interface and support for various PostgreSQL data types, such as INT8, NUMERIC, MONEY, BOOL, ARRAYS, etc. This module is written in Python and works with PostgreSQL 6.5.2 or later and Python 1.5.2 or later. PostgreSQL is a sophisticated Object-Relational DBMS, supporting almost all SQL constructs, including sub-selects, transactions, and user-defined types and functions. It is the most advanced open-source database available anywhere More information about PostgreSQL can be found at the PostgreSQL home page at http://www.postgresql.org. Python is an interpreted, interactive, object-oriented programming lang- uage. It combines remarkable power with very clear syntax. It has modules, classes, exceptions, very high level dynamic data types, and dynamic typing. There are interfaces to many system calls and libraries, as well as to various windowing systems (X11, Motif, Tk, Mac, MFC). New builtin modules are easily written in C or C++. Python is also usable as an extension language for applications that need a programmable interface. Python is copyrighted but freely usable and distributable, even for commercial use. More information about Python can be found on the Python home page at http://www.python.org. - -- ____ | Billy G. Allie | Domain....: Bill.Allie@mug.org | /| | 7436 Hartwell | Compuserve: 76337,2061 |-/-|----- | Dearborn, MI 48126| MSN.......: B_G_Allie@email.msn.com |/ |LLIE | (313) 582-1540 | -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.2 (UnixWare) Comment: Exmh version 2.2 06/23/2000 iD8DBQE52/i/nmIkMXoVVdURAkXFAKDYqneKD4NNF/inEGQ+ptD+CJgMUgCg9Sgb OZRM65axucRwViBJfhre7wM= =fyRM -----END PGP SIGNATURE----- --==_Exmh_-755385808P-- From manyong@gnu.org Fri Oct 6 08:36:35 2000 From: manyong@gnu.org (Man-Yong Lee) Date: Fri, 06 Oct 2000 16:36:35 +0900 Subject: [DB-SIG] DB2 Python module 0.9 Message-ID: <39DD8103.42EE1209@gnu.org> Annouce: IBM DB2 Module ----------------------- Hi, everyone. I've just finished (not completely) IBM DB2 Python module to use IBM's RDBMS, IBM DB2. This is just a 4-day work. So there must be something wrong but it work anyway. Actually this post is a request for help and suggestion about my work. Test environment is like these: - Linux 2.2.17 - glibc 2.1.3 - IBM DB2 V7.1 (Developer Edition) - Intel Platform & S/390 (with Linux) Just import DB2 and... >>> conn = DB2.connect(dsn='sample') >>> curs = conn.cursor() >>> curs.execute('blah blah...') Thanks to everybody who've tried to make Python a real salvation from other languages. :) Download site is like this: ftp://people.linuxkorea.co.kr/pub/DB2/DB2-Python-0.9.tar.gz Regards, Bryan Lee -- Happy Python! Man-Yong (Bryan) Lee, CTO of LinuxKorea, Inc From thierry@mixadlive.com Sat Oct 7 22:29:11 2000 From: thierry@mixadlive.com (Thierry MICHEL) Date: Sat, 7 Oct 2000 23:29:11 +0200 Subject: [DB-SIG] Opened question ... Message-ID: <20001007232911.A1812@takeshi.mixadlive.com> Hi, I put the follow motion for the DB-API, and I wait for your opinion about it : I would make a cursor object like a session to a database, to define the commit and the rollback functions into the cursor object instead of the connection object. A matter of fact, all works in the database are executed in a cursor so I don't understand why the commit and the rollback are outside it. I wait for comments about this motion. Thank you for your interest. Regards. -- Thierry MICHEL Mixadlive Developer ooOO*- PoPy Team Project Manager -*OOoo "Sainthood in the Church of Emacs requires living a life of purity, but in the Church of Emacs, this does not require celibacy." Richard Stallman. From gstein@lyra.org Sun Oct 8 12:01:07 2000 From: gstein@lyra.org (Greg Stein) Date: Sun, 8 Oct 2000 04:01:07 -0700 Subject: [DB-SIG] Opened question ... In-Reply-To: <20001007232911.A1812@takeshi.mixadlive.com>; from thierry@mixadlive.com on Sat, Oct 07, 2000 at 11:29:11PM +0200 References: <20001007232911.A1812@takeshi.mixadlive.com> Message-ID: <20001008040107.D9396@lyra.org> Most databases define commits on a connection basis. All changes from all cursors will be committed. For example, you might have three cursors open, each performing a single function. After their operation, you commit then in bulk. The "parent" of all these cursors is the connection, which is where the commit() method is defined. Cheers, -g On Sat, Oct 07, 2000 at 11:29:11PM +0200, Thierry MICHEL wrote: > Hi, > > I put the follow motion for the DB-API, and I wait for your opinion about it : > > I would make a cursor object like a session to a database, to > define the commit and the rollback functions into the cursor > object instead of the connection object. > A matter of fact, all works in the database are executed in a cursor > so I don't understand why the commit and the rollback are outside it. > > I wait for comments about this motion. > > Thank you for your interest. > Regards. > > -- > Thierry MICHEL > Mixadlive Developer > > ooOO*- PoPy Team Project Manager -*OOoo > > "Sainthood in the Church of Emacs requires living a life of purity, > but in the Church of Emacs, this does not require celibacy." > Richard Stallman. > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://www.python.org/mailman/listinfo/db-sig -- Greg Stein, http://www.lyra.org/ From kadabra@visto.com Tue Oct 10 09:01:20 2000 From: kadabra@visto.com (oto pumerantz) Date: Tue, 10 Oct 2000 01:01:20 -0700 Subject: [DB-SIG] need to import twice ?! Message-ID: <20001010080103.2C06F1CCD2@dinsdale.python.org> i'm trying to use=20 MySQLdb-0.2.2 while in python interpreter, i need to write TWICE the command=20 import MySQLdb in order for it to work, because on the first time it yields ImportError: No module named _mysql have you seen such an error before ? also, after the second time it sometimes (sounds suspicious already...) d= o not=20 recognize the connect() function at all ! i don't even know what query should i feed into google...:-( what's wrong with my installation? Thanx, Oto. --------------------------------! _________________________________________________________________________= __ Visit http://www.visto.com/info, your free web-based communications cente= r. Visto.com. Life on the Dot. From mal@lemburg.com Tue Oct 10 10:07:29 2000 From: mal@lemburg.com (M.-A. Lemburg) Date: Tue, 10 Oct 2000 11:07:29 +0200 Subject: [DB-SIG] need to import twice ?! References: <20001010080103.2C06F1CCD2@dinsdale.python.org> Message-ID: <39E2DC51.BCA0A4F9@lemburg.com> oto pumerantz wrote: > > i'm trying to use > MySQLdb-0.2.2 > > while in python interpreter, > i need to write TWICE the command > import MySQLdb > > in order for it to work, because on the first time it yields > ImportError: No module named _mysql > > have you seen such an error before ? Looks like you have not compiled the C extension (_mysql). The DB module won't work without first compiling the extension or installing a pre-compiled one (e.g. by installing a RPM). > also, after the second time it sometimes (sounds suspicious already...) do not > recognize the connect() function at all ! > > i don't even know what query should i feed into google...:-( > what's wrong with my installation? > > Thanx, Oto. > --------------------------------! > ___________________________________________________________________________ > Visit http://www.visto.com/info, your free web-based communications center. > Visto.com. Life on the Dot. > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://www.python.org/mailman/listinfo/db-sig -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ From PLynch@opus360.com Tue Oct 10 15:31:36 2000 From: PLynch@opus360.com (Patrick Lynch) Date: Tue, 10 Oct 2000 10:31:36 -0400 Subject: [DB-SIG] Need some guidance in regard to the Database connectivity Message-ID: Good morning, I'm a "newbie" so be kind... We are trying to interface JPython (not Python) to both a Micorsoft Access RDBMS and Oracle RDBMS...We probably need to use either mxODBC or JDBC/ODBC bridge or JDBC Driver to do this. We would appreciate any advice that you can give... Thanks, Pat From mal@lemburg.com Tue Oct 10 15:49:37 2000 From: mal@lemburg.com (M.-A. Lemburg) Date: Tue, 10 Oct 2000 16:49:37 +0200 Subject: [DB-SIG] Need some guidance in regard to the Database connectivity References: Message-ID: <39E32C81.B9A7EC96@lemburg.com> Patrick Lynch wrote: > > Good morning, > > I'm a "newbie" so be kind... > > We are trying to interface JPython (not Python) to both a Micorsoft Access > RDBMS and Oracle RDBMS...We probably need to use either mxODBC or JDBC/ODBC > bridge or JDBC Driver to do this. > > We would appreciate any advice that you can give... There's a new DB API module compatible with mxODBC called zxJDBC which provides mxODBC functionality on JPython: http://www.ziclix.com/zxjdbc/ -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ From deirdre@deirdre.net Tue Oct 10 18:57:09 2000 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Tue, 10 Oct 2000 10:57:09 -0700 (PDT) Subject: [DB-SIG] DB2 Python module 0.9 In-Reply-To: <39DD8103.42EE1209@gnu.org> Message-ID: On Fri, 6 Oct 2000, Man-Yong Lee wrote: > Hi, everyone. I've just finished (not completely) IBM DB2 > Python module to use IBM's RDBMS, IBM DB2. This is great news! I'd wanted to do it, but I don't get to use DB2 enough that I had the time to do it. > This is just a 4-day work. So there must be something wrong > but it work anyway. Actually this post is a request for help > and suggestion about my work. Unfortunately, I don't have a DB2 setup right now, but I'll see if I can help test. I'm sure you'll get other willing volunteers. -- _Deirdre * http://www.sfknit.org * http://www.deirdre.net "More damage has been caused by innocent program crashes than by malicious viruses, but they don't make great stories." -- Jean-Louis Gassee, Be Newsletter, Issue 69 From mal@lemburg.com Tue Oct 10 19:18:09 2000 From: mal@lemburg.com (M.-A. Lemburg) Date: Tue, 10 Oct 2000 20:18:09 +0200 Subject: [DB-SIG] DB2 Python module 0.9 References: Message-ID: <39E35D61.52A8F874@lemburg.com> Deirdre Saoirse wrote: > > On Fri, 6 Oct 2000, Man-Yong Lee wrote: > > > Hi, everyone. I've just finished (not completely) IBM DB2 > > Python module to use IBM's RDBMS, IBM DB2. > > This is great news! I'd wanted to do it, but I don't get to use DB2 enough > that I had the time to do it. > > > This is just a 4-day work. So there must be something wrong > > but it work anyway. Actually this post is a request for help > > and suggestion about my work. > > Unfortunately, I don't have a DB2 setup right now, but I'll see if I can > help test. I'm sure you'll get other willing volunteers. FYI, mxODBC compiles just fine against the DB2 CLI (which happens to be ODBC compatible in most respects). You might want to try it. The next mxODBC version will have a preconfigured DB2 subpackage. -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ From deirdre@deirdre.net Tue Oct 10 19:16:21 2000 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Tue, 10 Oct 2000 11:16:21 -0700 (PDT) Subject: [DB-SIG] DB2 Python module 0.9 In-Reply-To: <39E35D61.52A8F874@lemburg.com> Message-ID: On Tue, 10 Oct 2000, M.-A. Lemburg wrote: > FYI, mxODBC compiles just fine against the DB2 CLI (which happens > to be ODBC compatible in most respects). You might want to try > it. The next mxODBC version will have a preconfigured DB2 > subpackage. Yes, I had used it in the past. :) That's one reason why I never got around to writing something DB2-specific -- mxODBC worked well enough. -- _Deirdre * http://www.sfknit.org * http://www.deirdre.net "More damage has been caused by innocent program crashes than by malicious viruses, but they don't make great stories." -- Jean-Louis Gassee, Be Newsletter, Issue 69 From manyong@gnu.org Tue Oct 10 22:32:27 2000 From: manyong@gnu.org (Man-Yong Lee) Date: Wed, 11 Oct 2000 06:32:27 +0900 Subject: [DB-SIG] DB2 Python module 0.9 References: <39E35D61.52A8F874@lemburg.com> Message-ID: <39E38AEB.B4BFF9DF@gnu.org> Hi~ Mr. Lemburg, "M.-A. Lemburg" wrote: > FYI, mxODBC compiles just fine against the DB2 CLI (which > happens > to be ODBC compatible in most respects). You might want to try > it. The next mxODBC version will have a preconfigured DB2 > subpackage. Thanks. I've read that DB2 CLI is almost ODBC compatible in their manual. But I didn't know about the fact that I can use mxODBC in most cases. I'm afraid that my module is very preliminary and immature compared to mxODBC. :) I think I have to run to read mxODBC source code. After finishing IBM's eDay event in Korea yesterday, I've started to work on adding administrative function into DB2 module beyond Python DB API 2.0. Thanks again for your interest and precious information. Have a nice day! -- Happy Python! From brunel@nortelnetworks.com Wed Oct 11 10:41:45 2000 From: brunel@nortelnetworks.com (Eric Brunel) Date: Wed, 11 Oct 2000 11:41:45 +0200 Subject: [DB-SIG] Number of connections problem with ctsybase module References: <20001010160118.78D741CE5A@dinsdale.python.org> Message-ID: <39E435D9.551A7608@europem01.nt.com> Hi everybody, I'm using Python with the ctsybase module to design a server for a database application. I need to open many database connections for the server, but apparently, the ctsybase module limits the number of connections to 25. More simply, if I do the following simple program: import ctsybase l = [] for i in range(30): l.append(ctsybase.ctsybase({'server':'my_server', 'user':'my_user', 'password':'my_password'})) print len(l), the result is: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Traceback (innermost last): File "", line 2, in ? SybaseError: ['failed to connect to server', ('client', 1, 16843014, 'ct_connect(): user api layer: external error: The maximum number of connections have already been opened.', 0, '', 0, '08000')] Does anybody have a solution for this, either via Python or by patching the C code of the ctsybase module? I tried to reach Peter Godman, who created the ctsybase module, but apparently his e-mail address (pgodman@starship.skyport.net) doesn't work anymore. So any help would be appreciated. Thanks a lot. - Eric Brunel - Nortel Networks - From mal@lemburg.com Wed Oct 11 12:32:42 2000 From: mal@lemburg.com (M.-A. Lemburg) Date: Wed, 11 Oct 2000 13:32:42 +0200 Subject: [DB-SIG] Number of connections problem with ctsybase module References: <20001010160118.78D741CE5A@dinsdale.python.org> <39E435D9.551A7608@europem01.nt.com> Message-ID: <39E44FDA.1F2D766A@lemburg.com> Eric Brunel wrote: > > Hi everybody, > > I'm using Python with the ctsybase module to design a server for a database > application. I need to open many database connections for the server, but apparently, > the ctsybase module limits the number of connections to 25. More simply, if I do the > following simple program: > > import ctsybase > l = [] > for i in range(30): > l.append(ctsybase.ctsybase({'server':'my_server', 'user':'my_user', > 'password':'my_password'})) > print len(l), > > the result is: > > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 > Traceback (innermost last): > File "", line 2, in ? > SybaseError: ['failed to connect to server', ('client', 1, 16843014, 'ct_connect(): > user api layer: external error: The maximum number of connections have already been > opened.', 0, '', 0, '08000')] Could be that you only have a 25-user license for Sybase. > Does anybody have a solution for this, either via Python or by patching the C code of > the ctsybase module? I tried to reach Peter Godman, who created the ctsybase module, > but apparently his e-mail address (pgodman@starship.skyport.net) doesn't work anymore. Try the same address @starship.python.net ... the domain has changed. > So any help would be appreciated. > Thanks a lot. > - Eric Brunel - Nortel Networks - > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://www.python.org/mailman/listinfo/db-sig -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ From brunel@nortelnetworks.com Wed Oct 11 15:15:34 2000 From: brunel@nortelnetworks.com (Eric Brunel) Date: Wed, 11 Oct 2000 16:15:34 +0200 Subject: [DB-SIG] Number of connections problem with ctsybase module References: <20001010160118.78D741CE5A@dinsdale.python.org> <39E435D9.551A7608@europem01.nt.com> <39E44FDA.1F2D766A@lemburg.com> Message-ID: <39E47606.E33DF60A@europem01.nt.com> This is a multi-part message in MIME format. --------------30E69998478ECFA6871FA393 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi again, I finally figured it out by myself: this wasn't a problem of limit in the Sybase license, but a limitation to the client library itself. To increase the number of connections, just apply the attached patch to the ctsybasemodule.c source file in the ctsybase module distribution, and it should work. It just changes a parameter in the Sybase context to allow more connections than the default 25. Anyway, thanks for the answer. - Eric - > Eric Brunel wrote: > > > > Hi everybody, > > > > I'm using Python with the ctsybase module to design a server for a database > > application. I need to open many database connections for the server, but apparently, > > the ctsybase module limits the number of connections to 25. More simply, if I do the > > following simple program: > > > > import ctsybase > > l = [] > > for i in range(30): > > l.append(ctsybase.ctsybase({'server':'my_server', 'user':'my_user', > > 'password':'my_password'})) > > print len(l), > > > > the result is: > > > > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 > > Traceback (innermost last): > > File "", line 2, in ? > > SybaseError: ['failed to connect to server', ('client', 1, 16843014, 'ct_connect(): > > user api layer: external error: The maximum number of connections have already been > > opened.', 0, '', 0, '08000')] --------------30E69998478ECFA6871FA393 Content-Type: text/plain; charset=us-ascii; name="no_limits.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="no_limits.patch" 26a27,30 > /* === EB - 10/10/2000: define to enable EB's enhancements */ > #define EB_ENHANCED 1 > /* === */ > 2074a2079,2083 > /* === EB - 10/10/2000: maximum number of connections and return code */ > #ifdef EB_ENHANCED > int maxConnect = 200; /* or whatever value you want */ > #endif > /* === */ 2096a2106 > 2098d2107 < 2102a2112,2124 > > /* === EB - 10/10/2000: trying to increase maximum number of connections */ > #ifdef EB_ENHANCED > retstat = ct_config(PySybContext, CS_SET, CS_MAX_CONNECT, &maxConnect, CS_UNUSED, NULL); > if (retstat != CS_SUCCEED) > { > char msg[128]; > sprintf(msg, "failed to set maximum number of connections [%d]", (int)retstat); > Py_FatalError(msg); > } > #endif > /* === */ > --------------30E69998478ECFA6871FA393-- From mal@lemburg.com Tue Oct 17 10:50:09 2000 From: mal@lemburg.com (M.-A. Lemburg) Date: Tue, 17 Oct 2000 11:50:09 +0200 Subject: [DB-SIG] Building Cross-Platform DB Apps: MetaDB.py Message-ID: <39EC20D1.4A64D3C1@lemburg.com> Hi everybody, this list has been quiet for some time -- looks like everybody is happy with DB API 2.0 (except maybe for some more or less esoteric features ;)... I would like to take this chance to propose working on a new project which should interest everybody planning to write cross-database applications: ---------------------------------------------------------------------- MetaDB.py -- A Knowledge-Base for Database Work ---------------------------------------------------------------------- The idea is to gather information about various database backends, such as MySQL, DB2, Solid, Informix, Oracle, PostgreSQL, etc. and provide an easy to use API which allows to query that information in abstracted ways. E.g. one of the obstacles you often find when porting to a different backend is that data types have different names and sometimes even different features. It would be nice to have an API which formats the column definition depending on some criteria which I pass to the API, e.g. datatype_definition(metatype='string', maxlength=1024000) which then returns the correct data types definition for the backend I chose, e.g. "TEXT" for MySQL or "CLOB" for DB2. Questions: ---------- * What do think about this idea ? * Which requests would you have for such a knowledge-base like module ? Thanks, -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ From gstein@lyra.org Tue Oct 17 11:08:24 2000 From: gstein@lyra.org (Greg Stein) Date: Tue, 17 Oct 2000 03:08:24 -0700 Subject: [DB-SIG] Building Cross-Platform DB Apps: MetaDB.py In-Reply-To: <39EC20D1.4A64D3C1@lemburg.com>; from mal@lemburg.com on Tue, Oct 17, 2000 at 11:50:09AM +0200 References: <39EC20D1.4A64D3C1@lemburg.com> Message-ID: <20001017030824.E26804@lyra.org> On Tue, Oct 17, 2000 at 11:50:09AM +0200, M.-A. Lemburg wrote: >... > Questions: > ---------- > > * What do think about this idea ? Sounds fine. However, I believe that a necessary precondition is a way for multiple people to be able to contribute their info easily into the "body of knowledge". If somebody pipes up on an email list, they may feel that isn't enough to get the info over to the repository. hmm... what I'm trying to say is that capturing data in a mailing list doesn't feel permanent enough to people; to increase contribution, let more people drop the data into the permanent repository. (somehow) > * Which requests would you have for such a knowledge-base like > module ? Types. SQL statements, extensions. DBAPI features unique to a module. SQL functions which are custom to a particular DB. Threading traits. How to specify parameters in a SQL query. (other "optional" features in the DBAPI such as nextset, etc) Cheers, -g -- Greg Stein, http://www.lyra.org/ From tbryan@starship.beopen.com Tue Oct 17 11:52:05 2000 From: tbryan@starship.beopen.com (Tom Bryan) Date: Tue, 17 Oct 2000 03:52:05 -0700 (PDT) Subject: [DB-SIG] Building Cross-Platform DB Apps: MetaDB.py In-Reply-To: <20001017030824.E26804@lyra.org> Message-ID: On Tue, 17 Oct 2000, Greg Stein wrote: > On Tue, Oct 17, 2000 at 11:50:09AM +0200, M.-A. Lemburg wrote: > >... > > Questions: > > ---------- > > > > * What do think about this idea ? > > Sounds fine. > > However, I believe that a necessary precondition is a way for multiple > people to be able to contribute their info easily into the "body of > knowledge". If somebody pipes up on an email list, they may feel that isn't > enough to get the info over to the repository. hmm... what I'm trying to > say is that capturing data in a mailing list doesn't feel permanent enough > to people; to increase contribution, let more people drop the data into the > permanent repository. (somehow) Well, at one point, I set up a FAQ Wizard because people were asking for a collection of code showing how to use the basics of each DB module. I didn't seed it with any entries; I just set it up in case module owners/users wanted to use it. Since it appears to be largely unused, you could turn that FAQ into a gathering of info about each module. http://starship.python.net/crew/tbryan/Database/Snippets/ The password for editing should be albatross If everyone decides to use this FAQ for this purpose, would someone please tell me so that I can change the title and "meta" info in section 1. What might be more helpful would be a whole HTML form with a list of questsions for module owners to answer. The form could then put the information into some consistently formatted document. Not volunteering, just suggesting. :) ---Tom From gstein@lyra.org Tue Oct 17 12:03:02 2000 From: gstein@lyra.org (Greg Stein) Date: Tue, 17 Oct 2000 04:03:02 -0700 Subject: [DB-SIG] Building Cross-Platform DB Apps: MetaDB.py In-Reply-To: ; from tbryan@starship.beopen.com on Tue, Oct 17, 2000 at 03:52:05AM -0700 References: <20001017030824.E26804@lyra.org> Message-ID: <20001017040302.H26804@lyra.org> On Tue, Oct 17, 2000 at 03:52:05AM -0700, Tom Bryan wrote: >... > Well, at one point, I set up a FAQ Wizard because people were asking for a > collection of code showing how to use the basics of each DB module. I > didn't seed it with any entries; I just set it up in case module > owners/users wanted to use it. Since it appears to be largely unused, you Knowing about it is half the battle... I certainly didn't recall this :-) Truly, we need additional people editing the DB Topics area on python.org to keep it up to date with relevant material like this. That problem is similar to what I mentioned re: this body of knowledge -- allow many people in there to work on it. Cheers, -g -- Greg Stein, http://www.lyra.org/ From mal@lemburg.com Tue Oct 17 12:54:57 2000 From: mal@lemburg.com (M.-A. Lemburg) Date: Tue, 17 Oct 2000 13:54:57 +0200 Subject: [DB-SIG] Building Cross-Platform DB Apps: MetaDB.py References: <39EC20D1.4A64D3C1@lemburg.com> <20001017030824.E26804@lyra.org> Message-ID: <39EC3E11.21A14360@lemburg.com> Greg Stein wrote: > > On Tue, Oct 17, 2000 at 11:50:09AM +0200, M.-A. Lemburg wrote: > >... > > Questions: > > ---------- > > > > * What do think about this idea ? > > Sounds fine. > > However, I believe that a necessary precondition is a way for multiple > people to be able to contribute their info easily into the "body of > knowledge". If somebody pipes up on an email list, they may feel that isn't > enough to get the info over to the repository. hmm... what I'm trying to > say is that capturing data in a mailing list doesn't feel permanent enough > to people; to increase contribution, let more people drop the data into the > permanent repository. (somehow) I was thinking of starting with a base class and then have subclasses for all the different backends. The "knowledge" would be written up as subclass of the base class. > > * Which requests would you have for such a knowledge-base like > > module ? > > Types. SQL statements, extensions. DBAPI features unique to a module. SQL > functions which are custom to a particular DB. Threading traits. How to > specify parameters in a SQL query. (other "optional" features in the DBAPI > such as nextset, etc) Looks like a good start. -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ From mal@lemburg.com Wed Oct 18 12:05:34 2000 From: mal@lemburg.com (M.-A. Lemburg) Date: Wed, 18 Oct 2000 13:05:34 +0200 Subject: [DB-SIG] Building Cross-Platform DB Apps: dbinfo.py References: <39EC20D1.4A64D3C1@lemburg.com> <20001017030824.E26804@lyra.org> <39EC3E11.21A14360@lemburg.com> <39ED7077.85C53EF0@lemburg.com> Message-ID: <39ED83FE.D2BF6936@lemburg.com> I've uploaded a new version of the cross-database information module to starship. You can download it from: http://starship.python.net/~lemburg/dbinfo.py (I've renamed the module to dbinfo.py -- seems more accurate) The module contains API for all common data types and their usage in MySQL. I would appreciate feedback in form of new subclasses for other database backends. Thanks, -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ From mal@lemburg.com Wed Oct 18 10:42:15 2000 From: mal@lemburg.com (M.-A. Lemburg) Date: Wed, 18 Oct 2000 11:42:15 +0200 Subject: [DB-SIG] Building Cross-Platform DB Apps: MetaDB.py References: <39EC20D1.4A64D3C1@lemburg.com> <20001017030824.E26804@lyra.org> <39EC3E11.21A14360@lemburg.com> Message-ID: <39ED7077.85C53EF0@lemburg.com> This is a multi-part message in MIME format. --------------7D0E317C8101C2943DEAD030 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Here's a start into the direction I wanted to push this cross-database knowledge base. Note that my intention wasn't to create some kind of FAQ-base, but a Python module (or package in case the beast gets too large) which can be used directly from within Python. Improvements and suggestions for new APIs are welcome. I think I'll put this module up on starship as soon as it reaches a usable size. -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ --------------7D0E317C8101C2943DEAD030 Content-Type: text/python; charset=us-ascii; name="MetaDB.py" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="MetaDB.py" """ Experimental cross-database knowledge base support. """#" __copyright__ = """ (c) Copyright by Marc-Andre Lemburg (mailto:mal@lemburg.com) Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee or royalty is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation or portions thereof, including modifications, that you make. THE AUTHOR MARC-ANDRE LEMBURG DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE ! """#" import exceptions class DatabaseTypeError(exceptions.TypeError): pass class DatabaseInfo: def __init__(self): pass def stringcolumn(self, name, maxlength=254, padding=0, nullable=0, default=None, casesensitive=0): """ Returns a column definition for a string like column type having the given properties. maxlength gives the maximum length of the column in bytes. padding means that values written to the database are right padded with spaces. When reading these values, the database may or may not remove the trailing spaces. When padding is true, the column will have a fixed size in the database. nullable defines whether the column should be allowed to have NULL values or not. Default is not to allows NULL values. Some databases also allow providing default values which are used in case a not nullable column would have to store a NULL value. casesensitive defines how sorting and searching should be done on the column. Binary data should always ba stored in casesensitive columns. """ if padding: raise DatabaseTypeError,\ 'padding of strings not supported' options = '' if maxlength < 256: if padding: coltype = 'char(%i)' % maxlength else: coltype = 'varchar(%i)' % maxlength if casesensitive: coltype = coltype + ' binary' elif maxlength < 65536: if casesensitive: coltype = 'blob' else: coltype = 'text' elif maxlength < 167772152: if casesensitive: coltype = 'mediumblob' else: coltype = 'mediumtext' elif maxlength <= 4294967296L: if casesensitive: coltype = 'mediumblob' else: coltype = 'mediumtext' else: raise DatabaseTypeError,\ 'string too long' s = '%s %s' % (name, coltype) if not nullable: s = s + ' not null' if default is not None: s = s + ' default %s' % repr(default) return s # The base class provides information valid for MySQL MySQLInfo = DatabaseInfo ### Testing if __name__ == '__main__': info = MySQLInfo() --------------7D0E317C8101C2943DEAD030-- From crunch@webcrunchers.com Thu Oct 19 08:22:04 2000 From: crunch@webcrunchers.com (John) Date: Thu, 19 Oct 2000 00:22:04 -0700 Subject: [DB-SIG] What is the current status... Message-ID: <39EEA11A.723672CD@webcrunchers.com> I got here through a link from the Database API specification. I would like to know the BEST standard to use out there, so I can establish an IP connection from my machine to as many different kinds of databases as possible. I like this specification, it looks really good. But are people following it? and if so, I would like to be able to rely on it to allow me to reach the most databases. References to projects that use this standard would be appreciated. Regards John D. - shopip.com From KuznecA@micex.com Thu Oct 19 08:31:56 2000 From: KuznecA@micex.com (=?koi8-r?Q?=EB=D5=DA=CE=C5=C3=CF=D7_=E1=CC=C5=CB=D3=C1=CE=C4=D2?=) Date: Thu, 19 Oct 2000 11:31:56 +0400 Subject: [DB-SIG] What is the current status... Kinterbasdb Message-ID: This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C0399E.A8B564D0 Content-Type: text/plain; charset="koi8-r" Kinterbasdb does implement DB-API 2.0 See http://kinterbasdb.sourceforge.net/ Info on Kinterbasdb at Python site is obsolete. Does anybody know who drivers the database topic at www.python.org? Alexander Kuznetsov KuznecA@micex.com > -----Original Message----- > From: John [mailto:crunch@webcrunchers.com] > Sent: Thursday, October 19, 2000 11:22 AM > To: db-sig@python.org > Subject: [DB-SIG] What is the current status... > > > I got here through a link from the Database API > specification. I would > like to know the BEST standard to use out there, so I can establish > an IP connection from my machine to as many different kinds > of databases > as possible. > > I like this specification, it looks really good. But are people > following it? and if so, I would like to be able to rely on it to > allow me to reach the most databases. > > References to projects that use this standard would be appreciated. > > Regards > John D. - shopip.com > > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://www.python.org/mailman/listinfo/db-sig > ------_=_NextPart_001_01C0399E.A8B564D0 Content-Type: text/html; charset="koi8-r" Content-Transfer-Encoding: quoted-printable RE: [DB-SIG] What is the current status... Kinterbasdb

Kinterbasdb does implement DB-API 2.0
See http://kinterbasdb.sourceforge.net/

Info on Kinterbasdb at Python site is obsolete. =
Does anybody know who drivers the database topic at = www.python.org?

Alexander Kuznetsov
KuznecA@micex.com

> -----Original Message-----
> From: John [mailto:crunch@webcrunchers.com]
> Sent: Thursday, October 19, 2000 11:22 = AM
> To: db-sig@python.org
> Subject: [DB-SIG] What is the current = status...
>
>
> I got here through a link from the Database API =
> specification.   I would
> like to know the BEST standard to use out = there,    so I can establish
> an IP connection from my machine to as many = different kinds
> of databases
> as possible.
>
> I like this specification,    it = looks really good.    But are people
> following it?   and if = so,   I would like to be able to rely on it to
> allow me to reach the most databases.
>
> References to projects that use this standard = would be appreciated.
>
> Regards
> John D.  - shopip.com
>
>
> = _______________________________________________
> DB-SIG maillist  -  = DB-SIG@python.org
>
http://www.python.org/mailman/listinfo/db-sig
>

------_=_NextPart_001_01C0399E.A8B564D0-- From akuchlin@mems-exchange.org Thu Oct 19 15:01:29 2000 From: akuchlin@mems-exchange.org (Andrew Kuchling) Date: Thu, 19 Oct 2000 10:01:29 -0400 Subject: [DB-SIG] What is the current status... Kinterbasdb In-Reply-To: ; from KuznecA@micex.com on Thu, Oct 19, 2000 at 11:31:56AM +0400 References: Message-ID: <20001019100129.A14555@kronos.cnri.reston.va.us> On Thu, Oct 19, 2000 at 11:31:56AM +0400, Kuznecov Aleksandr wrote: >Info on Kinterbasdb at Python site is obsolete. >Does anybody know who drivers the database topic at www.python.org? I do. But I thought I updated the information last week, pointing the Kinterbasdb link to the SourceForge site and dropping a few modules that seem to be obsolete. --amk From deirdre@deirdre.net Fri Oct 20 00:55:36 2000 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Thu, 19 Oct 2000 16:55:36 -0700 (PDT) Subject: [DB-SIG] A little example for MySql Message-ID: I hadn't used the MySql bindings before, so I created a little example that I thought was clearer than the one included with Andy Dustman's MySql bindings for python. You may need to change the db, user and pass though. #!/usr/bin/python # Written by Deirdre Saoirse Moen, TiVo, Inc. # Feel free to use for any purpose import MySQLdb import traceback import sys def tryordie(stmt): global cursor try: cursor.execute(stmt) except: print traceback.print_exc() mydb.close() sys.exit() # begin main program here try: mydb = MySQLdb.Connect(db='test', user='foo', passwd='bar') cursor = mydb.cursor() except: print "\n\n" traceback.print_exc() sys.exit() # try and create the table, but if it doesn't exist, don't harf stmt = "CREATE TABLE COLORS (COLOR varchar(32) DEFAULT '' NOT NULL)" try: cursor.execute(stmt) except: pass stmt = "DELETE FROM COLORS" tryordie(stmt) stmt = "INSERT INTO COLORS VALUES ('red')" tryordie(stmt) stmt = "INSERT INTO COLORS VALUES ('blue')" tryordie(stmt) stmt = "INSERT INTO COLORS VALUES ('yellow')" tryordie(stmt) # grand finale test stmt = "select * from COLORS" tryordie(stmt) try: resultSet = cursor.fetchall() for i in xrange(0, len(resultSet)): print "Color number",i,"is", resultSet[i][0] except: pass mydb.close() -- _Deirdre * http://www.sfknit.org * http://www.deirdre.net "You had thesaurus flakes for breakfast again, didn't you?" -- Eric Williams From kthangavelu@earthlink.net Fri Oct 20 17:40:12 2000 From: kthangavelu@earthlink.net (Ender) Date: Fri, 20 Oct 2000 09:40:12 -0700 Subject: [DB-SIG] Updating DB module list Message-ID: <39F0756C.9EB7091B@earthlink.net> there are currently three DBI-2.0 compliant interfaces to postgres, none of which are listed on the db page. could this be updated on the page. www.mixadlive.com www.sourceforge.net/projects/pgsql www.druid.net kapil From zen@cs.rmit.edu.au Sat Oct 21 01:05:59 2000 From: zen@cs.rmit.edu.au (Stuart Bishop) Date: Sat, 21 Oct 2000 11:05:59 +1100 (EST) Subject: [DB-SIG] Building Cross-Platform DB Apps: MetaDB.py In-Reply-To: <39ED7077.85C53EF0@lemburg.com> Message-ID: On Wed, 18 Oct 2000, M.-A. Lemburg wrote: > Improvements and suggestions for new APIs are welcome. I think > I'll put this module up on starship as soon as it reaches a > usable size. Will it be possible for code to create a dbinfo object using just a connection handle? It may be worth adding a new method to the connection object into the next rev of the DB spec if people are happy with the MetaDB concept. Anyone know their ANSI SQL '92 standard well enough to write a generic dbinfo object? This would probably end up as the implementation or at least a superclass for any database that has ODBC or JDBC interfaces (since I believe that both of these require SQL'92 level 2 compliance). I'm unsure about the case sensitivity options in the example implementation. I guess that databases that don't have 'caseinsensitive string' types (I really only know Oracle) will just have to throw an exception. However, there is usually some way of doing case insensitive comparisions. Is it worth adding methods to help build (simple) generic SQL? Would anything else be required besides a comparision generator? I think that all of the the NOT, AND, OR stuff can be done if you write ANSI SQL. I can't remember if there is a standard way of specifying outer joins :-( class OraInfo: def join(self,o1,o2,**kw): '''Should allow more than two arguments, creating a statement using the IN operator''' qo1 = self.quote(o1) qo2 = self.quote(o2) if qo1 is None and qo2 is None: return '' elif qo1 is None: return '%s IS NULL' % (qo2) elif qo2 is None: return '%s IS NULL' % (qo1) elif kw['casesensitive'] == 1: return '%s=%s' % (qo1,qo2) else: # Should ensure string type. return 'UPPER(%s)=UPPER(%s)' % (qo1,qo2) -- Stuart Bishop Work: zen@cs.rmit.edu.au Senior Systems Alchemist Play: zen@shangri-la.dropbear.id.au Computer Science, RMIT University From darcy@druid.net Sat Oct 21 03:13:18 2000 From: darcy@druid.net (D'Arcy J.M. Cain) Date: Fri, 20 Oct 2000 22:13:18 -0400 (EDT) Subject: [DB-SIG] Updating DB module list In-Reply-To: <39F0756C.9EB7091B@earthlink.net> "from Ender at Oct 20, 2000 09:40:12 am" Message-ID: Thus spake Ender > there are currently three DBI-2.0 compliant interfaces to postgres, none > of which are listed on the db page. could this be updated on the page. > > www.mixadlive.com > www.sourceforge.net/projects/pgsql > www.druid.net That's http://www.druid.net/pygresql/ unless my family really interest you. :-) -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner. From margaret_mccarthy@hp.com Sat Oct 21 13:26:09 2000 From: margaret_mccarthy@hp.com (MCCARTHY,MARGARET (HP-UnitedKingdom,ex2)) Date: Sat, 21 Oct 2000 14:26:09 +0200 Subject: [DB-SIG] Sybase Module.. Message-ID: <0B9A57FF1D57D411B47500D0B73E5CC19FE74D@dickens.bri.hp.com> Hi, I am new to Python and would like to be able to get a Sybase API Module for Python. Peter Godman's link is broken: (http://starship.python.net/crew/pgodman/) which is a link from http://www.python.org/topics/database/modules.html Cheers, Mags. From mal@lemburg.com Mon Oct 23 14:32:14 2000 From: mal@lemburg.com (M.-A. Lemburg) Date: Mon, 23 Oct 2000 15:32:14 +0200 Subject: [DB-SIG] Building Cross-Platform DB Apps: dbinfo.py References: Message-ID: <39F43DDE.55328C12@lemburg.com> Stuart Bishop wrote: > > On Wed, 18 Oct 2000, M.-A. Lemburg wrote: > > > Improvements and suggestions for new APIs are welcome. I think > > I'll put this module up on starship as soon as it reaches a > > usable size. > > Will it be possible for code to create a dbinfo object using > just a connection handle? It may be worth adding a new method > to the connection object into the next rev of the DB spec if people > are happy with the MetaDB concept. The DBInfo objects probably won't need a connection object. DBs could simply make use of whichever class is necessary, e.g. the MySQL module would use MySQLInfo, DCOracle the OracleInfo class, etc. But yes, since the code is written in Python, we could easily add a new method to the connection object which then returns the right DBInfo singleton, e.g. connection.getinfo(). BTW, I've renamed it dbinfo.py. > Anyone know their ANSI SQL '92 standard well enough to write > a generic dbinfo object? This would probably end up as the > implementation or at least a superclass for any database that has ODBC > or JDBC interfaces (since I believe that both of these require SQL'92 > level 2 compliance). I think it would make a good baseclass... > I'm unsure about the case sensitivity options in the example implementation. > I guess that databases that don't have 'caseinsensitive string' types > (I really only know Oracle) will just have to throw an exception. > However, there is usually some way of doing case insensitive > comparisions. > > Is it worth adding methods to help build (simple) generic SQL? Yes, I think so, e.g. many DBs support joins, but there doesn't seem to be a standard for the syntax. Also there are some things which tend to become annoying when writing DB-independent code: e.g. MySQL doesn't support server side cursors, so the client will always load the entire result set. This is find for small result sets, but think of what happens when you want to page through a result set at 10 rows at a time... fortunately, MySQL support the "limit x,y" syntax, but again, that's DB-specific and even though some DBs do support that syntax as well, their semantics are different :-( > Would > anything else be required besides a comparision generator? I think that > all of the the NOT, AND, OR stuff can be done if you write ANSI SQL. > I can't remember if there is a standard way of specifying outer joins :-( > > class OraInfo: > def join(self,o1,o2,**kw): Shouldn't this be named "compare(self, left, right, casesensitive=1)" ?! > '''Should allow more than two arguments, creating a > statement using the IN operator''' > qo1 = self.quote(o1) > qo2 = self.quote(o2) > > if qo1 is None and qo2 is None: > return '' > > elif qo1 is None: > return '%s IS NULL' % (qo2) > > elif qo2 is None: > return '%s IS NULL' % (qo1) > > elif kw['casesensitive'] == 1: > return '%s=%s' % (qo1,qo2) > > else: > # Should ensure string type. > return 'UPPER(%s)=UPPER(%s)' % (qo1,qo2) Thanks, -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ From zen@cs.rmit.edu.au Mon Oct 23 22:11:13 2000 From: zen@cs.rmit.edu.au (Stuart Bishop) Date: Tue, 24 Oct 2000 08:11:13 +1100 (EST) Subject: [DB-SIG] Building Cross-Platform DB Apps: dbinfo.py In-Reply-To: <39F43DDE.55328C12@lemburg.com> Message-ID: On Mon, 23 Oct 2000, M.-A. Lemburg wrote: > Shouldn't this be named "compare(self, left, right, casesensitive=1)" ?! Yes - and the minor errors fixed too :-) > > if qo1 is None and qo2 is None: if o1 is None and o2 is None: -- Stuart Bishop Work: zen@cs.rmit.edu.au Senior Systems Alchemist Play: zen@shangri-la.dropbear.id.au Computer Science, RMIT University From adustman@comstar.net Tue Oct 24 19:42:05 2000 From: adustman@comstar.net (Andy Dustman) Date: Tue, 24 Oct 2000 14:42:05 -0400 (EDT) Subject: [DB-SIG] Re: A little example for MySql In-Reply-To: Message-ID: There are actually a lot of things about that example I don't care for. One is a gratituous use of try ... except clauses (i.e. the except does what the Python interpreter does when there is no except). Another is the use of * in SQL and default columns on INSERT. And then there are several single-row INSERTs into the same table. So here's a modified version that uses a few more features of Python, MySQL, and MySQLdb, and, IMHO, is a lot more comprehensible. #!/usr/bin/python import MySQLdb mydb = MySQLdb.Connect(db='test') cursor = mydb.cursor() # create a new table, dropping the old one if it exists stmt = "DROP TABLE IF EXISTS COLORS" cursor.execute(stmt) stmt = """CREATE TABLE COLORS ( COLOR varchar(32) DEFAULT '' NOT NULL, NCOLOR INT UNSIGNED NOT NULL AUTO_INCREMENT, PRIMARY KEY (NCOLOR) )""" cursor.execute(stmt) # multi-row insert colors = ( ('red',), ('blue',), ('yellow',), ) stmt = "INSERT INTO COLORS (COLOR) VALUES (%s)" cursor.executemany(stmt, colors) # grand finale test stmt = "select NCOLOR, COLOR from COLORS" cursor.execute(stmt) resultSet = cursor.fetchall() for i, color in resultSet: print "Color number",i,"is", color mydb.close() -- andy dustman | programmer | comstar.net is part of the Globix network telephone: 770.485.6025 / 706.549.7689 | icq: 32922760 | pgp: 0xc72f3f1d "Therefore, sweet knights, if you may doubt your strength or courage, come no further, for death awaits you all, with nasty, big, pointy teeth!" From deirdre@deirdre.net Tue Oct 24 19:49:43 2000 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Tue, 24 Oct 2000 11:49:43 -0700 (PDT) Subject: [DB-SIG] Re: [Tutor] Re: A little example for MySql In-Reply-To: Message-ID: On Tue, 24 Oct 2000, Andy Dustman wrote: > There are actually a lot of things about that example I don't care > for. One is a gratituous use of try ... except clauses (i.e. the > except does what the Python interpreter does when there is no except). > Another is the use of * in SQL and default columns on INSERT. And then > there are several single-row INSERTs into the same table. Yeah, I could have used multi-row inserts but I chose not to; I think a single row insert is easier to understand but, for a simple example, having one of each might have been a better idea. Still, either way, the examples (either of ours) are more concise and comprehensible than what ships with the MySql bindings. -- _Deirdre * http://www.sfknit.org * http://www.deirdre.net "You had thesaurus flakes for breakfast again, didn't you?" -- Eric Williams