From msanchez@grupoburke.com Sun Sep 1 09:31:17 2002 From: msanchez@grupoburke.com (Marcos =?ISO-8859-1?Q?S=E1nchez?= Provencio) Date: 01 Sep 2002 10:31:17 +0200 Subject: [DB-SIG] Accessing MSSQL from Python In-Reply-To: <3D70DA1F.1050008@lemburg.com> References: <20020828095345.GW12279@glas.net> <17743.195.53.212.39.1030531668.squirrel@www.grupoburke.com> <3D70DA1F.1050008@lemburg.com> Message-ID: <1030869077.1771.22.camel@renata.macondo.pri> I had missed that point, thank you. El s=E1b, 31-08-2002 a las 17:00, M.-A. Lemburg escribi=F3: >=20 >=20 > Marcos S=E1nchez Provencio wrote: > > That could be useful. Do you mean > >=20 > > MSSQL - FreeTDS - [unix]ODBC - mxODBC - Python > >=20 > > ? > >=20 > > Has anybody tried that? Anyway, I'd rather skip ODBC. >=20 > That procedure is described on the FreeTDS web-page, > so I suppose it works. The advantage here is that you can > easily port your program between Unix and Windows machines > without changing a single line of code. >=20 > >>On Wed, Aug 28, 2002 at 11:51:18AM +0200, Marcos S=E1nchez Provencio > >>wrote: > >> > >>>Hello there. > >>> > >>>Is there some portable way (I mean non-MS) to access MSSQL from > >>>Python? FreeTDS has a Python page which is absolutely blank. > >> > >>ODBC? (i mean mxODBC package, for instance) >=20 > --=20 > Marc-Andre Lemburg > CEO eGenix.com Software GmbH > _______________________________________________________________________ > eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,... > Python Consulting: http://www.egenix.com/ > Python Software: http://www.egenix.com/files/python/ From msanchez@grupoburke.com Sun Sep 1 09:42:15 2002 From: msanchez@grupoburke.com (Marcos =?ISO-8859-1?Q?S=E1nchez?= Provencio) Date: 01 Sep 2002 10:42:15 +0200 Subject: [DB-SIG] How to return results from stored procedures in Oracle In-Reply-To: <3D70EA58.1040700@halfcooked.com> References: <20020830171655.C780@edelweiss.hyperborea.it> <1030723046.22208.198.camel@chl0151.edmonton.computronix.com> <1030790422.1025.19.camel@renata.macondo.pri> <3D70EA58.1040700@halfcooked.com> Message-ID: <1030869736.988.30.camel@renata.macondo.pri> El s=E1b, 31-08-2002 a las 18:10, Andy Todd escribi=F3: > Marcos S=E1nchez Provencio wrote: > > Hello there. > >=20 > > In TSQL (the procedural language used in Sybase and MSSQL) it is very > > simple to return rows from a procedure and use it as a query issued by > > the user dinamically. I have managed to do get the same effect in ADO/V= B > > using a rather contrived mechanism which involved putting the procedure > > in a package and returning some type (cursor, I think). > >=20 > > How can I get it using DBAPI in Oracle? How about PostgreSQL? > >=20 > > What I want is something like > >=20 > > --TSQL code-- > >=20 > > create procedure onlyone @id int > > as > > select * from mytable where id=3D@id > >=20 > > --END TSQL code-- > >=20 > > So, for example, I can give permissions to access the data one by one, > > knowing the id in advance. > >=20 > >=20 > > _______________________________________________ > > DB-SIG maillist - DB-SIG@python.org > > http://mail.python.org/mailman/listinfo/db-sig > >=20 >=20 > In Oracle, return a collection from your stored *function* >=20 > http://download-uk.oracle.com/docs/cd/A87860_01/doc/index.htm >=20 > In other words return a TABLE or a VARRAY from your stored function and=20 > see what happens. >=20 > I haven't tried this using either of the DB-API modules for Oracle=20 > (DCOracle2 and cx_Oracle) so I can't confirm whether it works or not. >=20 > The reason I haven't tried it is because if I use stored procedures or=20 > functions I tend to make them pretty self contained and only return a=20 > status field. If you want to get a set of data into your Python program=20 > then just write a select statement and get the set using a cursor. >=20 > By returning a set of data as a result of a stored function it would=20 > seem you are trying to dome some work in one place and the rest in=20 > another. If you start doing half of a transaction in a stored procedure=20 > and half in Python then only bad things can happen <0.5 wink> >=20 > Of course, YMMV. >=20 I mean the case in which the objective of the procedure (the name function would be more correct, I agree) is to return the data, not to do any data processing at all. It is very useful to return data to Crystal Reports (client/server) and save bandwidth by doing _all_ the data processing in the server, for example. I also have two versions of an 'application explorer', in VB and Python, and I try to move all the functions into the data server to make them completely compatible. I will try the various options offered in the list and tell you about the results. Thank you. > Regards, > Andy > --=20 > ---------------------------------------------------------------------- > From the desk of Andrew J Todd esq - http://www.halfcooked.com >=20 >=20 > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig From andy47@halfcooked.com Sun Sep 1 12:52:56 2002 From: andy47@halfcooked.com (Andy Todd) Date: Sun, 01 Sep 2002 12:52:56 +0100 Subject: [DB-SIG] How to return results from stored procedures in Oracle References: <20020830171655.C780@edelweiss.hyperborea.it> <1030723046.22208.198.camel@chl0151.edmonton.computronix.com> <1030790422.1025.19.camel@renata.macondo.pri> <3D70EA58.1040700@halfcooked.com> <1030869736.988.30.camel@renata.macondo.pri> Message-ID: <3D71FF98.6040606@halfcooked.com> Marcos Sánchez Provencio wrote: > El sáb, 31-08-2002 a las 18:10, Andy Todd escribió: > >>Marcos Sánchez Provencio wrote: >> [snip original question and response] >> >>Of course, YMMV. >> > > I mean the case in which the objective of the procedure (the name > function would be more correct, I agree) is to return the data, not to > do any data processing at all. It is very useful to return data to > Crystal Reports (client/server) and save bandwidth by doing _all_ the > data processing in the server, for example. I also have two versions of > an 'application explorer', in VB and Python, and I try to move all the > functions into the data server to make them completely compatible. > > I will try the various options offered in the list and tell you about > the results. Thank you. > > In that case I would try a slightly different approach. Returning the results of a select and some calculations from a stored procedure is the common approach in Sybase and SQL Server but is achieved in a different way when you've got an Oracle back end - of course. Oracle allows you to include *functions* in the SELECT clause of your SQL statement. Thus, instead of fetching your data and applying modifications to it in a stored code module you can simply write your modification code and include it in your select statement. Suppose you want to calculate the tax payable on an invoice amount when you get the data from invoices table. The Oracle solution would be to specify a calculation function; FUNCTION calc_tax( p_inv_amt IN NUMBER ) IS /* Obviously you wouldn't define this here */ l_tax_rate = 0.15; BEGIN RETURN p_inv_amt * l_tax_rate; END calc_tax; And then in your select statement; SELECT invoice_amt, calc_tax(invoice_amt) tax_amt FROM invoices WHERE invoice_date < sysdate - 7; And Bob is - indeed - your Auntie's live in lover. HTH, Andy By the way, functions and procedures ARE different creatures in PL/SQL. See http://download-uk.oracle.com/docs/cd/A87860_01/doc/appdev.817/a76939/adg10pck.htm#696 Note the difference is that procedures don't return a value but functions must. Hence you can only use functions in your SQL statements. -- ---------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com From haering_postgresql@gmx.de Sun Sep 1 15:14:38 2002 From: haering_postgresql@gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Sun, 1 Sep 2002 16:14:38 +0200 Subject: [DB-SIG] http://www.python.org/topics/database/DatabaseAPI-2.0.html In-Reply-To: <000001c25037$c48614a0$262a949f@konts.lv> References: <20020830171655.C780@edelweiss.hyperborea.it> <000001c25037$c48614a0$262a949f@konts.lv> Message-ID: <20020901141438.GA860@lilith.ghaering.test> * Jekabs Andrushaitis [2002-08-30 17:13 +0200]: > If I understood the question here correctly - I am looking for answer to it > too. > I am using PostgreSQL however, but I have tables with fields whose > default values are taken from sequence. Since I need to know the > primary key value for record directly after insertion, I am fetching > next value from sequence seperately, and only then inserting the row > into table with primary key field value supplied. > > Is there a way to easily fetch the field values for inserted row after > insert statement execution? I have exerimented with this, too and found two options, using pyPgSQL. Here's one that is almost evil ;-) I'm assuming a table TEST, the table definition doesn't really matter, as far as the primary id column is called "id" and is the first column in the table definition. Here's the server-side code. create table test ( id serial, name varchar(20), age int ); create or replace function test_ins(varchar[]) returns integer as ' declare new_id integer; parms alias for $1; i int := 1; statement varchar(4000); begin select nextval(\'test_id_seq\') into new_id; statement := \'insert into test values (\'; statement := statement || to_char(new_id, ''9999999999999999999999''); while parms[i] loop statement := statement || '','' || parms[i]; i := i + 1; end loop; statement := statement || '');''; execute statement; return new_id; end; ' language 'plpgsql'; Now we need to call this PostgreSQL function from Python code. Unfortunately, I had problems using cursor.callproc(), so for the moment, I'm just using cursor.execute(). We need to pass /all/ parameters in the table definition, in the right order, quote them appropriately so the server-side function can put them into the INSERT statement, then wrap them up into a PostgreSQL VARCHAR array and send them over: from pyPgSQL import PgSQL db = PgSQL.connect() cursor = db.cursor() cursor.execute("select test_ins(%s)", ([map(PgSQL._quote, ['Gerhard', 25])]),) last_id = cursor.fetchone()[0] cursor.execute("select * from test where id=%s", (last_id,)) print cursor.fetchone() db.commit() I agree that this is not nice, but seems to work. Now for a less hackish solution ;-) It's not completely finished, yet - I need to find a way to properly implement getdb(), perhaps I'll build a context class or some such: from __future__ import nested_scopes from pyPgSQL import PgSQL db = PgSQL.connect() def getdb(): return db def generic_insert(tablename, **kwargs): cursor = getdb().cursor() sql = "INSERT INTO %s(%s) VALUES" % \ (tablename, ", ".join(kwargs.keys())) sql = sql + "(" + ",".join(["%s"] * len(kwargs) ) + ")" cursor.execute(sql, kwargs.values()) cursor.execute("SELECT CURRVAL('%s_ID_SEQ')" % tablename) return cursor.fetchone()[0] def generic_update(tablename, id, **kwargs): cursor = getdb().cursor() sets = ", ".join([k + "=%s" for k in kwargs.keys()]) statement = "UPDATE %s SET %s WHERE ID=%%s" % \ (tablename, sets) cursor.execute(statement, kwargs.values() + [id]) def generic_delete(tablename, id): cursor = getdb().cursor() statement = "DELETE FROM %s WHERE id=%%s" % tablename cursor.execute(statement, (id,)) def make_functions(tablename): globals()[tablename + "_INSERT"] = lambda **kwargs: generic_insert(tablename, **kwargs) globals()[tablename + "_UPDATE"] = lambda id, **kwargs: generic_update(tablename, id, **kwargs) globals()[tablename + "_DELETE"] = lambda id: generic_delete(tablename, id) make_functions("TEST") cursor = db.cursor() cursor.execute("delete from test") id = TEST_INSERT(name="fooz", age=26) id = TEST_INSERT(name="foo", age=25) TEST_UPDATE(id, name="bar") TEST_DELETE(id) cursor.execute("select * from test") print cursor.fetchall() HTH, Gerhard -- mail: gerhard bigfoot de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id AD24C930 public key fingerprint: 3FCC 8700 3012 0A9E B0C9 3667 814B 9CAA AD24 C930 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) From bkline@rksystems.com Sun Sep 1 21:40:14 2002 From: bkline@rksystems.com (Bob Kline) Date: Sun, 1 Sep 2002 16:40:14 -0400 (EDT) Subject: [DB-SIG] How to return results from stored procedures in Oracle In-Reply-To: <1030818805.1772.3.camel@localhost> Message-ID: Marcos S=E1nchez Provencio wrote: > In TSQL (the procedural language used in Sybase and MSSQL) it is > very simple to return rows from a procedure and use it as a query > issued by the user dinamically. [...] How can I get it using DBAPI > in Oracle? $ cat toraproc.sql CREATE OR REPLACE PACKAGE tprocpkg AS TYPE t_curs IS REF CURSOR; PROCEDURE tproc(id_p INT, rs IN OUT t_curs); END tprocpkg; / CREATE OR REPLACE PACKAGE BODY tprocpkg AS PROCEDURE tproc(id_p INT, rs IN OUT t_curs) AS BEGIN OPEN rs FOR SELECT name, account_status FROM tt WHERE id =3D id_p; END; END; / $ cat toraproc.py #!/usr/bin/python import DCOracle2, mydb conn =3D DCOracle2.connect(mydb.getConnectionString()) curs =3D conn.cursor() curs.callproc("tprocpkg.tproc", 42, curs) name, status =3D curs.fetchone() print "name is %s; status id %s" % (name, status) $ ./toraproc.py name is Doug Adams; status is alive One caveat: the DCOracle2 implementation deviates from the DBAPI spec, which calls for the parameters to the procedure to be passed as a single argument containing a sequence, whereas DCOracle2 expects a separate argument (as given above) for each procedure parameter. --=20 Bob Kline mailto:bkline@rksystems.com http://www.rksystems.com From Billy G. Allie" --==_Exmh_-827310966P Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable * Jekabs Andrushaitis [2002-08-30 17= :13 = +0200]: > If I understood the question here correctly - I am looking for answer t= o it > too. > I am using PostgreSQL however, but I have tables with fields whose > default values are taken from sequence. Since I need to know the > primary key value for record directly after insertion, I am fetching > next value from sequence seperately, and only then inserting the row > into table with primary key field value supplied. > = > Is there a way to easily fetch the field values for inserted row after > insert statement execution? With PostgreSQL, you can get the last inserted sequence number using = currval(). This is transaction specific ... The value returned is the l= ast = sequence number in the current transaction. For example: create table testit (a serial primary key, b text); begin; insert into testit (b) values ('hello world'); = select currval('testit_a_seq'); commit; This will insert the new record and the 'select currval(...)' will return= the = assigned sequence number. Doing this outside a transaction will return the last used sequence numbe= r, no = matter which transaction caused it to be generated. I hope this helps. = -- = ____ | Billy G. Allie | Domain....: Bill.Allie@mug.org | /| | 7436 Hartwell | MSN.......: B_G_Allie@email.msn.com |-/-|----- | Dearborn, MI 48126| |/ |LLIE | (313) 582-1540 | --==_Exmh_-827310966P Content-Type: application/pgp-signature -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable * Jekabs Andrushaitis [2002-08-30 17= :13 = +0200]: > If I understood the question here correctly - I am looking for answer t= o it > too. > I am using PostgreSQL however, but I have tables with fields whose > default values are taken from sequence. Since I need to know the > primary key value for record directly after insertion, I am fetching > next value from sequence seperately, and only then inserting the row > into table with primary key field value supplied. > = > Is there a way to easily fetch the field values for inserted row after > insert statement execution? With PostgreSQL, you can get the last inserted sequence number using = currval(). This is transaction specific ... The value returned is the l= ast = sequence number in the current transaction. For example: create table testit (a serial primary key, b text); begin; insert into testit (b) values ('hello world'); = select currval('testit_a_seq'); commit; This will insert the new record and the 'select currval(...)' will return= the = assigned sequence number. Doing this outside a transaction will return the last used sequence numbe= r, no = matter which transaction caused it to be generated. I hope this helps. = - -- = ____ | Billy G. Allie | Domain....: Bill.Allie@mug.org | /| | 7436 Hartwell | MSN.......: B_G_Allie@email.msn.com |-/-|----- | Dearborn, MI 48126| |/ |LLIE | (313) 582-1540 | -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.2 (UnixWare) Comment: Exmh version 2.2 06/23/2000 iD8DBQE9cxMDnmIkMXoVVdURApfjAKClsdgMMxXk4vGh5KRFompuD9hjjgCff5qM keABBozEScTLbbUwgYaXKcw= =W9xY -----END PGP SIGNATURE----- --==_Exmh_-827310966P-- From mal@lemburg.com Mon Sep 2 08:52:22 2002 From: mal@lemburg.com (M.-A. Lemburg) Date: Mon, 02 Sep 2002 09:52:22 +0200 Subject: [DB-SIG] How to return results from stored procedures in Oracle References: <3D70EA58.1040700@halfcooked.com> <1030818805.1772.3.camel@localhost> <20020831190625.GA4323@lilith.ghaering.test> Message-ID: <3D7318B6.1090308@lemburg.com> Gerhard H=E4ring wrote: > * Anthony Tuininga [2002-08-31 12:33 -0600]: >=20 >>On Sat, 2002-08-31 at 10:10, Andy Todd wrote: >> >>>In Oracle, return a collection from your stored *function* >>> >>>http://download-uk.oracle.com/docs/cd/A87860_01/doc/index.htm >>> >>>In other words return a TABLE or a VARRAY from your stored function an= d=20 >>>see what happens. >> >>Right. Or you can return a ref cursor. >> >> >>>I haven't tried this using either of the DB-API modules for Oracle=20 >>>(DCOracle2 and cx_Oracle) so I can't confirm whether it works or not. >> >>Both of these work in cx_Oracle. You do have to use non DB-API >>constructs because the DB-API doesn't cover this very well. It seems to >>cover returning a result set (and thus using fetchxxx() methods) but >>does not handle arrays or complex data types at all. >=20 >=20 > I plan to implement that for the next major release of pyPgSQL. As I > know the type that a PostgreSQL function returned I can wrap it into an > appropriate class, if it is a REFCURSOR. So that I can then do: >=20 > cursor.callproc("myfunc", 2) > sp_cursor =3D cursor.fetchone()[0] # ref. cursor that stored proced= ure > # returns > for row in sp_cursor.fetchall(): > # do stuff >=20 > instead of: >=20 > cursor.callproc("myfunc", 2) > cursorname =3D cursor.fetchone()[0] > cursor.execute('fetch all in "%s"' % cursorname) >=20 > for row in cursor.fetchall(): > # do stuff >=20 > IOW wrap the returned Cursor object with a special class, that has > fetchone(), fetchmany(), fetchall(), scroll(), __iter__, next(), close(= ) > and perhaps something I forgot about :) >=20 > Any comments? Would this be against the intention of the DB-API? I think that your second approach is cleaner and also clearer since it makes the interaction between your Python program and the database explicit. BTW, how is the indirection of using a ref cursor different from setting up the result set within the stored procedure ? (or doesn't Oracle support this in stored procedures ?) --=20 Marc-Andre Lemburg CEO eGenix.com Software GmbH _______________________________________________________________________ eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,... Python Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From msanchez@grupoburke.com Tue Sep 3 10:49:17 2002 From: msanchez@grupoburke.com (Marcos =?ISO-8859-1?Q?S=E1nchez?= Provencio) Date: 03 Sep 2002 11:49:17 +0200 Subject: [DB-SIG] Accessing MSSQL from Python In-Reply-To: References: Message-ID: <1031046557.1514.9.camel@cynar> Using these versions: sybase-0.35pre1 freetds-current 2002-09-03 Debian GNU/Linux 3.0 MSSQL 7.0 The connection seems to work fine even retrieving 100K rows into memory (no, I won't do that often). Thank you for all your help. Expect to hear from me. El jue, 29-08-2002 a las 12:38, Kevin Jacobs escribi=F3: > On Thu, 29 Aug 2002, Marcos S=E1nchez Provencio wrote: > > All right! Now it is built and it connects fine. I get > > Violaci=F3n de segmento (core dumped) > > when exiting Python, though. >=20 > What versions of Python and the Sybase module are you using? Also, can y= ou > generate a gdb stack trace for me? >=20 > -Kevin >=20 From djc@object-craft.com.au Tue Sep 3 10:58:06 2002 From: djc@object-craft.com.au (Dave Cole) Date: 03 Sep 2002 19:58:06 +1000 Subject: [DB-SIG] Accessing MSSQL from Python In-Reply-To: <1031046557.1514.9.camel@cynar> References: <1031046557.1514.9.camel@cynar> Message-ID: > Using these versions: > sybase-0.35pre1 > freetds-current 2002-09-03 > Debian GNU/Linux 3.0 > MSSQL 7.0 > > > The connection seems to work fine even retrieving 100K rows into > memory (no, I won't do that often). > > Thank you for all your help. Expect to hear from me. That is excellent news! Are you able to explain the steps you went through to get it working? - Dave -- http://www.object-craft.com.au From msanchez@grupoburke.com Tue Sep 3 12:38:22 2002 From: msanchez@grupoburke.com (Marcos =?ISO-8859-1?Q?S=E1nchez?= Provencio) Date: 03 Sep 2002 13:38:22 +0200 Subject: [DB-SIG] Accessing MSSQL from Python In-Reply-To: References: <1031046557.1514.9.camel@cynar> Message-ID: <1031053102.1515.23.camel@cynar> Not very brilliant, really. Download freeTDS (2002-09-03) ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/freetds-current.tgz ./configure --with-tdsver=3D7.0 make sudo make install sudo ldconfig [verify that tsql is working. Use the NT Server name as server name. I have an interfaces file in the sybase dir, but I don't think that info is being used] Download Sybase module (it deserves a name, IMO) http://object-craft.com.au/projects/sybase/download/sybase-0.35pre1.tar.gz export SYBASE=3D/usr/local/freetds python setup.py build_ext -D WANT_THREADS -D HAVE_FREETDS -U WANT_BULKCOPY python setup.py install Test from python.=20 El mar, 03-09-2002 a las 11:58, Dave Cole escribi=F3: >=20 > > Using these versions: > > sybase-0.35pre1 > > freetds-current 2002-09-03 > > Debian GNU/Linux 3.0 > > MSSQL 7.0 > >=20 > >=20 > > The connection seems to work fine even retrieving 100K rows into > > memory (no, I won't do that often). > >=20 > > Thank you for all your help. Expect to hear from me. >=20 > That is excellent news! >=20 > Are you able to explain the steps you went through to get it working? >=20 > - Dave >=20 > --=20 > http://www.object-craft.com.au From jacobs@penguin.theopalgroup.com Tue Sep 3 12:48:47 2002 From: jacobs@penguin.theopalgroup.com (Kevin Jacobs) Date: Tue, 3 Sep 2002 07:48:47 -0400 (EDT) Subject: [DB-SIG] Accessing MSSQL from Python In-Reply-To: <1031053102.1515.23.camel@cynar> Message-ID: On 3 Sep 2002, Marcos S=E1nchez Provencio wrote: > Not very brilliant, really. I'm assuming that you left out a few steps, like maybe installing the pat= ch that I sent? As far as I know, both MS SQL 7.0 and 2000 require it. -Kevin -- Kevin Jacobs The OPAL Group - Enterprise Systems Architect Voice: (216) 986-0710 x 19 E-mail: jacobs@theopalgroup.com Fax: (216) 986-0714 WWW: http://www.theopalgroup.com From msanchez@grupoburke.com Tue Sep 3 14:43:21 2002 From: msanchez@grupoburke.com (Marcos =?ISO-8859-1?Q?S=E1nchez?= Provencio) Date: 03 Sep 2002 15:43:21 +0200 Subject: [DB-SIG] Accessing MSSQL from Python In-Reply-To: References: Message-ID: <1031060603.13603.6.camel@cynar> Now I have applied it, but I have not seen much difference. What is it that it corrects? What I see is that if I don't give correct information, I get fatal errors. >>> c=3DSybase.connect('sake','sa','') src/tds/login.c: tds_connect: 192.168.222.5:1433: Connection refused Violaci=F3n de segmento marcos@sake:~$=20 [I don't have an SQL Server in sake] >>> import Sybase >>> c=3DSybase.connect('xerry','ss','') Violaci=F3n de segmento [there _is_ a server in xerry, but no such user] >>> import Sybase >>> c=3DSybase.connect('xerry','sa','') >>> del c >>>=20 [all fine] =BFHow can I get debugging info? El mar, 03-09-2002 a las 13:48, Kevin Jacobs escribi=F3: > On 3 Sep 2002, Marcos S=E1nchez Provencio wrote: > > Not very brilliant, really. >=20 > I'm assuming that you left out a few steps, like maybe installing the pat= ch > that I sent? As far as I know, both MS SQL 7.0 and 2000 require it. >=20 > -Kevin >=20 > -- > Kevin Jacobs > The OPAL Group - Enterprise Systems Architect > Voice: (216) 986-0710 x 19 E-mail: jacobs@theopalgroup.com > Fax: (216) 986-0714 WWW: http://www.theopalgroup.com From jacobs@penguin.theopalgroup.com Tue Sep 3 14:46:04 2002 From: jacobs@penguin.theopalgroup.com (Kevin Jacobs) Date: Tue, 3 Sep 2002 09:46:04 -0400 (EDT) Subject: [DB-SIG] Accessing MSSQL from Python In-Reply-To: <1031060603.13603.6.camel@cynar> Message-ID: On 3 Sep 2002, Marcos S=E1nchez Provencio wrote: > Now I have applied it, but I have not seen much difference. What is it > that it corrects? It must be a SQL Server 2000 specific thing -- it sends back some extra locale information in many server replies, which are treated as errors without my patch. -Kevin -- Kevin Jacobs The OPAL Group - Enterprise Systems Architect Voice: (216) 986-0710 x 19 E-mail: jacobs@theopalgroup.com Fax: (216) 986-0714 WWW: http://www.theopalgroup.com From harri.pasanen@trema.com Wed Sep 4 16:29:44 2002 From: harri.pasanen@trema.com (Harri Pasanen) Date: Wed, 4 Sep 2002 17:29:44 +0200 Subject: [DB-SIG] Accessing MSSQL from Python In-Reply-To: References: Message-ID: <200209041729.44106.harri.pasanen@trema.com> On Tuesday 03 September 2002 15:46, Kevin Jacobs wrote: > On 3 Sep 2002, Marcos S=E1nchez Provencio wrote: > > Now I have applied it, but I have not seen much difference. What is i= t > > that it corrects? > > It must be a SQL Server 2000 specific thing -- it sends back some extra > locale information in many server replies, which are treated as errors > without my patch. > > -Kevin I'm getting it with SQL Server 7, I believe it is related to the message = tsql=20 spits out on connect: Msg 5703, Level 0, State 1, Server LABS-LAPTOP009, Line 0 Changed language setting to us_english. So your patch fixed it fine, it was segfaulting in Sybase.connect() witho= ut=20 that. I've had less luck in running stored procedures. That seems to work from= tsql=20 level, so the problem is more likely somewhere in the sybase module. -Harri From ramrom@earthling.net Wed Sep 4 20:59:24 2002 From: ramrom@earthling.net (Bob Gailer) Date: Wed, 04 Sep 2002 13:59:24 -0600 Subject: [DB-SIG] create procedure / callproc question Message-ID: <5.1.0.14.0.20020904135232.02901868@pop.viawest.net> --=======5285372======= Content-Type: text/plain; x-avg-checked=avg-ok-16664BD; charset=us-ascii; format=flowed Content-Transfer-Encoding: 8bit Using cx_Oracle: >>> cursor.execute("create or replace procedure pump1(a in number) as begin null; end;") >>> cursor.callproc("pump1(1)") Results in: DatabaseError: ORA-06550: line 1, column 7: PLS-00801: internal error [22503] ORA-06550: line 1, column 7: PL/SQL: Statement ignored What do I need to fix? My goal is to have an out parameter (or rmake pump1 a function) with data returned to Python. What do I change to do that? I'm assuming the create changes to: "create or replace procedure pump1(a out number) as begin a := something; end;" I also notice that if I make an error in the create statement, execute returns no error to Python! Bob Gailer mailto:ramrom@earthling.net 303 442 2625 --=======5285372=======-- From matt@zope.com Wed Sep 4 21:10:58 2002 From: matt@zope.com (Matthew T. Kromer) Date: Wed, 04 Sep 2002 16:10:58 -0400 Subject: [DB-SIG] create procedure / callproc question References: <5.1.0.14.0.20020904135232.02901868@pop.viawest.net> Message-ID: <3D7668D2.8090804@zope.com> Bob Gailer wrote: > Using cx_Oracle: > > >>> cursor.execute("create or replace procedure pump1(a in number) as > begin null; end;") > >>> cursor.callproc("pump1(1)") > > Results in: > > DatabaseError: ORA-06550: line 1, column 7: > PLS-00801: internal error [22503] > ORA-06550: line 1, column 7: > PL/SQL: Statement ignored > > What do I need to fix? > > My goal is to have an out parameter (or rmake pump1 a function) with > data returned to Python. What do I change to do that? I'm assuming the > create changes to: > > "create or replace procedure pump1(a out number) as begin a := > something; end;" > > I also notice that if I make an error in the create statement, execute > returns no error to Python! > I suspect you want something similar to cursor.callproc("pump1", (1,)) or thereabouts. According to the DB API, all parameters to the stored procedure are returned as a list, so you'd get back (1,) as well. If that was an IN/OUT parameter, what you'd get back could have been changed by the DB. From andy47@halfcooked.com Thu Sep 5 13:50:42 2002 From: andy47@halfcooked.com (Andy Todd) Date: Thu, 05 Sep 2002 13:50:42 +0100 Subject: [DB-SIG] create procedure / callproc question References: <5.1.0.14.0.20020904135232.02901868@pop.viawest.net> <3D7668D2.8090804@zope.com> Message-ID: <3D775322.4040209@halfcooked.com> Matthew T. Kromer wrote: > Bob Gailer wrote: > >> Using cx_Oracle: >> >> >>> cursor.execute("create or replace procedure pump1(a in number) as >> begin null; end;") >> >>> cursor.callproc("pump1(1)") >> >> Results in: >> >> DatabaseError: ORA-06550: line 1, column 7: >> PLS-00801: internal error [22503] >> ORA-06550: line 1, column 7: >> PL/SQL: Statement ignored >> >> What do I need to fix? >> >> My goal is to have an out parameter (or rmake pump1 a function) with >> data returned to Python. What do I change to do that? I'm assuming the >> create changes to: >> >> "create or replace procedure pump1(a out number) as begin a := >> something; end;" >> >> I also notice that if I make an error in the create statement, execute >> returns no error to Python! >> > > I suspect you want something similar to > > cursor.callproc("pump1", (1,)) > > or thereabouts. According to the DB API, all parameters to the stored > procedure are returned as a list, so you'd get back (1,) as well. If > that was an IN/OUT parameter, what you'd get back could have been > changed by the DB. > > I just tried this, and note that you must have cx_Oracle v2.5 (or 2.5a) for this to work; >>> cursor.execute("CREATE OR REPLACE PROCEDURE pump1(a IN OUT NUMBER) IS BEGIN a := a+1; END;") >>> >>> cursor.callproc("PUMP1", (1, )) Traceback (most recent call last): File "", line 1, in ? TypeError: argument 2 must be list, not tuple >>> cursor.callproc("PUMP1", [1]) [2] >>> If you have cx_Oracle 2.4 or less then the way to call stored code objects is with anonymous PL/SQL blocks. Or you could just upgrade ;-) HTH, Andy -- ---------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com From anthony@computronix.com Thu Sep 5 03:36:26 2002 From: anthony@computronix.com (Anthony Tuininga) Date: Wed, 04 Sep 2002 20:36:26 -0600 Subject: [DB-SIG] create procedure / callproc question In-Reply-To: <5.1.0.14.0.20020904135232.02901868@pop.viawest.net> References: <5.1.0.14.0.20020904135232.02901868@pop.viawest.net> Message-ID: <1031193387.2231.1.camel@localhost> You need to do the following: cursor.callproc("pump1", 1) This isn't too obvious from the DB-API documentation but it does make sense once you see one example... :-) You can also use cursor.execute(""" begin pump1(1); end;""") but that one is Oracle specific. On Wed, 2002-09-04 at 13:59, Bob Gailer wrote: > Using cx_Oracle: > > >>> cursor.execute("create or replace procedure pump1(a in number) as > begin null; end;") > >>> cursor.callproc("pump1(1)") > > Results in: > > DatabaseError: ORA-06550: line 1, column 7: > PLS-00801: internal error [22503] > ORA-06550: line 1, column 7: > PL/SQL: Statement ignored > > What do I need to fix? > > My goal is to have an out parameter (or rmake pump1 a function) with > data > returned to Python. What do I change to do that? I'm assuming the create > > changes to: > > "create or replace procedure pump1(a out number) as begin a := > something; end;" > > I also notice that if I make an error in the create statement, execute > returns no error to Python! > > Bob Gailer > mailto:ramrom@earthling.net > 303 442 2625 From chingchan1@yahoo.com Thu Sep 5 16:13:24 2002 From: chingchan1@yahoo.com (Ching Chan) Date: Thu, 5 Sep 2002 08:13:24 -0700 (PDT) Subject: [DB-SIG] mxODBC - window installation problem Message-ID: <20020905151324.65971.qmail@web10005.mail.yahoo.com> --0-307221409-1031238804=:65381 Content-Type: text/plain; charset=us-ascii Hi I have 2 questions: 1) I try to use mxODBC in python. I installed the python 2.2 window version from python.org on window XP. It works fine. I installed mxODBC window version for python 2.2 and the window installer said it finished successfully. I believed the module package was installed under c:\python22\lib\site-packages\mx. Now, when I try to use Import mx.ODBC.Windows and I have error said the mx.ODBC.Windows module was not found. I just do not understand why I have this problem. How can I make it work. 2) Also, I have made another trial using the python 2.2 from Activestate.com. This package includes an ODBC module in win32 extension. I can use this. But if I want to add mxODBC to this version. According to the mxODBC document, mxODBC will have a name conflict with the ODBC module and need to make some changes. However, the instruction is not very specific, could any one make it more clear. I believe this is a very common problem to the experienced. Thanks. --------------------------------- Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes --0-307221409-1031238804=:65381 Content-Type: text/html; charset=us-ascii

Hi

I have 2 questions:

1) I try to use mxODBC in python. I installed the python 2.2 window version from python.org on window XP. It works fine. I installed mxODBC window version for python 2.2 and the window installer said it finished successfully. I believed the module package was installed under c:\python22\lib\site-packages\mx.

Now, when I try to use

Import mx.ODBC.Windows

and I have error said the mx.ODBC.Windows module was not found. I just do not understand why I have this problem. How can I make it work.

 

2) Also, I have made another trial using the python 2.2 from Activestate.com. This package includes an ODBC module in win32 extension. I can use this. But if I want to add mxODBC to this version. According to the mxODBC document, mxODBC will have a name conflict with the ODBC module and need to make some changes. However, the instruction is not very specific, could any one make it more clear. I believe this is a very common problem to the experienced.

Thanks.



Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes --0-307221409-1031238804=:65381-- From rond@ixsys.com Thu Sep 5 16:30:11 2002 From: rond@ixsys.com (Ron Darling) Date: Thu, 5 Sep 2002 10:30:11 -0500 Subject: [DB-SIG] RE: What database should I use In-Reply-To: Message-ID: >> (though it's it considered obsolete now-a-days). This is only a consideration for the uni-formed or those that have never really used it. MS is still dumping lots of money into it. Just shipped v7.0 will be going into Beta with 8.0 in a couple of months. Amazing String capabilties. As a matter of fact there is now a VFP style .net class that moves a lot of the wonderful commands internal to VFP to .NET. I think the Fox Dev team created. Cursor Technology, Rushmore Speed and many other things have moved there way into not only Access but SQL Server and ADO. Due to the fact that each part of a table is its own file. .DBF is the table. .FPT is the Memo field .CDX is the index. The file size limitation of the OS of 2 gig is at the individual file level. In Access everything is stored in the same file (you could break up but not really meant to) so the 2 gig file size is limited to the app and data which is more than likely in the same file. I have dealt with lots of situations where the .DBF was 1.8 gig, the index was 1.2 gig and the FPT was another 1+ gig size. Indexes are stored in a .CDX file. A .CDX file can have as many as 255 indexes (take into account 2 gig file size). Each open table can have 10 open CDX's so you can have 2550 indexes on a table. Very Robust SQL pass Through for back end databases. There is nothing out there as fast as VFP for pure raw speed. SQL 2000 gets close but not quite there, the advantage to SQL as far speed goes is it does not bog down under load. Load means 25 + heavy users. As far as speed goes I have seen the return of queries on tables as large as 21 million records within seconds and that was pulling data across a 10 meg network with Foxpro For DOS. United We Stand (remember Ross Perot) member/prospect database. Sounds a little dated but the point is its been that way in Fox for a long time. Fox and VFP managed/tracked the military assets to the Persian Gulf and is till in use. Manages the flow of info for Chunnel. It is far more prevalent than most realize. Very good OOP. It seems that VFP is becoming known for the best language that can really implement the "Abstract Factory Pattern" Very good interface. Rich Native Controls (No OCX) and does very well with OCX's. Easy Distribution. (Drop a couple of DLLS into system directory not reg) Rich Debugger. Can access any data ODBC, ADO or ADO.Net can access. Internal XML. Select Result set from SQL into a local cursor then use CURSORTOXML(). With the XMLTOCCURSOR() and CURSORTOXML() commands it is very easy to build thin wire apps. Bind the interface to the cursor. I can try any and all commands from the command prompt and even from within a debugging suspend. Pretty much interrogate the entire system at hand very easily from a suspend. Many options for hanging VFP behind IIS and ISAPI. You can create com objects and run behind other languages even from within SQL Server or visa versa. One of the most robust SOUNDEX/Fuzzy Search add-ons available with the PHDbase Library. You can index memo fields and do 2 - 3 second searches on huge amounts of memo data. Best Table Repair Libraries that I am aware of are available. Error trapping has been far superior to VB and a lot of languages since the Fox 2.0 days (1992). Last but not least http://www.universalthread.com. Great support from all over the world. obsolete...hmmmmm maybe lack of exposure or conflicting marketing problems with MS owning Access, SQL and Fox but certainly not obsolete. -----Original Message----- From: activepython-admin@listserv.ActiveState.com [mailto:activepython-admin@listserv.ActiveState.com]On Behalf Of Sathish Chandrasekaran (S) Sent: Thursday, September 05, 2002 9:24 AM To: printers@sendme.cz; python-list@python.org; tutor@python.org; activepython@listserv.activestate.com; python-help@python.org Cc: db-sig@python.org; wx-users@lists.wxwindows.org Subject: RE: What database should I use In that case MS-access will be better on the size issue. But on the other hand if u want ur application to be flexible and ease of use I would rather suggest FoxPro (though it's it considered obsolete now-a-days). Here Is A Test To Know Whether The Mission Of Your Life Is Over . If You Are Alive It Isn't . Sathish C Infra-Amdocs -----Original Message----- From: A [mailto:printers@sendme.cz] Sent: 05 September 2002 15:21 To: python-list@python.org; tutor@python.org; activepython@listserv.ActiveState.com; python-help@python.org Cc: db-sig@python.org; wx-users@lists.wxwindows.org Subject: What database should I use Hello, I am going to program a small application (in Python and wxPython) which consists about 2000 - 3000 records . Can you please recommend which database is the best for that. I use Windows. Maybe MS Access or FoxPro or MySQL or better? I want to keep the program as small as possible. Thanks Ladislav _______________________________________________ ActivePython mailing list ActivePython@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython _______________________________________________ ActivePython mailing list ActivePython@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython From mal@egenix.com Thu Sep 5 16:42:01 2002 From: mal@egenix.com (M.-A. Lemburg) Date: Thu, 05 Sep 2002 17:42:01 +0200 Subject: [DB-SIG] mxODBC - window installation problem References: <20020905151324.65971.qmail@web10005.mail.yahoo.com> Message-ID: <3D777B49.1040309@lemburg.com> Ching Chan wrote: > Hi > > I have 2 questions: > > 1) I try to use mxODBC in python. I installed the python 2.2 window > version from python.org on window XP. It works fine. I installed mxODBC > window version for python 2.2 and the window installer said it finished > successfully. I believed the module package was installed under > c:\python22\lib\site-packages\mx. > > Now, when I try to use > > Import mx.ODBC.Windows > > and I have error said the mx.ODBC.Windows module was not found. I just > do not understand why I have this problem. How can I make it work. Did you also install the egenix-mx-base package ? egenix-mx-commercial depends on the mxDateTime part of that package. To debug where Python looks for the package, run Python in verbose mode: python -vv -c 'import mx.ODBC.Windows' It will then print all the places it looks for the various modules and packages it tries to import. > 2) Also, I have made another trial using the python 2.2 from > Activestate.com. This package includes an ODBC module in win32 > extension. I can use this. But if I want to add mxODBC to this version. > According to the mxODBC document, mxODBC will have a name conflict with > the ODBC module and need to make some changes. However, the instruction > is not very specific, could any one make it more clear. I believe this > is a very common problem to the experienced. The name problem was resolved in the move from 1.1 to 2.0. All packages from eGenix now live under the 'mx' top-level domain, so you don't have to rename the old win32 odbc to be able to use mxODBC. HTH, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH _______________________________________________________________________ eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,... Python Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From wganz@imacs.com Thu Sep 5 17:17:39 2002 From: wganz@imacs.com (Ganz, Will) Date: Thu, 5 Sep 2002 11:17:39 -0500 Subject: [DB-SIG] RE: What database should I use Message-ID: I grant that FoxPro is still a formidable competitor in the marketplace but given the size that the original poster stated of 2K-3k records; the 2gig Access limitation shouldn't come into play. In this instance, Visual FoxPro would be like using a supersonic fighter jet as a crop duster. 8-) -----Original Message----- From: Ron Darling [mailto:rond@ixsys.com] Sent: Thursday, September 05, 2002 10:30 AM To: Sathish Chandrasekaran (S); printers@sendme.cz; python-list@python.org; tutor@python.org; activepython@listserv.ActiveState.com; python-help@python.org Cc: db-sig@python.org; wx-users@lists.wxwindows.org Subject: RE: What database should I use >> (though it's it considered obsolete now-a-days). This is only a consideration for the uni-formed or those that have never really used it. MS is still dumping lots of money into it. Just shipped v7.0 will be going into Beta with 8.0 in a couple of months. Amazing String capabilties. As a matter of fact there is now a VFP style .net class that moves a lot of the wonderful commands internal to VFP to .NET. I think the Fox Dev team created. Cursor Technology, Rushmore Speed and many other things have moved there way into not only Access but SQL Server and ADO. Due to the fact that each part of a table is its own file. .DBF is the table. .FPT is the Memo field .CDX is the index. The file size limitation of the OS of 2 gig is at the individual file level. In Access everything is stored in the same file (you could break up but not really meant to) so the 2 gig file size is limited to the app and data which is more than likely in the same file. I have dealt with lots of situations where the .DBF was 1.8 gig, the index was 1.2 gig and the FPT was another 1+ gig size. Indexes are stored in a .CDX file. A .CDX file can have as many as 255 indexes (take into account 2 gig file size). Each open table can have 10 open CDX's so you can have 2550 indexes on a table. Very Robust SQL pass Through for back end databases. There is nothing out there as fast as VFP for pure raw speed. SQL 2000 gets close but not quite there, the advantage to SQL as far speed goes is it does not bog down under load. Load means 25 + heavy users. As far as speed goes I have seen the return of queries on tables as large as 21 million records within seconds and that was pulling data across a 10 meg network with Foxpro For DOS. United We Stand (remember Ross Perot) member/prospect database. Sounds a little dated but the point is its been that way in Fox for a long time. Fox and VFP managed/tracked the military assets to the Persian Gulf and is till in use. Manages the flow of info for Chunnel. It is far more prevalent than most realize. Very good OOP. It seems that VFP is becoming known for the best language that can really implement the "Abstract Factory Pattern" Very good interface. Rich Native Controls (No OCX) and does very well with OCX's. Easy Distribution. (Drop a couple of DLLS into system directory not reg) Rich Debugger. Can access any data ODBC, ADO or ADO.Net can access. Internal XML. Select Result set from SQL into a local cursor then use CURSORTOXML(). With the XMLTOCCURSOR() and CURSORTOXML() commands it is very easy to build thin wire apps. Bind the interface to the cursor. I can try any and all commands from the command prompt and even from within a debugging suspend. Pretty much interrogate the entire system at hand very easily from a suspend. Many options for hanging VFP behind IIS and ISAPI. You can create com objects and run behind other languages even from within SQL Server or visa versa. One of the most robust SOUNDEX/Fuzzy Search add-ons available with the PHDbase Library. You can index memo fields and do 2 - 3 second searches on huge amounts of memo data. Best Table Repair Libraries that I am aware of are available. Error trapping has been far superior to VB and a lot of languages since the Fox 2.0 days (1992). Last but not least http://www.universalthread.com. Great support from all over the world. obsolete...hmmmmm maybe lack of exposure or conflicting marketing problems with MS owning Access, SQL and Fox but certainly not obsolete. -----Original Message----- From: activepython-admin@listserv.ActiveState.com [mailto:activepython-admin@listserv.ActiveState.com]On Behalf Of Sathish Chandrasekaran (S) Sent: Thursday, September 05, 2002 9:24 AM To: printers@sendme.cz; python-list@python.org; tutor@python.org; activepython@listserv.activestate.com; python-help@python.org Cc: db-sig@python.org; wx-users@lists.wxwindows.org Subject: RE: What database should I use In that case MS-access will be better on the size issue. But on the other hand if u want ur application to be flexible and ease of use I would rather suggest FoxPro (though it's it considered obsolete now-a-days). Here Is A Test To Know Whether The Mission Of Your Life Is Over . If You Are Alive It Isn't . Sathish C Infra-Amdocs -----Original Message----- From: A [mailto:printers@sendme.cz] Sent: 05 September 2002 15:21 To: python-list@python.org; tutor@python.org; activepython@listserv.ActiveState.com; python-help@python.org Cc: db-sig@python.org; wx-users@lists.wxwindows.org Subject: What database should I use Hello, I am going to program a small application (in Python and wxPython) which consists about 2000 - 3000 records . Can you please recommend which database is the best for that. I use Windows. Maybe MS Access or FoxPro or MySQL or better? I want to keep the program as small as possible. Thanks Ladislav _______________________________________________ ActivePython mailing list ActivePython@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython _______________________________________________ ActivePython mailing list ActivePython@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython _______________________________________________ ActivePython mailing list ActivePython@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython From ChandrS@telkom.co.za Thu Sep 5 15:24:08 2002 From: ChandrS@telkom.co.za (Sathish Chandrasekaran (S)) Date: Thu, 5 Sep 2002 16:24:08 +0200 Subject: [DB-SIG] RE: What database should I use Message-ID: In that case MS-access will be better on the size issue. But on the other hand if u want ur application to be flexible and ease of use I would rather suggest FoxPro (though it's it considered obsolete now-a-days). Here Is A Test To Know Whether The Mission Of Your Life Is Over . If You Are Alive It Isn't . Sathish C Infra-Amdocs=20 -----Original Message----- From: A [mailto:printers@sendme.cz] Sent: 05 September 2002 15:21 To: python-list@python.org; tutor@python.org; activepython@listserv.ActiveState.com; python-help@python.org Cc: db-sig@python.org; wx-users@lists.wxwindows.org Subject: What database should I use Hello, I am going to program a small application (in Python and wxPython) which consists about=20 2000 - 3000 records . Can you please recommend which database is the best for that. I=20 use Windows. Maybe MS Access or FoxPro or MySQL or better? I want to keep the program as small as possible. Thanks Ladislav _______________________________________________ ActivePython mailing list ActivePython@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython From ramrom@earthling.net Thu Sep 5 18:34:52 2002 From: ramrom@earthling.net (Bob Gailer) Date: Thu, 05 Sep 2002 11:34:52 -0600 Subject: [DB-SIG] RE: What database should I use In-Reply-To: References: Message-ID: <5.1.0.14.0.20020905112907.02769bd8@pop.viawest.net> --=======654348E9======= Content-Type: text/plain; x-avg-checked=avg-ok-3A73462E; charset=us-ascii; format=flowed Content-Transfer-Encoding: 8bit At 10:30 AM 9/5/2002 -0500, Ron Darling wrote in favor of VFP. Here's the devil's advocate: MS manifests no interest in quality control over its developer products, especially VFP. It is a buggy, poorly documented product. As one who has used it as my primary development tool from version 3 thru 6 I have finally given up hope for the support I need from MS. That's why I'm now using Python. Yes, VFP has great features. If they all worked as documented, and the documentation were correct, I'd have less complaint. Be ware that VFP tables often need to have their indexes repaired. There is nothing in the product that will detect and automatically repair corrupted indexes; things just suddenly don't work the way you expect. Bob Gailer mailto:ramrom@earthling.net 303 442 2625 --=======654348E9=======-- From ramrom@earthling.net Thu Sep 5 18:57:13 2002 From: ramrom@earthling.net (Bob Gailer) Date: Thu, 05 Sep 2002 11:57:13 -0600 Subject: [DB-SIG] Spreadsheet interface? Message-ID: <5.1.0.14.0.20020905115705.03829380@pop.viawest.net> --=======FD92CDD======= Content-Type: text/plain; x-avg-checked=avg-ok-3A73462E; charset=us-ascii; format=flowed Content-Transfer-Encoding: 8bit Months ago I found a spreadsheet-like interface for browsing and editing database tables. It required Gadfly, which I downloaded and installed. Now I have forgotten the name of the interface. Do you know what it might be. (I'm interested in ANY such tool). Bob Gailer mailto:ramrom@earthling.net 303 442 2625 --=======FD92CDD=======-- From printers@sendme.cz Thu Sep 5 14:20:31 2002 From: printers@sendme.cz (A) Date: Thu, 05 Sep 2002 15:20:31 +0200 Subject: [DB-SIG] What database should I use Message-ID: <3D77763F.23080.BFAFA3@localhost> Hello, I am going to program a small application (in Python and wxPython) which consists about 2000 - 3000 records . Can you please recommend which database is the best for that. I use Windows. Maybe MS Access or FoxPro or MySQL or better? I want to keep the program as small as possible. Thanks Ladislav From anthony@computronix.com Thu Sep 5 03:38:08 2002 From: anthony@computronix.com (Anthony Tuininga) Date: Wed, 04 Sep 2002 20:38:08 -0600 Subject: [DB-SIG] create procedure / callproc question In-Reply-To: <5.1.0.14.0.20020904135232.02901868@pop.viawest.net> References: <5.1.0.14.0.20020904135232.02901868@pop.viawest.net> Message-ID: <1031193488.2251.5.camel@localhost> Oh, one other thing: in Oracle, the create statement succeeds just fine but there may be compilation errors which you need to check in user_errors, all_errors or dba_errors. That is just the way Oracle works -- and they are inconsistent because if you attempt to create a view with compilation errors, the statement fails! :-) On Wed, 2002-09-04 at 13:59, Bob Gailer wrote: > Using cx_Oracle: > > >>> cursor.execute("create or replace procedure pump1(a in number) as > begin null; end;") > >>> cursor.callproc("pump1(1)") > > Results in: > > DatabaseError: ORA-06550: line 1, column 7: > PLS-00801: internal error [22503] > ORA-06550: line 1, column 7: > PL/SQL: Statement ignored > > What do I need to fix? > > My goal is to have an out parameter (or rmake pump1 a function) with > data > returned to Python. What do I change to do that? I'm assuming the create > > changes to: > > "create or replace procedure pump1(a out number) as begin a := > something; end;" > > I also notice that if I make an error in the create statement, execute > returns no error to Python! > > Bob Gailer > mailto:ramrom@earthling.net > 303 442 2625 From haering_postgresql@gmx.de Fri Sep 6 00:11:34 2002 From: haering_postgresql@gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Fri, 6 Sep 2002 01:11:34 +0200 Subject: [DB-SIG] Re: What database should I use In-Reply-To: <3D77763F.23080.BFAFA3@localhost> References: <3D77763F.23080.BFAFA3@localhost> Message-ID: <20020905231134.GA1229@lilith.ghaering.test> * A [2002-09-05 15:20 +0200]: > Hello, > I am going to program a small application (in Python and wxPython) which consists about > 2000 - 3000 records . Can you please recommend which database is the best for that. I > use Windows. > Maybe MS Access or FoxPro or MySQL or better? > I want to keep the program as small as possible. PySQLite. It uses an embedded SQL engine (SQLite), which means you don't have to set up a separate server process. It only weights a hundred KB or so and has good SQL support (a lot better than MySQL, for example). http://pysqlite.sf.net/ -- Gerhard From rjones@ekit-inc.com Fri Sep 6 00:35:40 2002 From: rjones@ekit-inc.com (Richard Jones) Date: Fri, 6 Sep 2002 09:35:40 +1000 Subject: [DB-SIG] Re: What database should I use In-Reply-To: <20020905231134.GA1229@lilith.ghaering.test> References: <3D77763F.23080.BFAFA3@localhost> <20020905231134.GA1229@lilith.ghaering.test> Message-ID: <200209060935.40849.rjones@ekit-inc.com> On Fri, 6 Sep 2002 9:11 am, Gerhard H=E4ring wrote: > * A [2002-09-05 15:20 +0200]: > > Hello, > > I am going to program a small application (in Python and wxPython) wh= ich > > consists about 2000 - 3000 records . Can you please recommend which > > database is the best for that. I use Windows. > > Maybe MS Access or FoxPro or MySQL or better? > > I want to keep the program as small as possible. > > PySQLite. It uses an embedded SQL engine (SQLite), which means you don'= t > have to set up a separate server process. It only weights a hundred KB > or so and has good SQL support (a lot better than MySQL, for example). If the database is small, and will have only single users at a time, then= =20 gadfly really can't be beat. It's pure python, meaning no mess, no fuss=20 installation: http://gadfly.sf.net/ "python setup.py install" and you're ready to go. Richard From rond@ixsys.com Fri Sep 6 03:47:10 2002 From: rond@ixsys.com (Ron Darling) Date: Thu, 5 Sep 2002 21:47:10 -0500 Subject: [DB-SIG] RE: What database should I use In-Reply-To: Message-ID: Below is what I had sent to the original question off forum (replied direct). The description of VFP was not a sales pitch. It was in response to obsolete. =============================== I program in Foxpro/VFP and have since 1989. The reason I do that is not because of the tables but because of the language and runtime enviroment that is available to me. In my opinion... 2000 - 3000 records is not a decision point for most DB table types. Too small they will all handle very well. As far as I know in all three you will have to deal with ODBC so that does not make a difference. One of the advantages of the Fox enviroment (not Python -> Fox) is the table can be native or not. Meaning in VFP I can pull data from VFP tables as well as Access and MySQL all at the same time but the VFP table is native. Easy distribution. I know this is not part of the answer you are looking for but if you used VFP table and for some reason you needed more horse power you have a cleaner option moving into VFP as far as the data is concerned. Most people are surprised to see the volume of data VFP is handling out there in the business world once they find out. MySQL - You have to install MySQL somewhere. Seems a little much for 3000 records especially if you are running MySql on a separate box. Access - Everything is stored in the MDB. If it corrupts well you risk loosing everything you stored in the .MDB file. I have always just hated Access but that is me. Too many reasons to discuss here. In my opinion VFP has the strongest most organized community mainly due to http://www.universalthread.com. I suspect you could even get support there with Python -> VFP tables. I see that discussed there often. I think your choice comes down to what are you interested in learning and living with or maybe what looks best on your resume with your specific career path. ============================= -----Original Message----- From: Ganz, Will [mailto:wganz@imacs.com] Sent: Thursday, September 05, 2002 11:18 AM To: 'Ron Darling'; Sathish Chandrasekaran (S); printers@sendme.cz; python-list@python.org; tutor@python.org; activepython@listserv.ActiveState.com; python-help@python.org Cc: db-sig@python.org; wx-users@lists.wxwindows.org Subject: RE: What database should I use I grant that FoxPro is still a formidable competitor in the marketplace but given the size that the original poster stated of 2K-3k records; the 2gig Access limitation shouldn't come into play. In this instance, Visual FoxPro would be like using a supersonic fighter jet as a crop duster. 8-) -----Original Message----- From: Ron Darling [mailto:rond@ixsys.com] Sent: Thursday, September 05, 2002 10:30 AM To: Sathish Chandrasekaran (S); printers@sendme.cz; python-list@python.org; tutor@python.org; activepython@listserv.ActiveState.com; python-help@python.org Cc: db-sig@python.org; wx-users@lists.wxwindows.org Subject: RE: What database should I use >> (though it's it considered obsolete now-a-days). This is only a consideration for the uni-formed or those that have never really used it. MS is still dumping lots of money into it. Just shipped v7.0 will be going into Beta with 8.0 in a couple of months. Amazing String capabilties. As a matter of fact there is now a VFP style .net class that moves a lot of the wonderful commands internal to VFP to .NET. I think the Fox Dev team created. Cursor Technology, Rushmore Speed and many other things have moved there way into not only Access but SQL Server and ADO. Due to the fact that each part of a table is its own file. .DBF is the table. .FPT is the Memo field .CDX is the index. The file size limitation of the OS of 2 gig is at the individual file level. In Access everything is stored in the same file (you could break up but not really meant to) so the 2 gig file size is limited to the app and data which is more than likely in the same file. I have dealt with lots of situations where the .DBF was 1.8 gig, the index was 1.2 gig and the FPT was another 1+ gig size. Indexes are stored in a .CDX file. A .CDX file can have as many as 255 indexes (take into account 2 gig file size). Each open table can have 10 open CDX's so you can have 2550 indexes on a table. Very Robust SQL pass Through for back end databases. There is nothing out there as fast as VFP for pure raw speed. SQL 2000 gets close but not quite there, the advantage to SQL as far speed goes is it does not bog down under load. Load means 25 + heavy users. As far as speed goes I have seen the return of queries on tables as large as 21 million records within seconds and that was pulling data across a 10 meg network with Foxpro For DOS. United We Stand (remember Ross Perot) member/prospect database. Sounds a little dated but the point is its been that way in Fox for a long time. Fox and VFP managed/tracked the military assets to the Persian Gulf and is till in use. Manages the flow of info for Chunnel. It is far more prevalent than most realize. Very good OOP. It seems that VFP is becoming known for the best language that can really implement the "Abstract Factory Pattern" Very good interface. Rich Native Controls (No OCX) and does very well with OCX's. Easy Distribution. (Drop a couple of DLLS into system directory not reg) Rich Debugger. Can access any data ODBC, ADO or ADO.Net can access. Internal XML. Select Result set from SQL into a local cursor then use CURSORTOXML(). With the XMLTOCCURSOR() and CURSORTOXML() commands it is very easy to build thin wire apps. Bind the interface to the cursor. I can try any and all commands from the command prompt and even from within a debugging suspend. Pretty much interrogate the entire system at hand very easily from a suspend. Many options for hanging VFP behind IIS and ISAPI. You can create com objects and run behind other languages even from within SQL Server or visa versa. One of the most robust SOUNDEX/Fuzzy Search add-ons available with the PHDbase Library. You can index memo fields and do 2 - 3 second searches on huge amounts of memo data. Best Table Repair Libraries that I am aware of are available. Error trapping has been far superior to VB and a lot of languages since the Fox 2.0 days (1992). Last but not least http://www.universalthread.com. Great support from all over the world. obsolete...hmmmmm maybe lack of exposure or conflicting marketing problems with MS owning Access, SQL and Fox but certainly not obsolete. -----Original Message----- From: activepython-admin@listserv.ActiveState.com [mailto:activepython-admin@listserv.ActiveState.com]On Behalf Of Sathish Chandrasekaran (S) Sent: Thursday, September 05, 2002 9:24 AM To: printers@sendme.cz; python-list@python.org; tutor@python.org; activepython@listserv.activestate.com; python-help@python.org Cc: db-sig@python.org; wx-users@lists.wxwindows.org Subject: RE: What database should I use In that case MS-access will be better on the size issue. But on the other hand if u want ur application to be flexible and ease of use I would rather suggest FoxPro (though it's it considered obsolete now-a-days). Here Is A Test To Know Whether The Mission Of Your Life Is Over . If You Are Alive It Isn't . Sathish C Infra-Amdocs -----Original Message----- From: A [mailto:printers@sendme.cz] Sent: 05 September 2002 15:21 To: python-list@python.org; tutor@python.org; activepython@listserv.ActiveState.com; python-help@python.org Cc: db-sig@python.org; wx-users@lists.wxwindows.org Subject: What database should I use Hello, I am going to program a small application (in Python and wxPython) which consists about 2000 - 3000 records . Can you please recommend which database is the best for that. I use Windows. Maybe MS Access or FoxPro or MySQL or better? I want to keep the program as small as possible. Thanks Ladislav _______________________________________________ ActivePython mailing list ActivePython@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython _______________________________________________ ActivePython mailing list ActivePython@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython _______________________________________________ ActivePython mailing list ActivePython@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython From harri.pasanen@trema.com Fri Sep 6 07:53:03 2002 From: harri.pasanen@trema.com (Harri Pasanen) Date: Fri, 6 Sep 2002 08:53:03 +0200 Subject: [DB-SIG] What database should I use In-Reply-To: <3D77763F.23080.BFAFA3@localhost> References: <3D77763F.23080.BFAFA3@localhost> Message-ID: <200209060853.03964.harri.pasanen@trema.com> On Thursday 05 September 2002 15:20, A wrote: > Hello, > I am going to program a small application (in Python and wxPython) whic= h > consists about 2000 - 3000 records . Can you please recommend which > database is the best for that. I use Windows. > Maybe MS Access or FoxPro or MySQL or better? > I want to keep the program as small as possible. > Thanks > Ladislav > Maybe a bit too wide crosspost, eh? For that amount of records I'd go with MetaKit, http://www.equi4.com/meta= kit/. =20 Then you can deliver your db with your app, with no separate installation= =20 needed.=20 -Harri From mal@egenix.com Thu Sep 5 18:24:05 2002 From: mal@egenix.com (M.-A. Lemburg) Date: Thu, 05 Sep 2002 19:24:05 +0200 Subject: [DB-SIG] RE: What database should I use References: Message-ID: <3D779335.1040603@lemburg.com> > Hello, > I am going to program a small application (in Python and wxPython) which > consists about 2000 - 3000 records . Can you please recommend which database > is the best for that. I use Windows. Maybe MS Access or FoxPro or MySQL or > better? I want to keep the program as small as possible. Thanks Ladislav If you only use it internally, then I'd suggest downloading and installing the MS MDAC package and using it via ODBC. You get the Access Jet-Engine for free that way. Another approach would be SAP DB which is Open Source and works nicely on Windows too. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH _______________________________________________________________________ eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,... Python Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From gtasker@allenbrook.com Fri Sep 6 13:24:59 2002 From: gtasker@allenbrook.com (Tasker,George) Date: Fri, 6 Sep 2002 07:24:59 -0500 Subject: [DB-SIG] RE: What database should I use Message-ID: MS Access works. Fox Pro has not been tested that I know of. If you are using VC6 Professional/Enterprise, along with an MSDN subscription, you can get MSDE (the stripped down version of SQL Server 7). g -----Original Message----- From: A [mailto:printers@sendme.cz] Sent: Thursday, September 05, 2002 9:21 AM To: python-list@python.org; tutor@python.org; activepython@listserv.ActiveState.com; python-help@python.org Cc: db-sig@python.org; wx-users@lists.wxwindows.org Subject: What database should I use Hello, I am going to program a small application (in Python and wxPython) which consists about 2000 - 3000 records . Can you please recommend which database is the best for that. I use Windows. Maybe MS Access or FoxPro or MySQL or better? I want to keep the program as small as possible. Thanks Ladislav _______________________________________________ wx-users mailing list wx-users@lists.wxwindows.org http://lists.wxwindows.org/mailman/listinfo/wx-users From leif@crysberg.dk Fri Sep 6 15:29:54 2002 From: leif@crysberg.dk (Leif Jensen) Date: Fri, 6 Sep 2002 16:29:54 +0200 (CEST) Subject: [DB-SIG] Re: What database should I use In-Reply-To: <3D77763F.23080.BFAFA3@localhost> Message-ID: PostgreSQL, no doubt, if you use Linux, WinNT or possible WinXP ! Leif On Thu, 5 Sep 2002, A wrote: > Hello, > I am going to program a small application (in Python and wxPython) which consists about > 2000 - 3000 records . Can you please recommend which database is the best for that. I > use Windows. > Maybe MS Access or FoxPro or MySQL or better? > I want to keep the program as small as possible. > Thanks > Ladislav > > > _______________________________________________ > wx-users mailing list > wx-users@lists.wxwindows.org > http://lists.wxwindows.org/mailman/listinfo/wx-users > From tjenkins@devis.com Fri Sep 6 15:41:56 2002 From: tjenkins@devis.com (Tom Jenkins) Date: 06 Sep 2002 10:41:56 -0400 Subject: [DB-SIG] Re: What database should I use In-Reply-To: References: Message-ID: <1031323316.6785.9.camel@asimov> On Fri, 2002-09-06 at 10:29, Leif Jensen wrote: > > PostgreSQL, no doubt, if you use Linux, WinNT or possible WinXP ! > > Leif > I disagree. Don't get me wrong, we use PostgreSQL EXTENSIVELY. But for 2-3k records? These "requirements" don't require anything that powerful. I'd look at Access, pySQLite (which intrigues me), Gadfly. > > > On Thu, 5 Sep 2002, A wrote: > > > Hello, > > I am going to program a small application (in Python and wxPython) which consists about > > 2000 - 3000 records . Can you please recommend which database is the best for that. I > > use Windows. > > Maybe MS Access or FoxPro or MySQL or better? > > I want to keep the program as small as possible. > > Thanks > > Ladislav > > > > > > _______________________________________________ > > wx-users mailing list > > wx-users@lists.wxwindows.org > > http://lists.wxwindows.org/mailman/listinfo/wx-users > > > > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig -- Tom Jenkins Development InfoStructure http://www.devis.com From msanchez@grupoburke.com Fri Sep 6 16:15:21 2002 From: msanchez@grupoburke.com (Marcos =?ISO-8859-1?Q?S=E1nchez?= Provencio) Date: 06 Sep 2002 17:15:21 +0200 Subject: [DB-SIG] Re: What database should I use In-Reply-To: <1031323316.6785.9.camel@asimov> References: <1031323316.6785.9.camel@asimov> Message-ID: <1031325321.6371.3.camel@cynar> That's right, there are not enough arguments to judge. The next thing is: How many concurrent users are you going to have? If it is one I'd go for gadfly. Does it need to be portable? If it's Windows only, I'd say Access (Jet). And don't forget about a text file or a cPickle to be minimalistic... El vie, 06-09-2002 a las 16:41, Tom Jenkins escribi=F3: > On Fri, 2002-09-06 at 10:29, Leif Jensen wrote: > >=20 > > PostgreSQL, no doubt, if you use Linux, WinNT or possible WinXP ! > >=20 > > Leif > >=20 >=20 > I disagree. Don't get me wrong, we use PostgreSQL EXTENSIVELY. But for > 2-3k records? These "requirements" don't require anything that > powerful. >=20 > I'd look at Access, pySQLite (which intrigues me), Gadfly. >=20 > >=20 > >=20 > > On Thu, 5 Sep 2002, A wrote: > >=20 > > > Hello, > > > I am going to program a small application (in Python and wxPython) wh= ich consists about=20 > > > 2000 - 3000 records . Can you please recommend which database is the = best for that. I=20 > > > use Windows. > > > Maybe MS Access or FoxPro or MySQL or better? > > > I want to keep the program as small as possible. > > > Thanks > > > Ladislav > > >=20 > > >=20 > > > _______________________________________________ > > > wx-users mailing list > > > wx-users@lists.wxwindows.org > > > http://lists.wxwindows.org/mailman/listinfo/wx-users > > >=20 > >=20 > >=20 > > _______________________________________________ > > DB-SIG maillist - DB-SIG@python.org > > http://mail.python.org/mailman/listinfo/db-sig > --=20 >=20 > Tom Jenkins > Development InfoStructure > http://www.devis.com >=20 >=20 >=20 > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig From huy@tramada.com.au Mon Sep 9 02:44:31 2002 From: huy@tramada.com.au (Huy Do) Date: Mon, 9 Sep 2002 11:44:31 +1000 Subject: [DB-SIG] Database Independent SQL Message-ID: Hi, I'm about to develop a major Python application and was wondering what the most database independent way of going about accessing a database in my application. i.e so I can switch between databases almost instantly (a little bit of work is also okay :-)). I know the DB API 2 handles the connection, querying etc. in an independent manner but what I am also looking for is some sort of library which provided a standard SQL syntax as well. I still want the power of SQL but would like a library which would translate a standard set of SQL syntax to all the slightly varying SQL syntaxes of the different databases out there. I'm not a big fan of OR mapping tools because their querying abilities are too restrictive and IMO reinventing the wheel in many instances. Thanks in advance for all your responses, Huy From haering_postgresql@gmx.de Mon Sep 9 03:02:25 2002 From: haering_postgresql@gmx.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Mon, 9 Sep 2002 04:02:25 +0200 Subject: [DB-SIG] Database Independent SQL In-Reply-To: References: Message-ID: <20020909020225.GA2249@lilith.ghaering.test> * Huy Do [2002-09-09 11:44 +1000]: > Hi, > > I'm about to develop a major Python application and was wondering what the > most database independent way of going about accessing a database in my > application. i.e so I can switch between databases almost instantly (a > little bit of work is also okay :-)). My recommendation: Put as much as possible into stored procedures/functions and views. Then you'll likely be able to use a very minimal subset of SQL. > I know the DB API 2 handles the connection, querying etc. in an > independent manner but what I am also looking for is some sort of > library which provided a standard SQL syntax as well. IIRC http://theopalgroup.com/ has such a tool. For internal use, probably. One of them is also subscribed to this list and will likely speak up soon :-) -- Gerhard From chris@cogdon.org Mon Sep 9 03:02:00 2002 From: chris@cogdon.org (Chris Cogdon) Date: Sun, 8 Sep 2002 19:02:00 -0700 Subject: [DB-SIG] Database Independent SQL In-Reply-To: Message-ID: <2076B748-C398-11D6-93EC-000393A6D442@cogdon.org> On Sunday, Sep 8, 2002, at 18:44 US/Pacific, Huy Do wrote: > Hi, > > I'm about to develop a major Python application and was wondering what > the > most database independent way of going about accessing a database in my > application. i.e so I can switch between databases almost instantly (a > little bit of work is also okay :-)). Depending on 'how portable' you wanted to be, and how complicated the application is. For example, if you were restricting yourself to just MySQL and PostgreSQL, you could almost get away with simply doing a 'drop in replacement' between the two (as long as you didnt use foreign keys, or auto increment, or any of the other PG/My dependant things). However, if you think you want a bit more portability, or even want to use some of the advanced features of just one or two database, the BEST way is to contain all your database-access code into a single module (or a grouping). This way, if you need to change, all your database stuff is isolated. For example: class MY_APP_DATABASE: def __init__ ( self ): self.db = PyPgSQL.connect ( lotsofparams) def add_thingy ( self, thingy ): cur = self.db.cursor () cur.execute ( "insert into thingy ( id, name, properties ) values ( %(id)s, %(name)s, %(props) )", vars(thingy) ... and so on. You can then perhaps create a switch in the __init__ function that connects to a different database, and other functions that use database-dependant stuff would change appropriately. the DB-API gives you portable /access/, but not portable /use/. The rest of your code uses your application-specific DB layer, so won't care if you change the backend implementation. -- ("`-/")_.-'"``-._ Ch'marr, a.k.a. . . `; -._ )-;-,_`) Chris Cogdon (v_,)' _ )`-.\ ``-' _.- _..-_/ / ((.' FC1.3: FFH3cmA+>++C++D++H++M++P++R++T+++WZ++Sm++ ((,.-' ((,/ fL RLCT acl+++d++e+f+++h++i++++jp-sm++ From huy@tramada.com.au Mon Sep 9 03:31:35 2002 From: huy@tramada.com.au (Huy Do) Date: Mon, 9 Sep 2002 12:31:35 +1000 Subject: [DB-SIG] Database Independent SQL In-Reply-To: <20020909020225.GA2249@lilith.ghaering.test> Message-ID: > -----Original Message----- > From: db-sig-admin@python.org [mailto:db-sig-admin@python.org]On Behalf > Of Gerhard H=E4ring > Sent: Monday, 9 September 2002 12:02 PM > To: Python DB-SIG Mailing List > Subject: Re: [DB-SIG] Database Independent SQL > > > * Huy Do [2002-09-09 11:44 +1000]: > > Hi, > > > > I'm about to develop a major Python application and was > wondering what the > > most database independent way of going about accessing a database in = my > > application. i.e so I can switch between databases almost instantly (= a > > little bit of work is also okay :-)). > > My recommendation: Put as much as possible into stored > procedures/functions and views. Then you'll likely be able to use a ver= y > minimal subset of SQL. > Wouldn't I still need to port these stored procedures across databases anyway or is there a database independent way of writing these things ? Thanks Huy From chris@cogdon.org Mon Sep 9 03:38:42 2002 From: chris@cogdon.org (Chris Cogdon) Date: Sun, 8 Sep 2002 19:38:42 -0700 Subject: [DB-SIG] Database Independent SQL In-Reply-To: Message-ID: <41798C8A-C39D-11D6-93EC-000393A6D442@cogdon.org> On Sunday, Sep 8, 2002, at 19:31 US/Pacific, Huy Do wrote: >> My recommendation: Put as much as possible into stored >> procedures/functions and views. Then you'll likely be able to use a >> very >> minimal subset of SQL. >> > > Wouldn't I still need to port these stored procedures across databases > anyway or is there a database independent way of writing these things ? MySQL, for example, supports neither views nor stored procedures. While cutting down on the amount of SQL embedded in your code (which could be a good thing), it's not very conductive for portability. -- ("`-/")_.-'"``-._ Chris Cogdon . . `; -._ )-;-,_`) (v_,)' _ )`-.\ ``-' _.- _..-_/ / ((.' ((,.-' ((,/ fL From bkline@rksystems.com Mon Sep 9 04:05:02 2002 From: bkline@rksystems.com (Bob Kline) Date: Sun, 8 Sep 2002 23:05:02 -0400 (EDT) Subject: [DB-SIG] Database Independent SQL In-Reply-To: <20020909020225.GA2249@lilith.ghaering.test> Message-ID: On Mon, 9 Sep 2002, Gerhard H=E4ring wrote: > * Huy Do [2002-09-09 11:44 +1000]: > > Hi, > > > > I'm about to develop a major Python application and was wondering wha= t the > > most database independent way of going about accessing a database in = my > > application. i.e so I can switch between databases almost instantly (= a > > little bit of work is also okay :-)). > > My recommendation: Put as much as possible into stored > procedures/functions and views. Then you'll likely be able to use a > very minimal subset of SQL. I should think that this recommendation would push him in the opposite of the direction in he wants to go. The more of your application you put into stored procedures, the more tightly you will be bound to a single DBMS product. That's why, for example, an Oracle consultant will try so hard to get you to write most of your application in PL*SQL stored procedures and functions (and tell you how important it is for you to use VARCHAR2 throughout all your tables). > > > I know the DB API 2 handles the connection, querying etc. in an > > independent manner but what I am also looking for is some sort of > > library which provided a standard SQL syntax as well. The ANSI SQL standard provides the common syntax, and a number of the DBMS products implement enough of it to support building a portable application. A good SQL book (try Joe Celko's books, for example) will give you guidance about which parts of the standard are the dark corners which have traps to avoid in non-conforming implementations, though as time goes on the available DBMS choices get closer and closer to the goal. You've got the two major ingredients for portability already: standard SQL and Python. Take advantage of the portability of Python and use it to implement the procedural parts of the application, rather than proprietary stored procedures. Where you do have to fall back on a stored procedure or two (to achieve acceptable performance, for example) be sure to encapsulate properly in order to minimize the job of swapping them out if you do swap out your DBMS. Good luck! --=20 Bob Kline mailto:bkline@rksystems.com http://www.rksystems.com From huy@tramada.com.au Mon Sep 9 03:55:03 2002 From: huy@tramada.com.au (Huy Do) Date: Mon, 9 Sep 2002 12:55:03 +1000 Subject: [DB-SIG] Database Independent SQL In-Reply-To: <20020909020225.GA2249@lilith.ghaering.test> Message-ID: > > IIRC http://theopalgroup.com/ has such a tool. For internal use, > probably. One of them is also subscribed to this list and will likely > speak up soon :-) This db_row module is GREAT. I was was just going to ask the lists if there was some cool way of accessing results sets like objects. Thanks Huy From laszlo.asboth@yageo.com Mon Sep 9 07:26:06 2002 From: laszlo.asboth@yageo.com (Laszlo Asboth) Date: Mon, 9 Sep 2002 08:26:06 +0200 Subject: [DB-SIG] What database should I use Message-ID: This is a multipart message in MIME format. --=_alternative 002279BBC1256C2E_= Content-Type: text/plain; charset="us-ascii" Hi, Did you try (Standalone) ZODB? I am newby but this seems to be the closest solution to Python. You do not need any SQL to use it. Many thanks and best regards, Laszlo --=_alternative 002279BBC1256C2E_= Content-Type: text/html; charset="us-ascii"
Hi,

Did you try  (Standalone) ZODB?
I am newby but this seems to be the closest solution to Python.
You do not need any SQL to use it.

Many thanks and best regards,

Laszlo
--=_alternative 002279BBC1256C2E_=-- From magnus@thinkware.se Mon Sep 9 10:25:53 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Mon, 09 Sep 2002 11:25:53 +0200 Subject: [DB-SIG] What database should I use In-Reply-To: Message-ID: <5.1.0.14.0.20020909112025.00bb5bd0@www.thinkware.se> At 08:26 2002-09-09 +0200, Laszlo Asboth wrote: >Did you try (Standalone) ZODB? >I am newby but this seems to be the closest solution to Python. >You do not need any SQL to use it. ZODB is very different from a SQL database. For instance it has no query language. You can't access the data except by writing Python, which might or might not be what you want. It also lacks the concept of database schema and constraints. This makes it very flexible, but also places a bigger responsibility on the programmer. It is an object-oriented database which is well integrated (obviously) with Python, and it handles transactions and persistence, but it's very different from an RDBMS. --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From jacobs@penguin.theopalgroup.com Mon Sep 9 12:18:57 2002 From: jacobs@penguin.theopalgroup.com (Kevin Jacobs) Date: Mon, 9 Sep 2002 07:18:57 -0400 (EDT) Subject: [DB-SIG] Database Independent SQL In-Reply-To: <20020909020225.GA2249@lilith.ghaering.test> Message-ID: On Mon, 9 Sep 2002, Gerhard H=E4ring wrote: > > I know the DB API 2 handles the connection, querying etc. in an > > independent manner but what I am also looking for is some sort of > > library which provided a standard SQL syntax as well. >=20 > IIRC http://theopalgroup.com/ has such a tool. For internal use, > probably. One of them is also subscribed to this list and will likely > speak up soon :-) That would be me -- we have a DB-API abstraction layer that does quite a = few nice things. Most interestingly, it can perform source-to-source translations of queries from one dialect of SQL into another (i.e., MySQL= -> PostgreSQL <-> Oracle <-> MS SQL 2000). Unfortunately, it is not yet ope= n source since parts some components were developed under a fairly restrict= ive license for some of out clients. We are in the process of dis-entangling= as much of it as we can for eventual release to the general Python community. In the mean time, I would suggest that you use PostgreSQL, Firebird, or SAP/DB. All are free and provide a fairly reasonable subset of ANSI SQL 92/99. Good luck, -Kevin Jacobs -- Kevin Jacobs The OPAL Group - Enterprise Systems Architect Voice: (216) 986-0710 x 19 E-mail: jacobs@theopalgroup.com Fax: (216) 986-0714 WWW: http://www.theopalgroup.com From huy@tramada.com.au Tue Sep 10 04:03:13 2002 From: huy@tramada.com.au (Huy Do) Date: Tue, 10 Sep 2002 13:03:13 +1000 Subject: [DB-SIG] Database Independent SQL In-Reply-To: Message-ID: > That would be me -- we have a DB-API abstraction layer that does > quite a few > nice things. Most interestingly, it can perform source-to-source > translations of queries from one dialect of SQL into another Now this is awesome stuff. I think something like this together with the db_rows can make DB apps super portable and easy to code/maintain. > (i.e., MySQL -> > PostgreSQL <-> Oracle <-> MS SQL 2000). Unfortunately, it is not yet open > source since parts some components were developed under a fairly > restrictive > license for some of out clients. We are in the process of > dis-entangling as > much of it as we can for eventual release to the general Python community. Hope we can see it soon. Thanks for the response. Huy From d_webre@yahoo.com Tue Sep 10 22:03:54 2002 From: d_webre@yahoo.com (DJ Webre) Date: Tue, 10 Sep 2002 14:03:54 -0700 (PDT) Subject: [DB-SIG] connect to db2 Message-ID: <20020910210354.4338.qmail@web14204.mail.yahoo.com> I can connect to my db2 table using: self.conn = odbc.odbc('SQLPROD/d6407/password') but I can not connect using: con_str = "'"+self.box_1.GetValue()+'/'+self.box_3.GetValue()+'/'+self.box_4.GetValue()+"'" print con_str try: #self.conn = odbc.odbc('SQLPROD/d6407/password') self.conn = odbc.odbc(con_str) I get the following error: Traceback (most recent call last): File "D:\Documents and Settings\djwebre\My Documents\My Data\Python\mysql\c1.py", line 244, in OnBtnConnect self.conn = odbc.odbc(con_str) dbi.operation-error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified in LOGIN Any suggestions are appreciated. __________________________________________________ Yahoo! - We Remember 9-11: A tribute to the more than 3,000 lives lost http://dir.remember.yahoo.com/tribute From bkline@rksystems.com Tue Sep 10 22:21:15 2002 From: bkline@rksystems.com (Bob Kline) Date: Tue, 10 Sep 2002 17:21:15 -0400 (EDT) Subject: [DB-SIG] connect to db2 In-Reply-To: <20020910210354.4338.qmail@web14204.mail.yahoo.com> Message-ID: On Tue, 10 Sep 2002, DJ Webre wrote: > I can connect to my db2 table using: > > self.conn = odbc.odbc('SQLPROD/d6407/password') > > but I can not connect using: > > > con_str = > "'"+self.box_1.GetValue()+'/'+self.box_3.GetValue()+'/'+self.box_4.GetValue()+"'" > print con_str > try: > #self.conn = odbc.odbc('SQLPROD/d6407/password') > > self.conn = odbc.odbc(con_str) > > > I get the following error: > > Traceback (most recent call last): > File "D:\Documents and Settings\djwebre\My Documents\My > Data\Python\mysql\c1.py", line 244, in OnBtnConnect > self.conn = odbc.odbc(con_str) > dbi.operation-error: [Microsoft][ODBC Driver Manager] Data source name > not found and no default driver specified in LOGIN > > > Any suggestions are appreciated. Drop the leading and closing single quotes. The driver doesn't want them. In other words: con_str = "%s/%s/%s" % (self.box_1.GetValue(), self.box_3.GetValue(), self.box_4.GetValue()) try: self.conn = odbc.odbc(con_str) -- Bob Kline mailto:bkline@rksystems.com http://www.rksystems.com From d_webre@yahoo.com Wed Sep 11 13:37:57 2002 From: d_webre@yahoo.com (DJ Webre) Date: Wed, 11 Sep 2002 05:37:57 -0700 (PDT) Subject: [DB-SIG] connecting to db2 Message-ID: <20020911123757.84082.qmail@web14203.mail.yahoo.com> Thanks guys. Your suggestions worked perfectly. I am an old Fortran programmer and was trying to make my task harder that it actually was. Aint't Python and wxPython and Hammond's extensions great. Now that I am connecting, I need to show **** in the password box and not what is actually typed. Any suggestions? __________________________________________________ Yahoo! - We Remember 9-11: A tribute to the more than 3,000 lives lost http://dir.remember.yahoo.com/tribute From zen@shangri-la.dropbear.id.au Fri Sep 13 03:17:26 2002 From: zen@shangri-la.dropbear.id.au (Stuart Bishop) Date: Fri, 13 Sep 2002 12:17:26 +1000 Subject: [DB-SIG] http://www.python.org/topics/database/DatabaseAPI-2.0.html In-Reply-To: <20020830171655.C780@edelweiss.hyperborea.it> Message-ID: On Saturday, August 31, 2002, at 01:16 AM, m.frasca@hyperborea.com wrote: > Hallo everybody, > > I'm developing yet another web-based interface to an Oracle database > using Python and DCOracle2. I would like to write as little > implementation-dependent code as possible. In this attempt, I miss > something in the API. > > my question is about automatically generated primary keys. > > when I let the database generate the primary keys (the technique > involved > is implementation-dependent), how on earth do I retrieve the keys of my > newly inserted record? You don't without using implementation-dependent code. Just as auto generating primary keys is implementation-dependent, so is retrieving the last used value (in Oracle's case, selecting the current value of the sequence and making sure you have a separate connection per thread). > maybe this possibility is offered somewhere else, but I don't find it > in > the documentation of the API. if it is not there, what about extending > the API by requiring the execute('INSERT ...') to prepare the cursor as > if the user had asked to execute('SELECT ...')? Its not in the API due to the design of SQL (or at least SQL '92). Its not going to happen unless SQL grows a 'returns' clause to the 'select' statement. A higher level API that doesn't use SQL as its interface could do it, but then you have to worry about if your particular RDBMS is supported. > I don't like this solution (in practice, it forces me to accesses > the database *only* from the Python program) I wonder if there was a > discussion on this regard and if the API2 reflects the results of the > discussion. It isn't really that hard to have a Python 'if' statement executing the correct RDBMS specific code. Especially as your DDL already have to be written against a particular RDBMS implementation. -- Stuart Bishop http://shangri-la.dropbear.id.au/ From Denis.CM@Wanadoo.fr Fri Sep 13 08:27:27 2002 From: Denis.CM@Wanadoo.fr (Denis Cartier Millon) Date: Fri, 13 Sep 2002 09:27:27 +0200 Subject: [DB-SIG] pb with Datetime References: Message-ID: <3D81935F.60704@Wanadoo.fr> --------------050504080309040206010302 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit I try to get datetime from sybase with python and a connection ODBC: with the script "select * from Atable" and cursor.execute() (1458, , 4, None, 1.0) why ? when i want to insert this in a database Postgresql : i can't... is there a solution? --------------050504080309040206010302 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit I try to get datetime from sybase with python and a connection ODBC:
with the script "select * from Atable"
and cursor.execute()
(1458, <DateTime object for '2000-12-26 11:04:00.00' at 2148670>, 4, None, 1.0)

why ?

when i want to insert this in a database Postgresql : i can't...

is there a solution?




--------------050504080309040206010302-- From fog@initd.org Fri Sep 13 08:53:58 2002 From: fog@initd.org (Federico Di Gregorio) Date: 13 Sep 2002 09:53:58 +0200 Subject: [DB-SIG] pb with Datetime In-Reply-To: <3D81935F.60704@Wanadoo.fr> References: <3D81935F.60704@Wanadoo.fr> Message-ID: <1031903638.1977.15.camel@momo> --=-J0WzK+HsonIjdEs8NmOc Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Il ven, 2002-09-13 alle 09:27, Denis Cartier Millon ha scritto: > I try to get datetime from sybase with python and a connection ODBC: > with the script "select * from Atable" > and cursor.execute() > (1458, , 4,=20 > None, 1.0) >=20 > why ? because the sybase module is well-written and you get a usefull mx.DateTime object. (i think :) > when i want to insert this in a database Postgresql : i can't... >=20 > is there a solution? two solutions: 1/ use psycopg and bound variables (psycopg has an extension that allows you to directly insert a DateTime, e.g.) curs.execute("""INSERT INTO xxx VALUES (%d, %s)""", (123, psycopg.TimestampFromMx(your_datetime_object))) 2/ convert the DateTime object yourself and insert the result into the db (see both DBAPI and mx documentation for that). --=20 Federico Di Gregorio Debian GNU/Linux Developer & Italian Press Contact fog@debian.org INIT.D Developer fog@initd.org God is real. Unless declared integer. -- Anonymous FORTRAN programmer --=-J0WzK+HsonIjdEs8NmOc Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQA9gZmWvcCgrgZGjesRAnV7AJoCciqxywE4pWQfSaW1IyeX9anzpwCfTv6E H/e/aObiglQ7cDwHOGsHitg= =gTVU -----END PGP SIGNATURE----- --=-J0WzK+HsonIjdEs8NmOc-- From ssgrr2003w@rti7020.etf.bg.ac.yu Sun Sep 15 14:30:36 2002 From: ssgrr2003w@rti7020.etf.bg.ac.yu (ssgrr2003w@rti7020.etf.bg.ac.yu) Date: Sun, 15 Sep 2002 15:30:36 +0200 Subject: [DB-SIG] Invitation to SSGRR conferences in ITALY! Message-ID: <200209151330.g8FDUaP16137@vreme.yubc.net> CALL FOR PAPERS AND PARTICIPATION AT SSGRR CONFERENCES IN YEAR 2003 The SSGRR (Scuola Superiore G Reiss Romoli) Congress Center, Telecom Italia Learning Services, L'Aquila (near Rome), ITALY (www.ssgrr.it). Respected Dr. We are honored to invite you to submit and present your paper(s) at the two SSGRR conferences specified below: INTERNATIONAL CONFERENCES ON ADVANCES IN INFRASTRUCTURE FOR ELECTRONIC BUSINESS, EDUCATION, SCIENCE, MEDICINE, AND MOBILE TECHNOLOGIES ON THE INTERNET WINTER Conference 2003: >From Monday January 6 at 5pm till Sunday January 12 at 10am To submit paper or ask questions: ssgrr2003w@rti7020.etf.bg.ac.yu Keynotes: Lyman (Berkeley), Neuhold (Fraunhofer), Neal (Tufts Medical School), ... SUMMER Conference 2003: >From Monday July 28 at 5pm till Sunday August 3 at 10am To submit paper or ask questions: ssgrr2003s@rti7020.etf.bg.ac.yu Keynotes: Kroto (Nobel Laureate), Patt (IEEE Eckert-Mauchly Laureate), Carlton (US Air Force Surgeon General), ... For details, see IEEE COMPUTER, Aug 2002 (page 33) and the WWW site www.ssgrr.it (written carefully+precisely, with answers to all FAQ). Check with past participants (their names/emails are on the WWW). Most of them believe this is the most interesting, rewarding, and definitely the most hospitable conference they ever attended! Fast professional and peer review in 15 days. Capacity of the SSGRR congress center is 200 participants. The list of participants will be closed after 200 papers accepted. Consequently, SUBMIT YOUR PAPER(S) AS EARLY AS POSSIBLE! ______________________________________________________________________ Location (see WWW for details): SSGRR is the DE-LUX congress and education center of the Telecom Italia Learning Services, located about 60 miles from Rome, near Gran Sasso (the highest Appenini peak), with fast access to the major Appenini ski resorts (in winters, 15 minutes by car), and Adriatic sea beaches (in summers, 45 minutes by car). Keynotes (see WWW for details): A Nobel Laureate was the keynote speaker each year in the past (Jerome Friedman of MIT, Robert Richardson of Cornell, etc...), and the major 2003 keynote is also reserved for a Nobel Laureate (Harry Kroto from United Kingdom). Other 2003 keynote speakers are Yale Patt from UofTexas@Austin (an IEEE Eckert-Mauchly Laureate), Paul Carlton (US Air Force Surgeon General), etc. Schedule (see WWW for details): Monday = Arrival day, registration, and cocktail Tuesday = Gran Sasso Nat'l Lab tour, tutorials, and opening ceremony Wednesday/Thursday/Friday = Presentation of research papers Saturday = Tutorials and peripathetic discussions Sunday = Departure day Deadlines (see WWW for details): For title and abstract (about 100 words): October 15, 2002 (for Winter 2003) April 30, 2003 (for Summer 2003) For papers (IEEE Transactions format, min 4 pages, max 1MB): November 15, 2002 (for Winter 2003) May 30, 2003 (for Summer 2003) For payment (stay, and fee if applicable): December 10, 2002 (for Winter 2003) June 30, 2003 (for Summer 2003) Payment (see WWW for details): No conference fee for those with papers to present (others: euro600). No fee for tutorials. All participants must stay inside SSGRR (no outside stays allowed). Full 6-day stay (from Monday evening till Sunday breakfast): euro1200. A 5-day stay (without one tutorial day): euro1000. Minimal 4-day stay (for research papers only): euro 800. Favourable conditions for accompanying persons (see the WWW). For late payment rules see the WWW. Important (see WWW for details): When submitting your paper, insert the 3-letter field code (exact codes on WWW), so the placement of papers per sessions is more efficient. Insert your WWW site URL (if you have one). If you submit a paper, you will get 2 other papers for a fast review (in up to 10 days). Your presentation time is 25 minutes, plus 5 minutes for discussions. Chairman of the session is the presenter of the last paper in that session. Moving of presentation slots is not permitted (in cases of non-show-up). If you like to be reinvited for a future SSGRR conference, let us know. If you like to be removed from the list, please let us know, too. WE HOPE TO SEE YOU AT SSGRR! Professor Veljko Milutinovic, General Chairman From djc@object-craft.com.au Mon Sep 16 07:39:32 2002 From: djc@object-craft.com.au (Dave Cole) Date: 16 Sep 2002 16:39:32 +1000 Subject: [DB-SIG] pb with Datetime In-Reply-To: <1031903638.1977.15.camel@momo> References: <3D81935F.60704@Wanadoo.fr> <1031903638.1977.15.camel@momo> Message-ID: >>>>> "Federico" == Federico Di Gregorio writes: Federico> Il ven, 2002-09-13 alle 09:27, Denis Cartier Millon ha Federico> scritto: >> I try to get datetime from sybase with python and a connection >> ODBC: with the script "select * from Atable" and cursor.execute() >> (1458, , >> 4, None, 1.0) >> >> why ? Federico> because the sybase module is well-written and you get a Federico> usefull mx.DateTime object. (i think :) You can tell the Sybase module not to return an mxDateTime object for DATETIME columns (although I can't work out why you would do that). All you have to do is import Sybase Sybase.use_datetime = 0 - Dave -- http://www.object-craft.com.au From mal@lemburg.com Mon Sep 16 09:48:57 2002 From: mal@lemburg.com (M.-A. Lemburg) Date: Mon, 16 Sep 2002 10:48:57 +0200 Subject: [DB-SIG] Proposal: Standardized way to get database schema References: <34576.194.250.98.243.1029911327.squirrel@jose.freesurf.fr> Message-ID: <3D859AF9.1090408@lemburg.com> Fabien COUTANT wrote: > Hello, > > I want to go on the idea of standardizing the way > to introspect a database > schema. > > Following the suggestion from Marcos Sanchez > Provencio, I wrote a suggestion for > an API > extension that provides schema introspection. > > What I did: > - tried to conform to the > current spirit of the > API. > - took some ideas from Brian Zimmer > - directly modified HTML since > it's the only > document I have. The DB API is available as PEP 249. If sending in patches, please use the text form of that PEP. > - am not sure whether multi-schema support should > be kept, > since there is otherwise no support > for it in the rest of the API. > - the parts about > primary/foreign keys, procedures > and indexes are incomplete. I just gave the > idea. > - not > sure of the exact list of SQL kinds that > should be included. I don't remember the > standard > perfectly... > > I hope this can be a starting point, as there > is some work remaining. There's a problem with your approach: many databases store the schema information in (system) database tables and to get at these you'd have to run actual queries against the database connection. This usually requires having a cursor setup to perform the tasks, so it would be more natural to expose the various methods on cursor objects rather than to create a new kind of hybrid object for schemas. Another aspect to consider is that databases tend to provide much more information than exposed in your proposal. I'd suggest to use the ODBC catalog methods as basis since these are in wide use and have proven their ability to capture enough information to be of good use to the programmer. BTW, instead of making the API more complicated, we could also have a support module which then supports various backends, much like the dbinfo.py module I started out with some years ago and which has made its way into mxODBC as mx.ODBC.Misc.dbinfo (this module aims at translating abstract schemas into specific database ones to support cross-database schema creation). -- Marc-Andre Lemburg CEO eGenix.com Software GmbH _______________________________________________________________________ eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,... Python Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From rmangaliag@mbox.slu.edu.ph Mon Sep 16 12:10:52 2002 From: rmangaliag@mbox.slu.edu.ph (Ronald Mangaliag) Date: Mon, 16 Sep 2002 19:10:52 +0800 (PHT) Subject: [DB-SIG] mysql vs postgresql (zope) Message-ID: <1032174652.3d85bc3cd98e3@mbox.slu.edu.ph> we're in thr process of choosing a dbms for a small database project here in saint louis university, baguio city, philippines... i was hoping they would approve of my proposal to use zope... and as such... what do you think is the best dbms we should use....??? i'm considering mysql or postgresql.... or maybe, microsoft access.... what do you think is the more recommended??? would you use zope??? what are my alternatives??? fyi.... the database will have atleast 2000 records... i might use a win2k box, p4 1.8ghz as a server... please advice.... thank you.... ------------------------------------------------ E-mail service provided by SLUNET Saint Louis University ( http://www.slu.edu.ph ) ------------------------------------------------ From magnus@thinkware.se Mon Sep 16 15:05:40 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Mon, 16 Sep 2002 16:05:40 +0200 Subject: [DB-SIG] mysql vs postgresql (zope) In-Reply-To: <1032174652.3d85bc3cd98e3@mbox.slu.edu.ph> Message-ID: <5.1.0.14.0.20020916153843.02afeea0@www.thinkware.se> At 19:10 2002-09-16 +0800, Ronald Mangaliag wrote: >we're in thr process of choosing a dbms for a small database project here in >saint louis university, baguio city, philippines... > >i was hoping they would approve of my proposal to use zope... and as such... >what do you think is the best dbms we should use....??? >the database will have atleast 2000 records... >i might use a win2k box, p4 1.8ghz as a server... It's really hopeless to give any recommendations based on the scarse information you have supplied. I don't know about PostGreSQL on Windows. Both MySQL and MS Access are widely used in Windows. How many users? (Total/simultaneous) Do they use the system frequently or sporadically? How big are the records? 2000 addresses is not the same thing as 2000 full length movies stored as mp3 files... What kind of UI are we talking about, web I suppose as you plan on using Zope. What kind of application is it? A lot of transactions? Mainly read only? Lots of complex logic or just simple entry and retrieval. It sounds as a really simple system, and I doubt that it would need anything beyond the builtin cataloging features in Zope. Why do you feel a need for an external dbms? For instance the Zope Bible has an example of an address book application written in Zope. Nothing but Zope and python required... -- Magnus Lycka, Thinkware AB Alvans vag 99, SE-907 50 UMEA, SWEDEN phone: int+46 70 582 80 65, fax: int+46 70 612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From hazmat@objectrealms.net Mon Sep 16 17:19:42 2002 From: hazmat@objectrealms.net (hazmat) Date: Mon, 16 Sep 2002 09:19:42 -0700 Subject: [DB-SIG] mysql vs postgresql (zope) In-Reply-To: <1032174652.3d85bc3cd98e3@mbox.slu.edu.ph> References: <1032174652.3d85bc3cd98e3@mbox.slu.edu.ph> Message-ID: <200209160919.42823.hazmat@objectrealms.net> On Monday 16 September 2002 04:10 am, Ronald Mangaliag wrote: > we're in thr process of choosing a dbms for a small database project here > in saint louis university, baguio city, philippines... > > i was hoping they would approve of my proposal to use zope... and as > such... what do you think is the best dbms we should use....??? > > i'm considering mysql or postgresql.... or maybe, microsoft access.... > > what do you think is the more recommended??? on windows, for rdb i'd use mysql or firebird. postgres is not well suited to windows, imo. as for access... well lets not go there :-) > would you use zope??? what are my alternatives??? i'd use zope... but that just reflects my biases ;-). other options in terms of python web frameworks are numerous. webware, albatross, skunkweb, etc. other things you might want to consider, writer/reader ratios, number of concurrent users. cheers, haz From fcoutant@freesurf.fr Mon Sep 16 17:59:15 2002 From: fcoutant@freesurf.fr (Fabien COUTANT) Date: Mon, 16 Sep 2002 18:59:15 +0200 Subject: [DB-SIG] Proposal: Standardized way to get database schema In-Reply-To: <3D859AF9.1090408@lemburg.com>; from mal@lemburg.com on Mon, Sep 16, 2002 at 10:48:57AM +0200 References: <34576.194.250.98.243.1029911327.squirrel@jose.freesurf.fr> <3D859AF9.1090408@lemburg.com> Message-ID: <20020916185915.A2616@harris> On Monday, 16 September 2002, you (M.-A. Lemburg) wrote: (...) > The DB API is available as PEP 249. If sending in patches, > please use the text form of that PEP. Thanks. Please forgive me for my ignorance of the PEP procedures ! I will prepare a patch and submit it to you... if you are still maintaining it ? > There's a problem with your approach: many databases > store the schema information in (system) database tables > and to get at these you'd have to run actual queries against > the database connection. This usually requires having > a cursor setup to perform the tasks, so it would be > more natural to expose the various methods on cursor > objects rather than to create a new kind of hybrid > object for schemas. Exposing catalog methods on cursor objects doesn't seem natural to me. IMO only a database connection should be required: - It's the driver's job to get the information from that. If this internally implies using SQL requests, then this detail should be hidden to the API user. - You're right on the point that many databases can use SQL queries to get the schema, however I'm sure there are others that don't (Gadfly? Sqlite?). I don't see why we should enforce something that is not necessary, and which could prevent writing such API in some drivers that don't work as you expect. Again the database connection should be enough to retrieve all dependent information (but I may be wrong). > Another aspect to consider is that databases tend to > provide much more information than exposed in your > proposal. Yes. That was just a proposal :) In fact I intended to provide access methods to all Standard SQL attributes of tables, columns and indices. If access to DB specific information is to be provided (which I'm not sure we should do), I would like it to be done through specific methods, so that the API remains the simplest possible, and does not try to support most exotic features from all possible databases ! > I'd suggest to use the ODBC catalog methods as basis > since these are in wide use and have proven their > ability to capture enough information to be of good > use to the programmer. I don't know about ODBC, except that it comes from Bill's world and has a reputation of complexity and slowness. Also I wouldn't like the API to be burdened with lots of MS-specific things. Let's start from Standard SQL; there's enough for it to be useful. > BTW, instead of making the API more complicated, we > could also have a support module which then supports > various backends, much like the dbinfo.py module I > started out with some years ago and which has made its > way into mxODBC as mx.ODBC.Misc.dbinfo (this module aims > at translating abstract schemas into specific database ones > to support cross-database schema creation). Interesting idea. What I'm afraid of, is that it won't encourage writing the necessary support in the driver. But again, this supposes that catalog information is available through SQL queries, hence some databases may not be handled this way. I would use such a solution as a proof of concept to wrap actual drivers, and provide the wanted new methods, until they are integrated in each driver. This is also a safe alternative for databases which use SQL-based catalog access. There have not been much discussion on this subject past weeks. I'm sad to see nearly nobody seems interested. -- Hope this helps, Fabien. From daniel.dittmar@sap.com Tue Sep 17 00:04:57 2002 From: daniel.dittmar@sap.com (Daniel Dittmar) Date: Tue, 17 Sep 2002 01:04:57 +0200 Subject: [DB-SIG] Re: Proposal: Standardized way to get database schema References: <34576.194.250.98.243.1029911327.squirrel@jose.freesurf.fr> <3D859AF9.1090408@lemburg.com> <20020916185915.A2616@harris> Message-ID: <3D866399.406@sap.com> >>Another aspect to consider is that databases tend to >>provide much more information than exposed in your >>proposal. Having objects instead of cursor rows would make it easier to implement database dependent properties (comment, view definition, table sizes, row count, ...) There are also useful methods > There have not been much discussion on this subject past weeks. I'm sad to > see nearly nobody seems interested. Perhaps because those that need it have already implemented their own API (http://dbdoc.sourceforge.net/, http://www.gnuenterprise.org/) Daniel Dittmar -- Daniel Dittmar SAP DB, SAP Labs Berlin daniel.dittmar@sap.com http://www.sapdb.org From rmangaliag@mbox.slu.edu.ph Tue Sep 17 10:12:47 2002 From: rmangaliag@mbox.slu.edu.ph (Ronald Mangaliag) Date: Tue, 17 Sep 2002 17:12:47 +0800 (PHT) Subject: [DB-SIG] mysql vs postgresql (zope) In-Reply-To: <200209160919.42823.hazmat@objectrealms.net> References: <1032174652.3d85bc3cd98e3@mbox.slu.edu.ph> <200209160919.42823.hazmat@objectrealms.net> Message-ID: <1032253967.3d86f20f53473@mbox.slu.edu.ph> tnx... for your support... esp. haz... > on windows, for rdb i'd use mysql or firebird. postgres is not well > suited to > windows, imo. as for access... well lets not go there :-) > > > would you use zope??? what are my alternatives??? > > i'd use zope... but that just reflects my biases ;-). > > other options in terms of python web frameworks are numerous. webware, > albatross, skunkweb, etc. > > other things you might want to consider, writer/reader ratios, number of > > concurrent users. > > cheers, > > haz > ------------------------------------------------------------ ronald ali l. mangaliag computer applications department saint louis university 2600 baguio city, philippines ------------------------------------------------------------ ------------------------------------------------ E-mail service provided by SLUNET Saint Louis University ( http://www.slu.edu.ph ) ------------------------------------------------ From fcoutant@freesurf.fr Tue Sep 17 16:04:53 2002 From: fcoutant@freesurf.fr (Fabien COUTANT) Date: Tue, 17 Sep 2002 17:04:53 +0200 Subject: [DB-SIG] Re: Proposal: Standardized way to get database schema In-Reply-To: <3D866399.406@sap.com>; from daniel.dittmar@sap.com on Tue, Sep 17, 2002 at 01:04:57AM +0200 References: <34576.194.250.98.243.1029911327.squirrel@jose.freesurf.fr> <3D859AF9.1090408@lemburg.com> <20020916185915.A2616@harris> <3D866399.406@sap.com> Message-ID: <20020917170453.B1035@harris> On Tuesday, 17 September 2002, you (Daniel Dittmar) wrote: > > There have not been much discussion on this subject past weeks. I'm sad to > > see nearly nobody seems interested. > > Perhaps because those that need it have already implemented their own > API (http://dbdoc.sourceforge.net/, http://www.gnuenterprise.org/) Right. As I can guess, each one implements its own API over a specific and limited set of drivers, typically the most used DBs (MySql, PgSql, Oracle). That pain would be avoided if the API was standardized. -- Hope this helps, Fabien. From subscriptions@gnumed.net Wed Sep 18 02:33:39 2002 From: subscriptions@gnumed.net (Horst Herb) Date: Wed, 18 Sep 2002 11:33:39 +1000 Subject: [DB-SIG] pb with Datetime References: <3D81935F.60704@Wanadoo.fr> <1031903638.1977.15.camel@momo> Message-ID: <3D87D7F3.4070905@gnumed.net> Dave Cole wrote: > You can tell the Sybase module not to return an mxDateTime object for > DATETIME columns (although I can't work out why you would do that). Why? Usually you display data returned form a query by using str(column). If the object is mxDateTime it will always return the time as well formatted into the string, even if the original data type was just date and not datetime. Thus, you need a case switch every time you want to display the data - which is a pain. Horst From babu@bessy.de Wed Sep 18 11:32:04 2002 From: babu@bessy.de (Babu Manjasetty) Date: Wed, 18 Sep 2002 12:32:04 +0200 (CEST) Subject: [DB-SIG] error1136 Message-ID: Hi there, I end up with the error1136 while submitting data to the MySQL database. The error is the following : Error1136: "Column count doesn't match value count at row 1" What does it mean and how to rectify it?? Looking forward to hearing from you, Babu ################################################################### Dr. Babu A. Manjasetty Protein Structure Factory C/o Bessy GmbH Albert-Einstein-Str.15 12489 Berlin Germany Phone : +49 (0)30 6392 4920 Fax : +49 (0)30 6392 4975 e-mail : babu@bessy.de ################################################################## From magnus@thinkware.se Wed Sep 18 14:18:34 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Wed, 18 Sep 2002 15:18:34 +0200 Subject: [DB-SIG] error1136 In-Reply-To: Message-ID: <5.1.0.14.0.20020918150609.029c9cd0@www.thinkware.se> At 12:32 2002-09-18 +0200, Babu Manjasetty wrote: >Hi there, > >I end up with the error1136 while submitting data to the MySQL >database. The error is the following : > >Error1136: "Column count doesn't match value count at row 1" > >What does it mean and how to rectify it?? It sounds to me as the number of columns in the table (or stated in the insert) doesn't match the number of values you try to submit. See below: mysql> select * from allan -> \g +----+------+ | id | txt | +----+------+ | 1 | A | | 2 | B | +----+------+ 2 rows in set (0.02 sec) mysql> insert into allan values (4) -> \g ERROR 1136: Column count doesn't match value count at row 1 Could you supply an example of the offending code and the relevant table definition? --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From babu@bessy.de Wed Sep 18 14:24:19 2002 From: babu@bessy.de (Babu Manjasetty) Date: Wed, 18 Sep 2002 15:24:19 +0200 (CEST) Subject: [DB-SIG] error1136 In-Reply-To: <5.1.0.14.0.20020918150609.029c9cd0@www.thinkware.se> Message-ID: Hi there, I found the solution to the error 1136. It was my slight mistake in the python script. Anyway thanks to those who replied. Babu ################################################################### Dr. Babu A. Manjasetty Protein Structure Factory C/o Bessy GmbH Albert-Einstein-Str.15 12489 Berlin Germany Phone=09: +49 (0)30 6392 4920 Fax=09: +49 (0)30 6392 4975 e-mail=09: babu@bessy.de ################################################################## On Wed, 18 Sep 2002, Magnus Lycka wrote: > At 12:32 2002-09-18 +0200, Babu Manjasetty wrote: > >Hi there, > > > >I end up with the error1136 while submitting data to the MySQL > >database. The error is the following : > > > >Error1136: "Column count doesn't match value count at row 1" > > > >What does it mean and how to rectify it?? >=20 > It sounds to me as the number of columns in the table (or stated > in the insert) doesn't match the number of values you try to > submit. >=20 > See below: >=20 > mysql> select * from allan > -> \g > +----+------+ > | id | txt | > +----+------+ > | 1 | A | > | 2 | B | > +----+------+ > 2 rows in set (0.02 sec) >=20 > mysql> insert into allan values (4) > -> \g > ERROR 1136: Column count doesn't match value count at row 1 >=20 > Could you supply an example of the offending code and the relevant > table definition? >=20 >=20 > --=20 > Magnus Lyck=E5, Thinkware AB > =C4lvans v=E4g 99, SE-907 50 UME=C5 > tel: 070-582 80 65, fax: 070-612 80 65 > http://www.thinkware.se/ mailto:magnus@thinkware.se >=20 >=20 From printers@sendme.cz Wed Sep 18 19:11:07 2002 From: printers@sendme.cz (A) Date: Wed, 18 Sep 2002 20:11:07 +0200 Subject: [DB-SIG] Is there a widget or program for a database browsing Message-ID: <3D88DDDB.32462.4F89815@localhost> Hi, In my program users will search a database and I need to display choosen record(s ) in a nice graphical way. Is there a module( program), that I could use together with Python, that could easily show the database record(s) and take care of all thinks during browsing? Thanks for help. Ladislav From mal@lemburg.com Thu Sep 19 18:31:02 2002 From: mal@lemburg.com (M.-A. Lemburg) Date: Thu, 19 Sep 2002 19:31:02 +0200 Subject: [DB-SIG] ANN: eGenix.com mxODBC Python Database Interface Version 2.0.5 Message-ID: <3D8A09D6.4050808@lemburg.com> ________________________________________________________________________ ANNOUNCING: eGenix.com mxODBC Database Interface for Python 1.5.2 - 2.2 Version 2.0.5 Full Source Python extension providing ODBC connectivity to Python applications on Windows, Unix abd Linux ________________________________________________________________________ WHAT IS IT ?: The mxODBC Database Interface allows users to connect from Python to just about any database on the market today, on Windows, Unix and Linux -- using just one interface to program against for all supported databases and platforms. This makes mxODBC the ideal basis for writing cross-platform database programs and utilities. mxODBC is included in the eGenix.com mx COMMERCIAL Extension Package for Python, the commercial part of the eGenix.com mx Extension Series, a collection of professional quality software tools which enhance Python's usability in many important areas such as ODBC database connectivity, fast text processing, date/time processing and web site programming. See http://www.egenix.com/ for details. ________________________________________________________________________ WHAT'S NEW ? The 2.0.5 version introduces work-arounds for bugs in various ODBC drivers to enhance the compatibility of mxODBC with Unicode-aware ODBC drivers such as the latest MS Access and MS SQL Server drivers. ________________________________________________________________________ EGENIX.COM MX COMMERCIAL PACKAGE OVERVIEW: mxODBC - Generic ODBC 2.0-3.5 interface for Python mxODBC is an extension package that provides a Python Database API compliant interface to ODBC capable database drivers and managers. In addition to the capabilities provided through the standard DB API it also gives access to a rich set of catalog methods which allow you to scan the database for tables, procedures, etc. Furthermore, it uses the mxDateTime package for date/time value interfacing eliminating most of the problems these types normally introduce (other in/output formats are available too). mxODBC allows you to interface to more than one database from one process, making inter-database interfacing very flexible and reliable. The source version includes a varity of preconfigured setups for many commonly used databases such as MySQL, Oracle, Informix, Solid, SAP DB, Sybase ASA and ASE, DBMaker and many more. The precompiled versions for Windows and Linux include the interfaces to the standard ODBC manager on these platforms to allow for a more easily configurable setup. More details are available at: http://www.egenix.com/files/python/mxODBC.html ________________________________________________________________________ WHERE CAN I DOWNLOAD IT ? The download archives and instructions for installing the package can be found at: http://www.egenix.com/files/python/eGenix-mx-Extensions.html#Packages Note that in order to use the eGenix.com mx COMMERCIAL package you will first need to install the eGenix.com mx BASE package which can be downloaded from the same location. ________________________________________________________________________ WHERE CAN I BUY LICENSES ? mxODBC is free for non-commercial use. Commercial users have to buy licenses for continued use after a 30-day evaluation period. Special licensing setups are available for commercial product developers. Please see http://www.egenix.com/files/python/eGenix-mx-Extensions.html#BuyLicenses for details. ________________________________________________________________________ WHERE CAN I GET SUPPORT ? Commercial quality support for these packages is available from eGenix.com. Please see http://www.egenix.com/files/python/eGenix-mx-Extensions.html#Support for details about our support offerings. ________________________________________________________________________ Enjoy, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH _______________________________________________________________________ eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,... Python Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From srinivas.rao.kollipara@ai.ag Fri Sep 20 09:26:29 2002 From: srinivas.rao.kollipara@ai.ag (Srinivas Rao Kollipara) Date: Fri, 20 Sep 2002 10:26:29 +0200 Subject: [DB-SIG] information needed Message-ID: <6747D50F1AE5D511A02E009027CA36D137B976@exchange.mucs.ai.ag> Hi, Does anyone know any tools which will convert the python code to the oracle plsql code. Thanks in advance Kollipara Srinivas Rao From gerhard.haering@opus-gmbh.net Fri Sep 20 09:36:26 2002 From: gerhard.haering@opus-gmbh.net (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Fri, 20 Sep 2002 10:36:26 +0200 Subject: [DB-SIG] information needed In-Reply-To: <6747D50F1AE5D511A02E009027CA36D137B976@exchange.mucs.ai.ag> References: <6747D50F1AE5D511A02E009027CA36D137B976@exchange.mucs.ai.ag> Message-ID: <20020920083625.GA1964@HAERING> * Srinivas Rao Kollipara [2002-09-20 10:26 +0200]: > Does anyone know any tools which will convert the python code to the oracle > plsql code. I'd be very surprised if there were any, and I believe the chances of any such thing ever appearing are close to zero. Btw. I'm writing a relatively complex algorithm in Python right now, for which the ideal place to be executed would be a stored procedure, but PL/SQL isn't quite up to the job as far as I can see. While it were possible to write this algorithm in PL/SQL, it would be a major PITA, as PL/SQL seems to lack many of the interesting data structures like dictionaries and lists, which would be clumsy to emulate via cursors, temporary tables and arrays. But then, I hardly know PL/SQL. OTOH if you use PostgreSQL, you can write your stored procedures in Python :-) -- Gerhard Häring OPUS GmbH München Tel.: +49 89 - 889 49 7 - 32 http://www.opus-gmbh.net/ From dario@ita.chalmers.se Tue Sep 24 20:22:54 2002 From: dario@ita.chalmers.se (=?iso-8859-1?Q?Dario_Lopez-K=E4sten?=) Date: Tue, 24 Sep 2002 21:22:54 +0200 Subject: [DB-SIG] information needed References: <6747D50F1AE5D511A02E009027CA36D137B976@exchange.mucs.ai.ag> <20020920083625.GA1964@HAERING> Message-ID: <034501c263ff$c8d33390$4bdf1081@ita.chalmers.se> ----- Original Message ----- From: "Gerhard Häring" > * Srinivas Rao Kollipara [2002-09-20 10:26 +0200]: > > Does anyone know any tools which will convert the python code to the oracle > > plsql code. > > I'd be very surprised if there were any, and I believe the chances of any such > thing ever appearing are close to zero. Btw. I'm writing a relatively complex > algorithm in Python right now, for which the ideal place to be executed would > be a stored procedure, but PL/SQL isn't quite up to the job as far as I can > see. While it were possible to write this algorithm in PL/SQL, it would be a > major PITA, as PL/SQL seems to lack many of the interesting data structures > like dictionaries and lists, which would be clumsy to emulate via cursors, > temporary tables and arrays. But then, I hardly know PL/SQL. > > OTOH if you use PostgreSQL, you can write your stored procedures in Python :-) > -- I hardly think that switching from oracle to Postgres is an option, if you already have oracle expertise at hand... Converting python to plsql should not be impossibly hard, though it might prove a fair bit of a challenge, for the very reasons that Gerhard point out, lack of nice data structures (though I might prefer python over pl/sql i find that pl/sql is not as bad as you would come to expect). You could use java, which can be run natively in the db, given a decently recent oracle version, and which might be, from what I hear, even faster than pl/sql. Another high-tech, bleeding edge option would be to somehow convert python to a shared library and use Oracle's nifty "use shared libraries trough pl/sql" functionality to execute the python code "inside" the oracle database... though I must confess I have not the faintest idea of how feasible this is :) Cheers, /dario - -------------------------------------------------------------------- Dario Lopez-Kästen, dario@ita.chalmers.se IT Systems & Services System Developer/System Administrator Chalmers University of Tech. From brian@dorseys.org Wed Sep 25 01:17:51 2002 From: brian@dorseys.org (Brian Dorsey) Date: Tue, 24 Sep 2002 17:17:51 -0700 Subject: [DB-SIG] information needed In-Reply-To: <034501c263ff$c8d33390$4bdf1081@ita.chalmers.se> References: <6747D50F1AE5D511A02E009027CA36D137B976@exchange.mucs.ai.ag> <20020920083625.GA1964@HAERING> <034501c263ff$c8d33390$4bdf1081@ita.chalmers.se> Message-ID: <20020925001751.GA11632@dorseys.org> On Tue, Sep 24, 2002 at 09:22:54PM +0200, Dario Lopez-K?sten wrote: > You could use java, which can be run natively in the db, given a decently > recent oracle version, and which might be, from what I hear, even faster > than pl/sql. > Cheers, > > /dario > > - -------------------------------------------------------------------- > Dario Lopez-K?sten, dario@ita.chalmers.se IT Systems & Services > System Developer/System Administrator Chalmers University of Tech. Hmm... I have no experience with either, however - If you can run Java in Oracle, does that mean Jython is possible? -Brian From jekabs.andrusaitis@tietoenator.com Mon Sep 30 14:18:19 2002 From: jekabs.andrusaitis@tietoenator.com (Jekabs Andrushaitis) Date: Mon, 30 Sep 2002 15:18:19 +0200 Subject: [DB-SIG] error1136 In-Reply-To: Message-ID: <001401c26883$d8b0dff0$262a949f@konts.lv> It is always useful to post on mailing list about your problem! Usually by the time you finish writing about the problem - you find the solution yourself. So, faster you ask others, sooner you will fix it yourself! :) Jekabs Andrushaitis Senior system analyst TietoEnator Financial Solutions 41 Lacplesa Str. Riga, LV-1011, Latvia Tel: +371 7286660 Fax: +371 7243000 E-mail: jekabs.andrusaitis@tietoenator.com > -----Original Message----- > From: db-sig-admin@python.org > [mailto:db-sig-admin@python.org]On Behalf > Of Babu Manjasetty > Sent: tre=D2diena, 2002. gada 18. septembr=CF 15:24 > To: Magnus Lycka > Cc: db-sig@python.org > Subject: Re: [DB-SIG] error1136 > > > > Hi there, > > I found the solution to the error 1136. It was my slight > mistake in the > python script. > > Anyway thanks to those who replied. > > Babu > > ################################################################### > > Dr. Babu A. Manjasetty > Protein Structure Factory > C/o Bessy GmbH > Albert-Einstein-Str.15 > 12489 Berlin Germany > Phone : +49 (0)30 6392 4920 > Fax : +49 (0)30 6392 4975 > e-mail : babu@bessy.de > > ################################################################## > > On Wed, 18 Sep 2002, Magnus Lycka wrote: > > > At 12:32 2002-09-18 +0200, Babu Manjasetty wrote: > > >Hi there, > > > > > >I end up with the error1136 while submitting data to the MySQL > > >database. The error is the following : > > > > > >Error1136: "Column count doesn't match value count at row 1" > > > > > >What does it mean and how to rectify it?? > > > > It sounds to me as the number of columns in the table (or stated > > in the insert) doesn't match the number of values you try to > > submit. > > > > See below: > > > > mysql> select * from allan > > -> \g > > +----+------+ > > | id | txt | > > +----+------+ > > | 1 | A | > > | 2 | B | > > +----+------+ > > 2 rows in set (0.02 sec) > > > > mysql> insert into allan values (4) > > -> \g > > ERROR 1136: Column count doesn't match value count at row 1 > > > > Could you supply an example of the offending code and the relevant > > table definition? > > > > > > -- > > Magnus Lyck=E5, Thinkware AB > > =C4lvans v=E4g 99, SE-907 50 UME=C5 > > tel: 070-582 80 65, fax: 070-612 80 65 > > http://www.thinkware.se/ mailto:magnus@thinkware.se > > > > > > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig > From gandalf@sum.desktop.com.br Mon Sep 30 16:35:48 2002 From: gandalf@sum.desktop.com.br (Marcelo Pereira) Date: Mon, 30 Sep 2002 12:35:48 -0300 (BRST) Subject: [DB-SIG] PostgreSQL + Python Message-ID: Hi there, I have been using PHP to access my PostgreSQL database and now I am moving to Python. I can access the database using the interactive mode, and I can do some single things. I am using PyGreSQL. My two questions: - Is PyGreSQL the unique (and the best) way to access PostgreSQL from Python? - Is there a PyGreSQL reference manual?? Thanks in advance, Best Regards, Marcelo Pereira -- Remember that only God and ^[:w saves. __ (_.\ =A9 Marcelo Pereira | / / ___ marcelo@pereira.com | / (_/ _ \__ [Math|99]-IMECC | _______\____/_\___)___Unicamp_(Brazil_______/ From fog@initd.org Mon Sep 30 16:41:05 2002 From: fog@initd.org (Federico Di Gregorio) Date: 30 Sep 2002 17:41:05 +0200 Subject: [DB-SIG] PostgreSQL + Python In-Reply-To: References: Message-ID: <1033400465.1346.117.camel@momo> --=-9SV1r/oT4zys7/Mexhxc Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Il lun, 2002-09-30 alle 17:35, Marcelo Pereira ha scritto: > Hi there, >=20 > I have been using PHP to access my PostgreSQL database and now I am > moving to Python. >=20 > I can access the database using the interactive mode, and I can do some > single things. I am using PyGreSQL. >=20 > My two questions: >=20 > - Is PyGreSQL the unique (and the best) way to access PostgreSQL > from Python? nope. you also have popy, pyPgSQL and psycopg (that i know of.. python adapters for postgresql are proliferating lately..) --=20 Federico Di Gregorio Debian GNU/Linux Developer & Italian Press Contact fog@debian.org INIT.D Developer fog@initd.org We are all dust, Saqi, so play the lute We are all wind, Saqi, so bring wine. -- Omar Khayam --=-9SV1r/oT4zys7/Mexhxc Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (GNU/Linux) iD8DBQA9mHCRvcCgrgZGjesRAni6AJ98XYej4mXQzhptSpdFYBihzz4BPQCdGmYW TQu9EHyfY93hn5KUeLFdVQY= =ZR8Z -----END PGP SIGNATURE----- --=-9SV1r/oT4zys7/Mexhxc-- From gandalf@sum.desktop.com.br Mon Sep 30 18:11:02 2002 From: gandalf@sum.desktop.com.br (Marcelo Pereira) Date: Mon, 30 Sep 2002 14:11:02 -0300 (BRST) Subject: [DB-SIG] Popy - Psycopg - PyPgSQL - PyGreSQL Message-ID: Hi there (again), I have download these Python interfaces to PostgreSQL and I haven't find any documentation (just some examples, basic and advanced, but just examples). Which is the better one?? (I know this is a question like: "PostgreSQL o= r MySQL", "RedHat or Slackware", "Vi or Emacs", ..., or another religious question...) I just want to know which is more efficient. Which module do you use? I would be happy if I had a reference manual (from any one: Popy, Psycopg, PyPgSQL or PyGreSQL). Where can I find a reference manual? Best Regards, Thanks in advance, Marcelo Pereira -- Remember that only God and ^[:w saves. __ (_.\ =A9 Marcelo Pereira | / / ___ marcelo@pereira.com | / (_/ _ \__ [Math|99]-IMECC | _______\____/_\___)___Unicamp_______________/ From fog@initd.org Mon Sep 30 18:29:24 2002 From: fog@initd.org (Federico Di Gregorio) Date: 30 Sep 2002 19:29:24 +0200 Subject: [DB-SIG] Popy - Psycopg - PyPgSQL - PyGreSQL In-Reply-To: References: Message-ID: <1033406964.1338.130.camel@momo> --=-eWynEb1crEsARZzBst36 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Il lun, 2002-09-30 alle 19:11, Marcelo Pereira ha scritto: > Hi there (again), >=20 > I have download these Python interfaces to PostgreSQL and I haven't find > any documentation (just some examples, basic and advanced, but just > examples). >=20 > Which is the better one?? (I know this is a question like: "PostgreSQL o= r > MySQL", "RedHat or Slackware", "Vi or Emacs", ..., or another religious > question...) I just want to know which is more efficient. i can't say "this one is better" but i can say that psycopg is very solid and almost bug-free. it is also quite fast (it was designed for speed) but i never tried a benchmark, mainly because i think benchmarks should be done on real-world cases. note that i am its main author, maybe you want to wait for others' module authors to speak on this list before going for it.. :) > Which module do you use? I would be happy if I had a reference manual > (from any one: Popy, Psycopg, PyPgSQL or PyGreSQL). they all implement the dbapi-2.0 to some extent, so you should be fine by just reading the PEP. psycopg has a lot of example code in doc/examples/ and support some nice dbapi-2.0 extensions like connection pooling, user-defined typecasters (to conver postgres data ti python objects), etc. hope this helps, federico --=20 Federico Di Gregorio Debian GNU/Linux Developer & Italian Press Contact fog@debian.org INIT.D Developer fog@initd.org God is real. Unless declared integer. -- Anonymous FORTRAN programmer --=-eWynEb1crEsARZzBst36 Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (GNU/Linux) iD8DBQA9mIn0vcCgrgZGjesRAvAgAKDNN10utu0MCoOijf2ZQaC1Ltn9/ACgzuxx CIHtMknSTw1AEjoq9o6WTvY= =btrT -----END PGP SIGNATURE----- --=-eWynEb1crEsARZzBst36-- From magnus@thinkware.se Mon Sep 30 22:21:31 2002 From: magnus@thinkware.se (Magnus Lycka) Date: Mon, 30 Sep 2002 23:21:31 +0200 Subject: [DB-SIG] Popy - Psycopg - PyPgSQL - PyGreSQL In-Reply-To: <1033406964.1338.130.camel@momo> References: Message-ID: <5.1.0.14.0.20020930231112.02902848@www.thinkware.se> >Il lun, 2002-09-30 alle 19:11, Marcelo Pereira ha scritto: > > Which is the better one?? (I know this is a question like: "PostgreSQL= or > > MySQL", "RedHat or Slackware", "Vi or Emacs", ..., or another religious > > question...) I just want to know which is more efficient. Are there any good feature comparisions of DB-API modules (not just for PostgreSQL) on the web? Maybe it would be a good thing for the Python Wiki http://www.python.org/cgi-bin/moinmoin/ I've seen (just checked :) http://www.python.org/cgi-bin/moinmoin/ChoosingDatabase but it would be nice to see something more of a table with columns like name rdbms development status licence OS Python versions Quoting styles thread support extras limitations Something like that... BTW, the python wiki is really becomming a resource I think, and I hope some of you will help add substance to it. --=20 Magnus Lyck=E5, Thinkware AB =C4lvans v=E4g 99, SE-907 50 UME=C5 tel: 070-582 80 65, fax: 070-612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se