From fog@initd.org Sat Mar 1 11:26:23 2003 From: fog@initd.org (Federico Di Gregorio) Date: 01 Mar 2003 12:26:23 +0100 Subject: [DB-SIG] Re: Towards a single parameter style In-Reply-To: References: Message-ID: <1046517983.1922.48.camel@momo.initd.org> --=-yWDlNnc61Klwl6o4jGar Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Il gio, 2003-02-27 alle 09:03, Denis S. Otkidach ha scritto: [snip] > Bith examples show that errors are hard to find. To fix second > example we should check the length of query, i.e.: > if condition: thank you very much for the explanation. i think (but is just IMHO, obviously) that you choosed a complicated and error prone style (mixing query and argument) and to avoid error you just made it heavier (mandatory Param()). i don't see any benefits over the standard way of binding variables. --=20 Federico Di Gregorio Debian GNU/Linux Developer fog@debian.org INIT.D Developer fog@initd.org Gli avvoltoi cinesi si nutrono di arte, ma possono anche mangiare i `domani'. -- Haruki Murakami --=-yWDlNnc61Klwl6o4jGar Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQA+YJjfvcCgrgZGjesRAhMZAKC+gfv9khry9YqHL/Hz6Q8X2e33vQCgsYBo QB6T0mUV4fXEEkZ083M+JTA= =tjo4 -----END PGP SIGNATURE----- --=-yWDlNnc61Klwl6o4jGar-- From fog@initd.org Mon Mar 3 09:06:24 2003 From: fog@initd.org (Federico Di Gregorio) Date: 03 Mar 2003 10:06:24 +0100 Subject: [DB-SIG] Re: Towards a single parameter style In-Reply-To: References: Message-ID: <1046682384.1066.5.camel@momo.initd.org> --=-U+zDc/SrRvtnVJQunhTy Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Il lun, 2003-03-03 alle 09:38, Denis S. Otkidach ha scritto: > On 1 Mar 2003, Federico Di Gregorio wrote: >=20 > FDG> thank you very much for the explanation. i think (but is > FDG> just IMHO, > FDG> obviously) that you choosed a complicated and error prone > FDG> style (mixing > FDG> query and argument) and to avoid error you just made it > FDG> heavier > FDG> (mandatory Param()). i don't see any benefits over the > FDG> standard way of > FDG> binding variables. >=20 > You already must use explicit wrapping for parameters of type > Date, DateTime, Binary, so requirement to wrap all parameters > doesn't make it mach havier. Inlined definition is much easier > to read and expressed this way can be applied to any database > (can be converted to any existing DB API parameters style). > There is _no_ standard way (I mean one working with all > databases) to bind parameters, so it's not an option. this is utopia. dbapi should provide a standard API, *not* a database compatbility layer. if i use "LIMIT 5 OFFSET 10" in my SQL query, no database other than postgresql will accept it. i bet 95% of the SQL code out there is already tied to a specific backend. also, building lists and/or dictionaries of variables is so usefull (think about passing obj.__dict__ to execute) that makes nonsense to force splitting the query. --=20 Federico Di Gregorio Debian GNU/Linux Developer fog@debian.org INIT.D Developer fog@initd.org The devil speaks truth much oftener than he's deemed. He has an ignorant audience. -- Byron (suggested by Alice Fontana) --=-U+zDc/SrRvtnVJQunhTy Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQA+YxsQvcCgrgZGjesRAvqvAJ9s5v4t7UalNLv8QBk/1lut4vNTjgCfepOa fms/lOUFl0A+GatLX6f4n0Y= =DWGT -----END PGP SIGNATURE----- --=-U+zDc/SrRvtnVJQunhTy-- From ods@strana.ru Mon Mar 3 14:12:56 2003 From: ods@strana.ru (Denis S. Otkidach) Date: Mon, 3 Mar 2003 17:12:56 +0300 (MSK) Subject: [DB-SIG] Re: Towards a single parameter style Message-ID: On 1 Mar 2003, Federico Di Gregorio wrote: FDG> thank you very much for the explanation. i think (but is FDG> just IMHO, FDG> obviously) that you choosed a complicated and error prone FDG> style (mixing FDG> query and argument) and to avoid error you just made it FDG> heavier FDG> (mandatory Param()). i don't see any benefits over the FDG> standard way of FDG> binding variables. You already must use explicit wrapping for parameters of type Date, DateTime, Binary, so requirement to wrap all parameters doesn't make it mach havier. Inlined definition is much easier to read and expressed this way can be applied to any database (can be converted to any existing DB API parameters style). There is _no_ standard way (I mean one working with all databases) to bind parameters, so it's not an option. -- Denis S. Otkidach http://www.python.ru/ [ru] From wilk-ml@flibuste.net Wed Mar 5 16:50:41 2003 From: wilk-ml@flibuste.net (William Dode) Date: 05 Mar 2003 17:50:41 +0100 Subject: [DB-SIG] adodbapi Message-ID: <873cm1ep0e.fsf@flibuste.net> hi, Is the project still alive ? I submit a patch to correct the error when msaccess return tuple for currency instead of float. I also plan to submit a patch to improve speed with getrows like kevin. Maybe somebody did it ? -- --- ado/adodbapi/adodbapi.py 2003-03-05 17:20:18.000000000 +0100 +++ adodbapi.py 2003-03-05 17:21:34.000000000 +0100 @@ -22,6 +22,7 @@ import string import exceptions import win32com.client +import types import mx.DateTime as datelibrary # This module uses the following functions of the datelibrary: @@ -599,6 +600,8 @@ return datelibrary.DateTimeFromCOMDate(variant) if type_code == NUMBER: try: + if type(variant) == types.TupleType: # msaccess currency + return float(variant[1]/10000.0) return float(variant) except ValueError: #A comma is a dot in Sweden, the regional settings are used in the variant William Dode - http://flibuste.net From anthony@computronix.com Wed Mar 5 19:06:17 2003 From: anthony@computronix.com (Anthony Tuininga) Date: 05 Mar 2003 12:06:17 -0700 Subject: [DB-SIG] cx_Oracle download issues Message-ID: <1046891182.7590.97.camel@chl0151.edmonton.computronix.com> Due to a security "enhancement" by Microsoft for IIS, files to be downloaded may not end in .exe. The installer files are being renamed to .exe.bbb which bypasses the "security check" so remove the phony extension upon download. My apologies for the inconvenience but my company uses IIS for its web site. On that note, a while ago someone mentioned that they would be willing to host the binaries for me. If that is still a possibility please contact me and I'll see what can be arranged. Thanks. -- Anthony Tuininga anthony@computronix.com Computronix Distinctive Software. Real People. Suite 200, 10216 - 124 Street NW Edmonton, AB, Canada T5N 4A3 Phone: (780) 454-3700 Fax: (780) 454-3838 http://www.computronix.com From esizikov@teleross.ru Thu Mar 6 01:53:41 2003 From: esizikov@teleross.ru (Eugene P. Sizikov) Date: 06 Mar 2003 09:53:41 +0800 Subject: [DB-SIG] DB API v2.0 : how am I to get a field default value if it isn't in Cursor.description Message-ID: <1046915621.13724.15.camel@esizikov.irkutsk.teleross.ru> Hello! I'm using Python with MySQLdb (DB API v2.0 compatible), and surpriselly have not found a way to get some SQL table structural information such as fields DEFAULT value and fields index type (PRIMARY, FOREIGN, UNIQUE, MULTIPLE and so on). How am I to get that info if it isn't in Cursor.description? While looking into MySQL-python sources I realized that the info (at least default values) is just unused when the Python 'description' tuple is constructed. So, I think that at least fields DEFAULT value MUST be in Cursor.description! Any comments or hints or advices? Best regards Eugene Sizikov Golden Telecom, TeleRoss Russian Federation From Anthony Baxter Thu Mar 6 02:06:49 2003 From: Anthony Baxter (Anthony Baxter) Date: Thu, 06 Mar 2003 13:06:49 +1100 Subject: [DB-SIG] DB API v2.0 : how am I to get a field default value if it isn't in Cursor.description In-Reply-To: <1046915621.13724.15.camel@esizikov.irkutsk.teleross.ru> Message-ID: <200303060206.h2626np29161@localhost.localdomain> >>> "Eugene P. Sizikov" wrote > Hello! > > I'm using Python with MySQLdb (DB API v2.0 compatible), and surpriselly > have not found a way to get some SQL table structural information such > as fields DEFAULT value and fields index type (PRIMARY, FOREIGN, UNIQUE, > MULTIPLE and so on). How am I to get that info if it isn't in > Cursor.description? While looking into MySQL-python sources I realized > that the info (at least default values) is just unused when the Python > 'description' tuple is constructed. With databases like Oracle, there are other system tables in the database that contain this information. Anthony From esizikov@teleross.ru Thu Mar 6 02:27:30 2003 From: esizikov@teleross.ru (Eugene P. Sizikov) Date: 06 Mar 2003 10:27:30 +0800 Subject: [DB-SIG] DB API v2.0 : how am I to get a field default value if it isn't in Cursor.description In-Reply-To: <200303060206.h2626np29161@localhost.localdomain> References: <200303060206.h2626np29161@localhost.localdomain> Message-ID: <1046917650.13724.22.camel@esizikov.irkutsk.teleross.ru> Hello, Anthony! Well, with MySQL too, but you'll need special (administrator) priveleges to read that tables which is not good (security and roles). Any other way? 06.03.2003, at 10:06, Anthony Baxter wrote: > >>> "Eugene P. Sizikov" wrote > > Hello! > > > > I'm using Python with MySQLdb (DB API v2.0 compatible), and surpriselly > > have not found a way to get some SQL table structural information such > > as fields DEFAULT value and fields index type (PRIMARY, FOREIGN, UNIQUE, > > MULTIPLE and so on). How am I to get that info if it isn't in > > Cursor.description? While looking into MySQL-python sources I realized > > that the info (at least default values) is just unused when the Python > > 'description' tuple is constructed. > > With databases like Oracle, there are other system tables in the database > that contain this information. > > Anthony Best regards Eugene Sizikov Golden Telecom, TeleRoss Russian Federation From henrik.ekelund@vpd.se Thu Mar 6 08:30:55 2003 From: henrik.ekelund@vpd.se (Henrik Ekelund) Date: Thu, 6 Mar 2003 09:30:55 +0100 Subject: [DB-SIG] adodbapi Message-ID: Thanks for the patch, yes adodbapi is alive. A new version is coming very soon with improvements in verious areas. GetRows will be included in the new version, thanks to Jim Abrams. /Henrik Ekelund > -----Original Message----- > From: William Dode [mailto:wilk-ml@flibuste.net] > Sent: den 5 mars 2003 17:51 > To: db-sig@python.org > Subject: [DB-SIG] adodbapi > > > hi, > > Is the project still alive ? > I submit a patch to correct the error when msaccess return tuple for > currency instead of float. > > I also plan to submit a patch to improve speed with getrows like > kevin. Maybe somebody did it ? > > -- --- ado/adodbapi/adodbapi.py 2003-03-05 17:20:18.000000000 +0100 > +++ adodbapi.py 2003-03-05 17:21:34.000000000 +0100 > @@ -22,6 +22,7 @@ > import string > import exceptions > import win32com.client > +import types > > import mx.DateTime as datelibrary > # This module uses the following functions of the datelibrary: > @@ -599,6 +600,8 @@ > return datelibrary.DateTimeFromCOMDate(variant) > if type_code == NUMBER: > try: > + if type(variant) == types.TupleType: # msaccess currency > + return float(variant[1]/10000.0) > return float(variant) > except ValueError: > #A comma is a dot in Sweden, the regional > settings are used in the variant > > > William Dode - http://flibuste.net > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig > ********************************************************************** This email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ********************************************************************** From wilk-ml@flibuste.net Thu Mar 6 09:06:50 2003 From: wilk-ml@flibuste.net (William Dode) Date: 06 Mar 2003 10:06:50 +0100 Subject: [DB-SIG] adodbapi In-Reply-To: References: Message-ID: <87wujcn9sl.fsf@flibuste.net> Henrik Ekelund writes: > Thanks for the patch, > yes adodbapi is alive. A new version is coming very soon with improvements > in verious areas. Is there a mailing-list open to speak about dev of adodbapi ? I also wanted to make the test usable on empty database (with create of table) but maybe it's done also... --=20 William Dod=E9 - http://flibuste.net From webmaster@pferdemarkt.ws Thu Mar 6 14:00:34 2003 From: webmaster@pferdemarkt.ws (webmaster@pferdemarkt.ws) Date: Thu, 6 Mar 2003 06:00:34 -0800 Subject: [DB-SIG] Pferdemarkt.ws informiert! Newsletter 03/2003 http://www.pferdemarkt.ws Message-ID: <200303061400.GAA20603@eagle.he.net> http://www.pferdemarkt.ws Wir sind in 2003 erfolgreich in des neue \"Pferdejahr 2003 gestartet. Für den schnellen Erfolg unseres Marktes möchten wir uns bei Ihnen bedanken. Heute am 06.03.2003 sind wir gut 2 Monate Online! Täglich wächst unsere Datenbank um 30 Neue Angebote. Stellen auch Sie als Privatperson Ihre zu verkaufenden Pferde direkt und vollkommen Kostenlos ins Internet. Zur besseren Sichtbarmachung Ihrer Angebote können SIe bis zu ein Bild zu Ihrer Pferdeanzeige kostenlos einstellen! Wollen Sie direkt auf die erste Seite, dann können wir Ihnen unser Bonussystem empfehlen. klicken Sie hier: http://www.pferdemarkt.ws/bestellung.html Ihr http://Pferdemarkt.ws Team Klicken Sie hier um sich direkt einzuloggen http://www.Pferdemarkt.ws Kostenlos Anbieten, Kostenlos Suchen! Direkt von Privat zu Privat! Haben Sie noch Fragen mailto: webmaster@pferdemarkt.ws From henrik.ekelund@vpd.se Thu Mar 6 16:01:08 2003 From: henrik.ekelund@vpd.se (Henrik Ekelund) Date: Thu, 6 Mar 2003 17:01:08 +0100 Subject: [DB-SIG] adodbapi Message-ID: I have now created two new mailing lists for=20 adodbapi, one for developers and one for users. adodbapi-developer@lists.sourceforge.net=20 and adodbapi-user@lists.sourceforge.net There is also an adodbapi-announce@lists.sourceforge.net I think its a good idea to make the tests usable on an empty database,=20 but I would suggest you wait just some days until the new version is=20 released. There is a new structure of the tests in that version.=20 If I get your sourceforge unix name I can add you as a developer. /Henrik Ekelund > -----Original Message----- > From: William Dode [mailto:wilk-ml@flibuste.net] > Sent: den 6 mars 2003 10:07 > To: db-sig@python.org > Subject: Re: [DB-SIG] adodbapi >=20 >=20 > Henrik Ekelund writes: >=20 > > Thanks for the patch, > > yes adodbapi is alive. A new version is coming very soon=20 > with improvements > > in verious areas. >=20 > Is there a mailing-list open to speak about dev of adodbapi ? I also > wanted to make the test usable on empty database (with create=20 > of table) > but maybe it's done also... >=20 > --=20 > William Dod=E9 - http://flibuste.net >=20 > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig >=20 ********************************************************************** This email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ********************************************************************** From andy@dustman.net Sun Mar 9 18:26:06 2003 From: andy@dustman.net (Andy Dustman) Date: 09 Mar 2003 13:26:06 -0500 Subject: [DB-SIG] DB API compliance test--clarification In-Reply-To: <3E5096A7.7000604@lemburg.com> References: <20030217010939.87720.qmail@web11002.mail.yahoo.com> <3E5096A7.7000604@lemburg.com> Message-ID: <1047234366.12629.14.camel@chef.neosouth.net> On Mon, 2003-02-17 at 03:00, M.-A. Lemburg wrote: > David Rushby wrote: > > Code snippet from Stuart's DB API compliance suite: > > > > ----------- > > def test_commit(self): > > con = self._connect() > > try: > > # Commit must work, even if it doesn't do anything > > con.commit() > > finally: > > con.close() > > ----------- > > > > Is it reasonable to commit a transaction without ever having created > > it? > > You create the transaction implicitly by connecting to the database. Transactions are implicitly created when you execute a statement that changes the state of the database (INSERT, UPDATE, DELETE), or retrieves data (SELECT). Note that in at least some cases (MySQL), CREATE and DROP TABLE are NOT transactional. Some examples of this: http://manuals.sybase.com/onlinebooks/group-as/asg1250e/sqlug/@Generic__BookTextView/53740 The SQL standards-compatible mode, called chained mode, implicitly begins a transaction before any data retrieval or modification statement. These statements include: delete, insert, open, fetch, select, and update. You must still explicitly end the transaction with commit transaction or rollback transaction. http://www-3.ibm.com/software/data/db2/udb/ad/v7/adg/db2a0/db2a010.htm#HDRC9H27 A transaction begins implicitly with the first executable SQL statement and ends with either a COMMIT or a ROLLBACK statement, or when the program ends. http://mail.python.org/pipermail/db-sig/1999-August/000998.html Well basically, ADO should do all this for you. Here is what the ODBC docs say about transactions: """ Performing Transactions In auto-commit mode, every SQL statement is a complete transaction, which is automatically committed. In manual-commit mode, a transaction consists of one or more statements. In manual-commit mode, when an application submits an SQL statement and no transaction is open, the driver implicitly begins a transaction. The transaction remains open until the application commits or rolls back the transaction. """ You can find some other references via google: http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&safe=off&q=sql+transactions+begin+implicitly&btnG=Google+Search but I like the last one the best. ;) -- Andy Dustman PGP: 0x930B8AB6 @ .net http://dustman.net/andy Freedom isn't free. It's sold to the highest bidder. From andy47@halfcooked.com Mon Mar 10 16:46:57 2003 From: andy47@halfcooked.com (Andy Todd) Date: Mon, 10 Mar 2003 16:46:57 +0000 Subject: [DB-SIG] ODBC parameters and T-SQL functions Message-ID: <20030310164656.GA2436@LATITUDE6> Afternoon all. I am writing a script in Python 2.2 using mxODBC talking to SQL Server 2000. I'm getting errors when I pass an mxDateTime object as a parameter to a SQL statement. But its only when the parameter is subsequently used in a T-SQL function, specifically DATEDIFF. Elsewhere (for instance in a where clause) I can pass this same value in without a hitch. Has anyone seen this before? The reason I ask is because this works with the win32all odbc package but not with mxODBC. Here is an echo of my interactive session; >>> from mx import ODBC >>> from mx import DateTime >>> db=ODBC.Windows.connect('Wine') >>> cursor=db.cursor() >>> myDate=DateTime.DateFrom('31-DEC-2002') >>> stmt = "SELECT share_number ,datediff(Month, date_of_election, ?) FROM member_details" >>> cursor.execute(stmt, (myDate,)) ceback (most recent call last): File "", line 1, in ? ProgrammingError: ('37000', 0, '[Microsoft][ODBC SQL Server Driver]Syntax error or access violation', 4498) >>> >>> db.close() >>> import odbc >>> db=odbc.odbc('Wine') >>> cursor=db.cursor() >>> cursor.execute(stmt, (myDate,)) 0 >>> results=cursor.fetchone() >>> results (1, 338) >>> What am I doing wrong? Regards, Andy -- -------------------------------------------------------------------------------- >From the desk of Andrew J Todd esq - http://www.halfcooked.com/ From mal@lemburg.com Mon Mar 10 17:13:02 2003 From: mal@lemburg.com (M.-A. Lemburg) Date: Mon, 10 Mar 2003 18:13:02 +0100 Subject: [DB-SIG] ODBC parameters and T-SQL functions In-Reply-To: <20030310164656.GA2436@LATITUDE6> References: <20030310164656.GA2436@LATITUDE6> Message-ID: <3E6CC79E.8050607@lemburg.com> Andy Todd wrote: > Afternoon all. I am writing a script in Python 2.2 using mxODBC talking to SQL Server 2000. > > I'm getting errors when I pass an mxDateTime object as a parameter to a SQL statement. But its only when the parameter is subsequently used in a T-SQL function, specifically DATEDIFF. Elsewhere (for instance in a where clause) I can pass this same value in without a hitch. > > Has anyone seen this before? The reason I ask is because this works with the win32all odbc package but not with mxODBC. Here is an echo of my interactive session; > > >>>>from mx import ODBC >>>>from mx import DateTime >>>>db=ODBC.Windows.connect('Wine') >>>>cursor=db.cursor() >>>>myDate=DateTime.DateFrom('31-DEC-2002') >>>>stmt = "SELECT share_number ,datediff(Month, date_of_election, ?) FROM member_details" >>>>cursor.execute(stmt, (myDate,)) > > ceback (most recent call last): > File "", line 1, in ? > ProgrammingError: ('37000', 0, '[Microsoft][ODBC SQL Server Driver]Syntax error or access violation', 4498) Could be that the T-SQL function is generating output using PRINT or that it uses RAISEERROR to report an error with the parameters or values. Also see: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnodbc/html/odbcsql.asp Another possibility is that the ODBC driver for SQL Server does not support the syntax you are using or that bound parameters are not allowed at that place in the SQL. I'd simply add the date verbatim: stmt = "SELECT share_number ,datediff(Month, date_of_election, %s) FROM member_details" % \ myDateTime.date -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Mar 10 2003) >>> Python/Zope Products & Consulting ... http://www.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ Python UK 2003, Oxford: 22 days left EuroPython 2003, Charleroi, Belgium: 106 days left From henrik.ekelund@vpd.se Mon Mar 10 17:20:18 2003 From: henrik.ekelund@vpd.se (Henrik Ekelund) Date: Mon, 10 Mar 2003 18:20:18 +0100 Subject: [DB-SIG] ODBC parameters and T-SQL functions Message-ID: I tried the statement using adodbapi and the Microsoft OLE-DB Driver and got the same error, so it probably is not ODBC related. The error code in OLE-DB is 80004005, so you can try to search for that. You can take a look at http://www.aspfaq.com/show.asp?id=2009 /Henrik Ekelund > -----Original Message----- > From: Andy Todd [mailto:andy47@halfcooked.com] > Sent: den 10 mars 2003 17:47 > To: db-sig > Subject: [DB-SIG] ODBC parameters and T-SQL functions > > > Afternoon all. I am writing a script in Python 2.2 using > mxODBC talking to SQL Server 2000. > > I'm getting errors when I pass an mxDateTime object as a > parameter to a SQL statement. But its only when the parameter > is subsequently used in a T-SQL function, specifically > DATEDIFF. Elsewhere (for instance in a where clause) I can > pass this same value in without a hitch. > > Has anyone seen this before? The reason I ask is because this > works with the win32all odbc package but not with mxODBC. > Here is an echo of my interactive session; > > >>> from mx import ODBC > >>> from mx import DateTime > >>> db=ODBC.Windows.connect('Wine') > >>> cursor=db.cursor() > >>> myDate=DateTime.DateFrom('31-DEC-2002') > >>> stmt = "SELECT share_number ,datediff(Month, > date_of_election, ?) FROM member_details" > >>> cursor.execute(stmt, (myDate,)) > ceback (most recent call last): > File "", line 1, in ? > ProgrammingError: ('37000', 0, '[Microsoft][ODBC SQL Server > Driver]Syntax error or access violation', 4498) > >>> > >>> db.close() > >>> import odbc > >>> db=odbc.odbc('Wine') > >>> cursor=db.cursor() > >>> cursor.execute(stmt, (myDate,)) > 0 > >>> results=cursor.fetchone() > >>> results > (1, 338) > >>> > > What am I doing wrong? > > Regards, > Andy > -- > -------------------------------------------------------------- > ------------------ > From the desk of Andrew J Todd esq - http://www.halfcooked.com/ > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig > ********************************************************************** This email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ********************************************************************** From mal@lemburg.com Mon Mar 10 18:54:11 2003 From: mal@lemburg.com (M.-A. Lemburg) Date: Mon, 10 Mar 2003 19:54:11 +0100 Subject: [DB-SIG] ODBC parameters and T-SQL functions In-Reply-To: References: Message-ID: <3E6CDF53.3000103@lemburg.com> Henrik Ekelund wrote: > I tried the statement using adodbapi and the Microsoft OLE-DB Driver and got > the same error, > so it probably is not ODBC related. Well, I guess that the ADO or OLE drivers use the ODBC driver under the covers (the error messages hint at that), so it is related to the MS SQL ODBC driver. BTW, the reason you don't get the error using the simplistic odbc module is that the latter binds *all* parameters as strings and doesn't use the SQLDescribeParam() API which triggers the error at all. I wonder whether passing a string instead of a DateTime value will give you the same error message ?! > The error code in OLE-DB is 80004005, so you can try to search for that. > > You can take a look at http://www.aspfaq.com/show.asp?id=2009 > > /Henrik Ekelund > > > >>-----Original Message----- >>From: Andy Todd [mailto:andy47@halfcooked.com] >>Sent: den 10 mars 2003 17:47 >>To: db-sig >>Subject: [DB-SIG] ODBC parameters and T-SQL functions >> >> >>Afternoon all. I am writing a script in Python 2.2 using >>mxODBC talking to SQL Server 2000. >> >>I'm getting errors when I pass an mxDateTime object as a >>parameter to a SQL statement. But its only when the parameter >>is subsequently used in a T-SQL function, specifically >>DATEDIFF. Elsewhere (for instance in a where clause) I can >>pass this same value in without a hitch. >> >>Has anyone seen this before? The reason I ask is because this >>works with the win32all odbc package but not with mxODBC. >>Here is an echo of my interactive session; >> >> >>>>>from mx import ODBC >>>>>from mx import DateTime >>>>>db=ODBC.Windows.connect('Wine') >>>>>cursor=db.cursor() >>>>>myDate=DateTime.DateFrom('31-DEC-2002') >>>>>stmt = "SELECT share_number ,datediff(Month, >> >>date_of_election, ?) FROM member_details" >> >>>>>cursor.execute(stmt, (myDate,)) >> >>ceback (most recent call last): >> File "", line 1, in ? >>ProgrammingError: ('37000', 0, '[Microsoft][ODBC SQL Server >>Driver]Syntax error or access violation', 4498) >> >>>>>db.close() >>>>>import odbc >>>>>db=odbc.odbc('Wine') >>>>>cursor=db.cursor() >>>>>cursor.execute(stmt, (myDate,)) >> >>0 >> >>>>>results=cursor.fetchone() >>>>>results >> >>(1, 338) >> >>What am I doing wrong? >> >>Regards, >>Andy >>-- >>-------------------------------------------------------------- >>------------------ >>From the desk of Andrew J Todd esq - http://www.halfcooked.com/ >> >>_______________________________________________ >>DB-SIG maillist - DB-SIG@python.org >>http://mail.python.org/mailman/listinfo/db-sig >> > > > > ********************************************************************** > This email message has been swept by > MIMEsweeper for the presence of computer viruses. > > www.mimesweeper.com > ********************************************************************** > > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Mar 10 2003) >>> Python/Zope Products & Consulting ... http://www.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ Python UK 2003, Oxford: 22 days left EuroPython 2003, Charleroi, Belgium: 106 days left From msanchez@grupoburke.com Mon Mar 10 20:25:43 2003 From: msanchez@grupoburke.com (Marcos =?ISO-8859-1?Q?S=E1nchez?= Provencio) Date: 10 Mar 2003 21:25:43 +0100 Subject: [DB-SIG] Webware and Oracle/high load Message-ID: <1047327942.1546.3.camel@renata.macondo.pri> I am setting up a high load web app with webware using DCOracle2, but seem to get strange dead times. Would cxOracle or SQLRelay behave better for many (100-200 threads)? Any caveats about using DCOracle2 with this number of threads? The docs say I can share a connection among threads, but do I get separate trans per cursor? Thank you -- Marcos Sánchez Provencio www.burke.es From matt@zope.com Mon Mar 10 20:43:39 2003 From: matt@zope.com (Matthew T. Kromer) Date: Mon, 10 Mar 2003 15:43:39 -0500 Subject: [DB-SIG] Webware and Oracle/high load In-Reply-To: <1047327942.1546.3.camel@renata.macondo.pri> References: <1047327942.1546.3.camel@renata.macondo.pri> Message-ID: <3E6CF8FB.7010006@zope.com> Marcos S=E1nchez Provencio wrote: >I am setting up a high load web app with webware using DCOracle2, but >seem to get strange dead times. Would cxOracle or SQLRelay behave better >for many (100-200 threads)? Any caveats about using DCOracle2 with this >number of threads? The docs say I can share a connection among threads, >but do I get separate trans per cursor? > >Thank you > =20 > DCOracle2 transactions are maintained at the connection rather than the=20 cursor layer. Commits or rollbacks happen on the connection, so any=20 cursors created by that connection will be simultaneously affected. It is not designed to use Oracle connection pooling, although that is a=20 feature that could be added. Similarly, it is not intended to provide=20 per-cursor transaction handling. If you're getting dead times and you think DCOracle2 may be at fault,=20 you can try enabling Oracle event tracing by doing something like: export DCO2TRACELOG=3Ddco2.tracelog export DCO2TRACEFLAGS=3D47 (47 =3D 0x2f =3D tracing of thread switches, oracle calls, oracle returns= ,=20 and oracle errors) Each entry in the dco2.tracelog will begin with a timestamp -- so you=20 can use that to look for long waits in between codes 33 (oracle call)=20 and 34 (oracle return). From anthony@computronix.com Mon Mar 10 23:31:48 2003 From: anthony@computronix.com (Anthony Tuininga) Date: 10 Mar 2003 16:31:48 -0700 Subject: [DB-SIG] cx_Oracle 3.0 Message-ID: <1047339114.1610.63.camel@chl0151.edmonton.computronix.com> What is cx_Oracle? cx_Oracle is a Python extension module that allows access to Oracle and conforms to the Python database API 2.0 specifications with a few exceptions. Where do I get it? http://computronix.com/utilities What's new? 1) Removed support for connection to Oracle7 databases; it is entirely possible that it will still work but I no longer have any way of testing and Oracle has dropped any meaningful support for Oracle7 anyway 2) Fetching of strings is now done with predefined memory areas rather than dynamic memory areas; dynamic fetching of strings was causing problems with Oracle 9i in some instances and databases using a different character set other than US ASCII 3) Fixed bug where segfault would occur if the '/' character preceded the '@' character in a connect string 4) Added two new cursor methods var() and arrayvar() in order to eliminate the need for setinputsizes() when defining PL/SQL arrays and as a generic method of acquiring bind variables directly when needed 5) Fixed support for binding cursors and added support for fetching cursors (these are known as ref cursors in PL/SQL) 6) Eliminated discrepancy between the array size used internally and the array size specified by the interface user; this was done earlier to avoid bus errors on 64-bit platforms but another way has been found to get around that issue and a number of people were getting confused because of the discrepancy 7) Added support for the attribute "connection" on cursors, an optional DB API extension 8) Added support for passing a dictionary as the second parameter for the cursor.execute() method in order to comply with the DB API more closely; the method of passing parameters with keyword arguments is still supported and is in fact preferred 9) Added support for the attribute "statement" on cursors which is a reference to the last SQL statement prepared or executed 10) Added support for passing any sequence to callproc() rather than just lists as before 11) Fixed bug where segfault would occur if the array size was changed after the cursor was executed but before it was fetched 12) Ignore array size when performing executemany() and use the length of the list of arguments instead 13) Rollback when connection is closed or destroyed to follow DB API rather than use the Oracle default (which is commit) 14) Added check for array size too large causing an integer overflow 15) Added support for iterators for Python 2.2 and above 16) Added test suite based on PyUnitTest 17) Added documentation in HTML format similar to the documentation for the core Python library -- Anthony Tuininga anthony@computronix.com Computronix Distinctive Software. Real People. Suite 200, 10216 - 124 Street NW Edmonton, AB, Canada T5N 4A3 Phone: (780) 454-3700 Fax: (780) 454-3838 http://www.computronix.com From grg@itesm.mx Tue Mar 11 06:06:14 2003 From: grg@itesm.mx (Gerardo Rodriguez Gutierrez) Date: Mon, 10 Mar 2003 23:06:14 -0700 Subject: [DB-SIG] alo Message-ID: Do you have code example for basing me? I need to connect to MySQL and display it into a html table by colums and rows. Thank you. From wilk-ml@flibuste.net Tue Mar 11 09:44:48 2003 From: wilk-ml@flibuste.net (William Dode) Date: 11 Mar 2003 10:44:48 +0100 Subject: [DB-SIG] alo In-Reply-To: References: Message-ID: <87wuj65jan.fsf@flibuste.net> "Gerardo Rodriguez Gutierrez" writes: > Do you have code example for basing me? I need to connect to MySQL and > display it into a html table by colums and rows. import MySQLdb db=3DMySQLdb.connect(db=3D"cci",host=3D"localhost",user=3D"me",passwd=3D"") cursor=3Ddb.cursor() cursor.execute("select id_adherent,nom from cci_adherent") print "" for row in cursor.fetchall(): print ""%(row[0],row[1]) print "
%s%s
" --=20 William Dod=E9 - http://flibuste.net From andy47@halfcooked.com Tue Mar 11 09:53:28 2003 From: andy47@halfcooked.com (Andy Todd) Date: Tue, 11 Mar 2003 09:53:28 +0000 Subject: [DB-SIG] ODBC parameters and T-SQL functions In-Reply-To: <3E6CC79E.8050607@lemburg.com> References: <20030310164656.GA2436@LATITUDE6> <3E6CC79E.8050607@lemburg.com> Message-ID: <20030311095327.GA692@LATITUDE6> On Mon, Mar 10, 2003 at 06:13:02PM +0100, M.-A. Lemburg wrote: > Andy Todd wrote: > >Afternoon all. I am writing a script in Python 2.2 using mxODBC talking to > >SQL Server 2000. > > > >I'm getting errors when I pass an mxDateTime object as a parameter to a > >SQL statement. But its only when the parameter is subsequently used in a > >T-SQL function, specifically DATEDIFF. Elsewhere (for instance in a where > >clause) I can pass this same value in without a hitch. > > > >Has anyone seen this before? The reason I ask is because this works with > >the win32all odbc package but not with mxODBC. Here is an echo of my > >interactive session; > > > > > >>>>from mx import ODBC > >>>>from mx import DateTime > >>>>db=ODBC.Windows.connect('Wine') > >>>>cursor=db.cursor() > >>>>myDate=DateTime.DateFrom('31-DEC-2002') > >>>>stmt = "SELECT share_number ,datediff(Month, date_of_election, ?) FROM > >>>>member_details" > >>>>cursor.execute(stmt, (myDate,)) > > > >ceback (most recent call last): > > File "", line 1, in ? > >ProgrammingError: ('37000', 0, '[Microsoft][ODBC SQL Server Driver]Syntax > >error or access violation', 4498) > > Could be that the T-SQL function is generating output using PRINT > or that it uses RAISEERROR to report an error with the parameters > or values. > > Also see: > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnodbc/html/odbcsql.asp > > Another possibility is that the ODBC driver for SQL Server > does not support the syntax you are using or that bound parameters > are not allowed at that place in the SQL. > > I'd simply add the date verbatim: > > stmt = "SELECT share_number ,datediff(Month, date_of_election, %s) FROM > member_details" % \ > myDateTime.date > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Software directly from the Source (#1, Mar 10 2003) > >>> Python/Zope Products & Consulting ... http://www.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ > ________________________________________________________________________ > Python UK 2003, Oxford: 22 days left > EuroPython 2003, Charleroi, Belgium: 106 days left > Thanks Marc-Andre, As usual your help is timely and accurate. Passing the value as a string solves my problem. If I get a moment or two spare I will investigate some of the other 'standard' date functions (dateadd, datepart, etc.) and see if they exhibit the same behaviour. Regards, Andy -- -------------------------------------------------------------------------------- >From the desk of Andrew J Todd esq - http://www.halfcooked.com/ From mal@lemburg.com Tue Mar 11 19:40:11 2003 From: mal@lemburg.com (M.-A. Lemburg) Date: Tue, 11 Mar 2003 20:40:11 +0100 Subject: [DB-SIG] DB API compliance test--clarification In-Reply-To: <1047234366.12629.14.camel@chef.neosouth.net> References: <20030217010939.87720.qmail@web11002.mail.yahoo.com> <3E5096A7.7000604@lemburg.com> <1047234366.12629.14.camel@chef.neosouth.net> Message-ID: <3E6E3B9B.6020408@lemburg.com> Andy Dustman wrote: > On Mon, 2003-02-17 at 03:00, M.-A. Lemburg wrote: > >>David Rushby wrote: >> >>>Code snippet from Stuart's DB API compliance suite: >>> >>>----------- >>>def test_commit(self): >>> con = self._connect() >>> try: >>> # Commit must work, even if it doesn't do anything >>> con.commit() >>> finally: >>> con.close() >>>----------- >>> >>>Is it reasonable to commit a transaction without ever having created >>>it? >> >>You create the transaction implicitly by connecting to the database. > > Transactions are implicitly created when you execute a statement that > changes the state of the database (INSERT, UPDATE, DELETE), or retrieves > data (SELECT). Note that in at least some cases (MySQL), CREATE and DROP > TABLE are NOT transactional. Then again, calling MySQL a transactional database is a bit far- fetched ;-) It is true, however, that some databases have non-transactional statements. Dropping a table and then expecting the database to undo this with a .rollback() is something you shouldn't really try in real life :-) > Some examples of this: > ... Ok, so the above check should execute at least one statement on the connection, e.g. do a select. That should cover all definitions. -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Mar 11 2003) >>> Python/Zope Products & Consulting ... http://www.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ Python UK 2003, Oxford: 21 days left EuroPython 2003, Charleroi, Belgium: 105 days left From andy@dustman.net Tue Mar 11 21:53:53 2003 From: andy@dustman.net (Andy Dustman) Date: 11 Mar 2003 16:53:53 -0500 Subject: [DB-SIG] DB API compliance test--clarification In-Reply-To: <3E6E3B9B.6020408@lemburg.com> References: <20030217010939.87720.qmail@web11002.mail.yahoo.com> <3E5096A7.7000604@lemburg.com> <1047234366.12629.14.camel@chef.neosouth.net> <3E6E3B9B.6020408@lemburg.com> Message-ID: <1047419633.20941.1.camel@localhost> On Tue, 2003-03-11 at 14:40, M.-A. Lemburg wrote: > Then again, calling MySQL a transactional database is a bit far- > fetched ;-) Not at all. http://www.mysql.com/doc/en/COMMIT.html -- Andy Dustman @ .net Freedom isn't free; it's sold to the highest bidder. From msanchez@grupoburke.com Wed Mar 12 13:31:55 2003 From: msanchez@grupoburke.com (Marcos) Date: 12 Mar 2003 14:31:55 +0100 Subject: [DB-SIG] Webware and Oracle/high load In-Reply-To: <1047327942.1546.3.camel@renata.macondo.pri> References: <1047327942.1546.3.camel@renata.macondo.pri> Message-ID: <1047475915.2660.7.camel@brooke.mju.es> We are testing cx_Oracle ant it seems to behave much better with this number of threads. It is finally working (I hate changing) on the same machine the Oracle+Pound+Apache is. Now we are getting 8 pages/minute/Webware instance (each Webware uses up one CPU). We are now micro-optimizing. cx_Oracle has dumped core a couple of times. It is a relative problem, since Webware restarts in less than 4 seconds, but it always troubles me... With both modules, Webware seems to stop responding to ^C whenever an error happens in the oracle level; we have to -KILL it. :-\ I'll review whether I am closing cursors in case of an error. ----- ref Webware: An application server in pure Python http://webware.sf.net/ ---- El lun, 10-03-2003 a las 21:25, Marcos S=E1nchez Provencio escribi=F3: > I am setting up a high load web app with webware using DCOracle2, but > seem to get strange dead times. Would cxOracle or SQLRelay behave better > for many (100-200 threads)? Any caveats about using DCOracle2 with this > number of threads? The docs say I can share a connection among threads, > but do I get separate trans per cursor? >=20 > Thank you > --=20 > Marcos S=E1nchez Provencio > www.burke.es >=20 >=20 > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig From mal@lemburg.com Wed Mar 12 12:50:09 2003 From: mal@lemburg.com (M.-A. Lemburg) Date: Wed, 12 Mar 2003 13:50:09 +0100 Subject: [DB-SIG] Webware and Oracle/high load In-Reply-To: <1047475915.2660.7.camel@brooke.mju.es> References: <1047327942.1546.3.camel@renata.macondo.pri> <1047475915.2660.7.camel@brooke.mju.es> Message-ID: <3E6F2D01.9030806@lemburg.com> Marcos wrote: > We are testing cx_Oracle ant it seems to behave much better with this > number of threads. It is finally working (I hate changing) on the same > machine the Oracle+Pound+Apache is. Now we are getting 8 > pages/minute/Webware instance (each Webware uses up one CPU). We are no= w ^^^^^^ not per second ? Is WebWare really *that* slow ? > micro-optimizing. >=20 > cx_Oracle has dumped core a couple of times. It is a relative problem, > since Webware restarts in less than 4 seconds, but it always troubles > me... >=20 > With both modules, Webware seems to stop responding to ^C whenever an > error happens in the oracle level; we have to -KILL it. :-\ I'll review > whether I am closing cursors in case of an error. > ----- > ref Webware: An application server in pure Python http://webware.sf.net= / > ---- > El lun, 10-03-2003 a las 21:25, Marcos S=E1nchez Provencio escribi=F3: >=20 >>I am setting up a high load web app with webware using DCOracle2, but >>seem to get strange dead times. Would cxOracle or SQLRelay behave bette= r >>for many (100-200 threads)? Any caveats about using DCOracle2 with this >>number of threads? The docs say I can share a connection among threads, >>but do I get separate trans per cursor? >> >>Thank you >>--=20 >>Marcos S=E1nchez Provencio >>www.burke.es >> >> >>_______________________________________________ >>DB-SIG maillist - DB-SIG@python.org >>http://mail.python.org/mailman/listinfo/db-sig >=20 >=20 >=20 >=20 > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig --=20 Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Mar 12 2003) >>> Python/Zope Products & Consulting ... http://www.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ Python UK 2003, Oxford: 20 days left EuroPython 2003, Charleroi, Belgium: 104 days left From msanchez@grupoburke.com Wed Mar 12 14:06:58 2003 From: msanchez@grupoburke.com (Marcos) Date: 12 Mar 2003 15:06:58 +0100 Subject: [DB-SIG] Webware and Oracle/high load In-Reply-To: <3E6F2D01.9030806@lemburg.com> References: <1047327942.1546.3.camel@renata.macondo.pri> <1047475915.2660.7.camel@brooke.mju.es> <3E6F2D01.9030806@lemburg.com> Message-ID: <1047478018.2868.3.camel@brooke.mju.es> The right figure is 8/s (thank the proofreader). I think webware is doing alright for this overloaded machine (SunOS, 4cpu, 3GB RAM, not dedicated), but I don't have any experience in benchmarking; I am usually happy when things finally just _work_. El mi=E9, 12-03-2003 a las 13:50, M.-A. Lemburg escribi=F3: > Marcos wrote: > > We are testing cx_Oracle ant it seems to behave much better with this > > number of threads. It is finally working (I hate changing) on the same > > machine the Oracle+Pound+Apache is. Now we are getting 8 > > pages/minute/Webware instance (each Webware uses up one CPU). We are no= w >=20 > ^^^^^^ not per second ? Is WebWare really *that* slow ? >=20 > > micro-optimizing. > >=20 > > cx_Oracle has dumped core a couple of times. It is a relative problem, > > since Webware restarts in less than 4 seconds, but it always troubles > > me... > >=20 > > With both modules, Webware seems to stop responding to ^C whenever an > > error happens in the oracle level; we have to -KILL it. :-\ I'll review > > whether I am closing cursors in case of an error. > > ----- > > ref Webware: An application server in pure Python http://webware.sf.net= / > > ---- > > El lun, 10-03-2003 a las 21:25, Marcos S=E1nchez Provencio escribi=F3: > >=20 > >>I am setting up a high load web app with webware using DCOracle2, but > >>seem to get strange dead times. Would cxOracle or SQLRelay behave bette= r > >>for many (100-200 threads)? Any caveats about using DCOracle2 with this > >>number of threads? The docs say I can share a connection among threads, > >>but do I get separate trans per cursor? > >> > >>Thank you > >>--=20 > >>Marcos S=E1nchez Provencio > >>www.burke.es > >> > >> > >>_______________________________________________ > >>DB-SIG maillist - DB-SIG@python.org > >>http://mail.python.org/mailman/listinfo/db-sig > >=20 > >=20 > >=20 > >=20 > > _______________________________________________ > > DB-SIG maillist - DB-SIG@python.org > > http://mail.python.org/mailman/listinfo/db-sig >=20 > --=20 > Marc-Andre Lemburg > eGenix.com >=20 > Professional Python Software directly from the Source (#1, Mar 12 2003) > >>> Python/Zope Products & Consulting ... http://www.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ > ________________________________________________________________________ > Python UK 2003, Oxford: 20 days left > EuroPython 2003, Charleroi, Belgium: 104 days left >=20 >=20 > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig From JKANCIAN@arinc.com Wed Mar 12 22:18:32 2003 From: JKANCIAN@arinc.com (Kancianic, Jennifer C. (JKANCIAN)) Date: Wed, 12 Mar 2003 17:18:32 -0500 Subject: [DB-SIG] Re: problems with DCOracle2 running on solaris 8 (oracle 8.1.6) Message-ID: <0734A2B8CF21D711B98B00080224869C1C5338@exanpmb3.arinc.com> All, We were scrambling to find a solution to this same issue. We are using DCOracle2 1.2 on Linux 6.2, Oracle 8.1.7. We finally tried setting the cursor.setPrefetch(None) after we created the cursor object for the SQL statement that was having trouble. This solved the problem. Not totally sure why, but we are glad it's working again. Thanks, Jenny ---------------------------------------------------------------------------- ------------------------------------ Matt Kromer wrote: I'm jumping into this thread a bit late but here goes. I've had reports from a few sources that large queries would occasionally return NULL values instead of the columns they should when used on Linux rather than Solaris. There may be a bizarre Oracle problem (which would be a first, wouldn't it?!) or a problem with the DCOracle2 code. The only way for me to determine that for sure is to take a look at the trace logs DCOracle2 can generate. You can either export DCO2TRACELOG=filename which turns on continuous logging to a file or export DCO2TRACEFLAGS=255 which enables tracing but doesn't record to a file -- you can then do DCOracle2.traceback(format=1) to format the trace buffer. The key thing I want to look at is whether or not there is a NULL answer being returned from the C layer, or if it's coming in from someplace else. Andy Todd wrote: >On Tue, Jan 28, 2003 at 12:15:58PM +0100, Molina Carron wrote: > > >>Right, this should help. >> >>My data (just a row): >>CD_CAMINO 2 >>CD_TRAMITE Registro >>CD_OPERACION 13800 >>CONDICION ANIO_EXP_FISCALIA & '' # '' >>CD_ACCION X>X >>PARAMETRO1 ANIO_EXP_FISCALIA >>PARAMETRO2 x >>PARAMETRO3 >>PARAMETRO4 >>-------------------------------------------------------------------------- -- >>---------------------------- >>My problem: >>*I get different values for the field Parametro2 depending on how i access >>to it: if my query is: >> select * from rm_tra_acciones where cd_tramite=:p1 and cd_camino=:p2, >>(2, 'Registro',) >>it returns a lot of rows, and, when i move to the one above, and ask for my >>field Parametro2 it returns None (wrong!) >> >>*On the other hand, if my query is: >>select * from rm_tra_acciones where cd_tramite=:p1 and cd_camino=:p2 and >>cd_operacion=:p3, >>(2, 'Registro',13800,) >>and ask my field, it returns x (correct!) >> >>*sqlplus works fine >> >>*No error messagges are returned >> >>*I get data from every query, but not every data is good >>-------------------------------------------------------------------------- -- >>---------------------- >> >>My python code: >>def test(): >> sql=[''' select * from rm_tra_acciones >> where cd_tramite=:p1 and cd_camino=:p2 >> ''', >> ''' select * from rm_tra_acciones >> where cd_tramite=:p1 and cd_camino=:p2 and cd_operacion=:p3 >> '''] >> params=[('Registro', 2,),('Registro', 2,13800,)] >> >> import DCOracle2 >> cadenaConn='%s/%s@%s'% ('menores','menores','datos10k') >> conn=DCOracle2.connect(cadenaConn) >> >> print 'test1' >> cur=conn.cursor() >> cur.execute(sql[0],params[0]) >> >> rs = cur.fetchall() >> >> print rs[41] ##the row >> >> print 'test2' >> cur=conn.cursor() >> cur.execute(sql[1],params[1]) >> print cur.fetchall()[0] >>-------------------------------------------------------------------------- -- >>-------------------------------- >>The results: >> >> >>>python -u etcPythonOracle.py >>> >>> >>test1 >>[2L, 'Registro', 13800L, "ANIO_EXP_FISCALIA & '' # ''", 'X>X', >>'ANIO_EXP_FISCALIA', None, None, None] >>test2 >>[2L, 'Registro', 13800L, "ANIO_EXP_FISCALIA & '' # ''", 'X>X', >>'ANIO_EXP_FISCALIA', 'x', None, None] >> >> >>>Exit code: 0 >>> >>> >>Thanks >> >> >> >> > >My first impression is that this is a data issue and nothing to do with the db module or database. Are you sure that both of your queries are returning the same row? It looks like they are not. > >In test1 you are only restricting by cd_tramite and cd_camino but in test2 you add the cd_operacion column to the where clause. What happens if you include the ROWID pseudo column in your results sets, are they the same? > >The only other thing I can think of, and it is a long shot, is that you are not comparing the same columns. Whilst performing a 'SELECT *' is more than likely going to return the same columns in the same order each time you execute a query there is absolutely no guarantee that this is true. I would change your select clauses to ONLY return the columns of interest in this particular case and eliminate this possibility even though it is fairly unlikely to be the cause of your distress. > >Regards, >Andy > > From msanchez@grupoburke.com Thu Mar 13 10:56:00 2003 From: msanchez@grupoburke.com (Marcos) Date: 13 Mar 2003 11:56:00 +0100 Subject: [DB-SIG] Webware and Oracle/high load In-Reply-To: <1047475915.2660.7.camel@brooke.mju.es> References: <1047327942.1546.3.camel@renata.macondo.pri> <1047475915.2660.7.camel@brooke.mju.es> Message-ID: <1047552960.731.11.camel@brooke.mju.es> Somewhere there seems to deal really badly with bad SQL or closing cursors before fetching all results. What is the proposed method of dealing with bad SQL (besides solving it, of course). Should I try to close the cursor? What is the right way to discard results? I seem to get about the same problems with DCOracle2 and cx_Oracle. Are there any comparisons between them, in terms of functionality, performance, etc.? El mi=E9, 12-03-2003 a las 14:31, Marcos escribi=F3: > We are testing cx_Oracle ant it seems to behave much better with this > number of threads. It is finally working (I hate changing) on the same > machine the Oracle+Pound+Apache is. Now we are getting 8 > pages/minute/Webware instance (each Webware uses up one CPU). We are now > micro-optimizing. >=20 > cx_Oracle has dumped core a couple of times. It is a relative problem, > since Webware restarts in less than 4 seconds, but it always troubles > me... >=20 > With both modules, Webware seems to stop responding to ^C whenever an > error happens in the oracle level; we have to -KILL it. :-\ I'll review > whether I am closing cursors in case of an error. > ----- > ref Webware: An application server in pure Python http://webware.sf.net/ > ---- > El lun, 10-03-2003 a las 21:25, Marcos S=E1nchez Provencio escribi=F3: > > I am setting up a high load web app with webware using DCOracle2, but > > seem to get strange dead times. Would cxOracle or SQLRelay behave bette= r > > for many (100-200 threads)? Any caveats about using DCOracle2 with this > > number of threads? The docs say I can share a connection among threads, > > but do I get separate trans per cursor? > >=20 > > Thank you > > --=20 > > Marcos S=E1nchez Provencio > > www.burke.es > >=20 > >=20 > > _______________________________________________ > > DB-SIG maillist - DB-SIG@python.org > > http://mail.python.org/mailman/listinfo/db-sig >=20 From qual@epost.de Thu Mar 13 17:32:47 2003 From: qual@epost.de (Uwe Hoffmann) Date: Thu, 13 Mar 2003 18:32:47 +0100 Subject: [DB-SIG] Re: problems with DCOracle2 running on solaris 8 (oracle 8.1.6) In-Reply-To: <0734A2B8CF21D711B98B00080224869C1C5338@exanpmb3.arinc.com> References: <0734A2B8CF21D711B98B00080224869C1C5338@exanpmb3.arinc.com> Message-ID: Kancianic, Jennifer C. (JKANCIAN) wrote: > All, > > We were scrambling to find a solution to this same issue. We are using > DCOracle2 1.2 on Linux 6.2, Oracle 8.1.7. > > We finally tried setting the cursor.setPrefetch(None) after we created the > cursor object for the SQL statement that was having trouble. This solved if i see this description maybe the patch http://www.zope.org/Members/matt/dco2/Tracker/61 should be applied not only to oracle 8.0.x but to 8.1.x (9.x) also. regards uwe From ianb@colorstudy.com Thu Mar 13 21:14:32 2003 From: ianb@colorstudy.com (Ian Bicking) Date: 13 Mar 2003 15:14:32 -0600 Subject: [DB-SIG] ANN: SQLObject 0.2.1 Message-ID: <1047590071.4904.125.camel@lothlorien> SQLObject 0.2.1 has been released, fixing a caching bug, adding SQLite support, and optimizing selects. SQLObject is now a SourceForge project, with its own web page, mailing list, and CVS repository. Details at: http://sqlobject.org What is SQLObject? ------------------ SQLObject is an object-relational mapper. It allows you to translate RDBMS table rows into Python objects, and manipulate those objects to transparently manipulate the database. -- Ian Bicking ianb@colorstudy.com http://colorstudy.com 4869 N. Talman Ave., Chicago, IL 60625 / 773-275-7241 "There is no flag large enough to cover the shame of killing innocent people" -- Howard Zinn From jwsacksteder@ramprecision.com Wed Mar 19 14:19:50 2003 From: jwsacksteder@ramprecision.com (jwsacksteder@ramprecision.com) Date: Wed, 19 Mar 2003 09:19:50 -0500 Subject: [DB-SIG] pervasive SQL Message-ID: <71650A6F73F1D411BE8000805F65E3CB3B3186@SRV-03> I would very much like to see a native DBI interface to the PervasiveSQL RDBMS. Assuming full access to needed technical specs, how much work would be involved in in doing something like this? Days? Weeks? Months? I don't suppose someone who thinks that sort of thing is fun would be willing to work on this? From gerhard.haering@opus-gmbh.net Wed Mar 19 15:09:07 2003 From: gerhard.haering@opus-gmbh.net (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Wed, 19 Mar 2003 15:09:07 +0000 (UTC) Subject: [DB-SIG] Re: pervasive SQL References: <71650A6F73F1D411BE8000805F65E3CB3B3186@SRV-03> Message-ID: jwsacksteder@ramprecision.com wrote: > I would very much like to see a native DBI interface to the PervasiveSQL > RDBMS. It looks like you can now use Pervasive SQL via ODBC or Jython/JDBC. I don't see a C, C++ or Ada interface on their homepage, however. Only JDBC and ADO/OLEDB. Without seening a C/C++ (or Ada, or Fortran ;-) interface, the complexity of this task cannot be evaluated. > Assuming full access to needed technical specs, how much work would be > involved in in doing something like this? Days? Weeks? Months? You can expect basic functionality within days, but a fully compliant and stable DB-API interface takes months to build. With being able to commit to this task full-time, you might achieve this goal faster. > I don't suppose someone who thinks that sort of thing is fun would be > willing to work on this? If someone paid me to do it [1], it might be fun enough ;-) -- Gerhard [1] Iff it is possible, for C/C++, I only see a BTrieve API, no SQL API. But then, it's only 5 minutes since I first heard about this product ... From mal@lemburg.com Wed Mar 19 20:34:49 2003 From: mal@lemburg.com (M.-A. Lemburg) Date: Wed, 19 Mar 2003 21:34:49 +0100 Subject: [DB-SIG] pervasive SQL In-Reply-To: <71650A6F73F1D411BE8000805F65E3CB3B3186@SRV-03> References: <71650A6F73F1D411BE8000805F65E3CB3B3186@SRV-03> Message-ID: <3E78D469.7050604@lemburg.com> jwsacksteder@ramprecision.com wrote: > I would very much like to see a native DBI interface to the PervasiveSQL > RDBMS. Assuming full access to needed technical specs, how much work would > be involved in in doing something like this? Days? Weeks? Months? You could use mxODBC to access that database, I suppose. If it doesn't work out of the box, I'm sure we can find a way to help you :-) Writing a "native" interface is usually in the range of months rather than days or weeks -- starting out is fast, but it takes a long time to get everything working properly. -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Mar 19 2003) >>> Python/Zope Products & Consulting ... http://www.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ Python UK 2003, Oxford: 13 days left EuroPython 2003, Charleroi, Belgium: 97 days left From rmangaliag@slu.edu.ph Fri Mar 21 06:12:48 2003 From: rmangaliag@slu.edu.ph (ali) Date: Fri, 21 Mar 2003 14:12:48 +0800 Subject: [DB-SIG] kinterbasdb vs. anything mysql... Message-ID: <001601c2ef70$e65e23a0$3f1ea8c0@slu.edu.ph> This is a multi-part message in MIME format. ------=_NextPart_000_0013_01C2EFB3.F3D98AE0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable i am currently using kinterbasdb and of course, firebird... and kinter = definitely makes databasing simpler... my question: is there a mysql counterpart for kinterbasdb/firebird??? ------=_NextPart_000_0013_01C2EFB3.F3D98AE0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
i am currently using kinterbasdb and of = course,=20 firebird... and kinter definitely makes databasing = simpler...
 
my question:
 
is there a mysql counterpart for=20 kinterbasdb/firebird???
------=_NextPart_000_0013_01C2EFB3.F3D98AE0-- From gh@ghaering.de Fri Mar 21 09:57:06 2003 From: gh@ghaering.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Fri, 21 Mar 2003 09:57:06 +0000 (UTC) Subject: [DB-SIG] Re: kinterbasdb vs. anything mysql... References: <001601c2ef70$e65e23a0$3f1ea8c0@slu.edu.ph> Message-ID: ali wrote: > is there a mysql counterpart for kinterbasdb/firebird??? Yes. http://www.google.com/search?q=mysql+python or http://www.python.org/topics/database/modules.html http://sourceforge.net/projects/mysql-python -- Gerhard From richard@insane.bug-e.net Sun Mar 23 09:56:37 2003 From: richard@insane.bug-e.net (Richard) Date: Sun, 23 Mar 2003 11:56:37 +0200 Subject: [DB-SIG] Getting a custom build of python to talk to MySQL Message-ID: <000001c2f122$7e9c74c0$0800a8c0@thumper> Hi List This is my first post, so go easy please :) I am an engineer, and not a programmer. I have never quite got my brain around OO, although I am quite happy to program in Fortran (shock, horror!) and Perl. I have been using Python for about 2 years. Thus treat me as completely clueless. What I want to do: I have a scientific application that includes python as an embedded macro language. The entire user interface is also customisable in python (very cool btw). This app runs on Win32, linux and up to multi-proccessor, million $ hardware, but I am running it on win32. I want to get this app's python to talk to a database. I have access to MySQL on a freebsd machine. I have tried to get MySQL-python 0.9.1 and 0.9.2 to talk to the embedded python (is this the correct term?) but it will not work. This is because the python is a custom build. As follows: Python 2.0 (#0, Jul 1 2002, 10:16:04) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. >>> import MySQLdb Fatal Python error: Interpreter not initialized (version mismatch?) This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. *sigh* So, I guess that the answer is to do a custom build of MySQLdb, but I do not have access to a C compiler etc etc. Any ideas how to get it to work ? Worst case, someone shows me how to embed Perl inline into Python, and I do the DB queries in Perl. *yuck* :) Best regards Richard From lists@ghaering.de Sun Mar 23 21:45:48 2003 From: lists@ghaering.de (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Sun, 23 Mar 2003 22:45:48 +0100 Subject: [DB-SIG] Getting a custom build of python to talk to MySQL In-Reply-To: <000001c2f122$7e9c74c0$0800a8c0@thumper> References: <000001c2f122$7e9c74c0$0800a8c0@thumper> Message-ID: <20030323214548.GA1461@mephisto.ghaering.test> * Richard [2003-03-23 11:56 +0200]: > [...] What I want to do: > I have a scientific application that includes python as an embedded > macro language. The entire user interface is also customisable in > python (very cool btw). This app runs on Win32, linux and up to > multi-proccessor, million $ hardware, but I am running it on win32. > > I want to get this app's python to talk to a database. I have > access to MySQL on a freebsd machine. > > I have tried to get MySQL-python 0.9.1 and 0.9.2 to talk to the > embedded python (is this the correct term?) but it will not work. > > This is because the python is a custom build. As follows: > > Python 2.0 (#0, Jul 1 2002, 10:16:04) [MSC 32 bit (Intel)] on win32 > Type "copyright", "credits" or "license" for more information. > >>> import MySQLdb > Fatal Python error: Interpreter not initialized (version mismatch?) Which MySQLdb have you installed? Is it this download: MySQL-python-0.9.1.win32-py2.0.exe ? Note that Python extensions are not necessarily binary compatible across Python major.minor.micro versions where anything except micro differs. So, don't use any versions of MySQLdb built for Pyhton 2.1 or 2.2. Gerhard -- mail: gh@ghaering.de web: http://ghaering.de/ From richard@insane.bug-e.net Sun Mar 23 22:04:17 2003 From: richard@insane.bug-e.net (Richard) Date: Mon, 24 Mar 2003 00:04:17 +0200 Subject: [DB-SIG] Getting a custom build of python to talk to MySQL In-Reply-To: <20030323214548.GA1461@mephisto.ghaering.test> Message-ID: <000001c2f188$260d7e60$0800a8c0@thumper> Hi Gerhard, List > Which MySQLdb have you installed? Is it this download: > > MySQL-python-0.9.1.win32-py2.0.exe > > ? Note that Python extensions are not necessarily binary > compatible across Python major.minor.micro versions where > anything except micro differs. > > So, don't use any versions of MySQLdb built for Pyhton 2.1 or 2.2. Tried: http://umn.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-0.9. 1.win32-py2.0.exe And numerous mirrors with the same filename. It seems 0.9.2 has not been built as a windows exe for python 2.0, since I could only find 2.1 and 2.2 versions. No matter.... still no luck. -Bye -Richard From magnus@thinkware.se Mon Mar 24 11:47:58 2003 From: magnus@thinkware.se (Magnus Lycka) Date: Mon, 24 Mar 2003 12:47:58 +0100 Subject: [DB-SIG] Re: Getting a custom build of python to talk to MySQL In-Reply-To: <20030323170003.23242.13898.Mailman@mail.python.org> Message-ID: <5.1.0.14.0.20030323234254.0342b190@www.thinkware.se> At Sun, 23 Mar 2003 11:56:37 +0200, Richard wrote: >I have tried to get MySQL-python 0.9.1 and 0.9.2 to talk to the >embedded python (is this the correct term?) but it will not work. > >This is because the python is a custom build. As follows: > >Python 2.0 (#0, Jul 1 2002, 10:16:04) [MSC 32 bit (Intel)] on win32 >Type "copyright", "credits" or "license" for more information. > >>> import MySQLdb >Fatal Python error: Interpreter not initialized (version mismatch?) I'm not sure the problem here is a "custom build" but rather think that you need MySQLdb built for Python 2.0. Compiled python modules are not usable across python versions like 2.0, 2.1, 2.2 (although something built for 2.2.2 should work with 2.2.1 or 2.2.3 though). Did you try: MySQL-python-0.9.1.win32-py2.0.exe ? I can't see a Python 2.0 binary of 0.9.2 for Win32. Note that the "py2.0" part is essential. Can you verify that a version of MySQL-python which is usable from a plain Python 2.0 installation fails like above in your system? -- 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 richard@insane.bug-e.net Mon Mar 24 14:09:00 2003 From: richard@insane.bug-e.net (Richard) Date: Mon, 24 Mar 2003 16:09:00 +0200 Subject: [DB-SIG] Re: Getting a custom build of python to talk to MySQL In-Reply-To: <5.1.0.14.0.20030323234254.0342b190@www.thinkware.se> Message-ID: <000401c2f20e$eaf4c950$0800a8c0@thumper> Hi Magnus, List > Did you try: MySQL-python-0.9.1.win32-py2.0.exe ? I can't see > a Python 2.0 binary of 0.9.2 for Win32. Note that the "py2.0" > part is essential. Yes, I tried MySQL-python-0.9.1.win32-py2.0.exe. It barfs :( > Can you verify that a version of MySQL-python which is usable > from a plain Python 2.0 installation fails like above in your system? It works with python 2.0.1. Just not with my embedded python 2.0 -Bye -Richard From chris@cogdon.org Sat Mar 29 01:38:00 2003 From: chris@cogdon.org (Chris Cogdon) Date: Fri, 28 Mar 2003 17:38:00 -0800 Subject: [DB-SIG] Passing 'pre-quoted' SQL to 'execute'. Message-ID: <13AED4F8-6187-11D7-881B-000393A6D442@cogdon.org> I'm using a particular way of organising my python and SQL that I think's pretty neat, but I'm wondering if I'm not making things too difficult for myself, and there's a 'better way' out there I'm unaware of. I'm using pyPgSQL. The application is a community artwork site, where several thousand artists have uploaded 200,000 images. Firstly, I have a class that handles all my database queries. I've actually separated parts into different modules, and used a module and the 'mix-in' methodology to bring them all together so it's one big interface to the rest of the program. For simplification, I've hidden those details. So, here's part of that class: class VCL_DATABASE: def get_artists ( self, criteria ): cur = self.cursor () try: condition = criteria.make_sql_condition () cur.execute ( "select * from artist where "+condition ) # The cursor is now turned into a list of artists, code omitted for brevity return artists finally: cur.close () That's pretty simple. The interesting part is where the 'criteria' is passed to the 'get_artists' function. There are a few such classes and each can return their SQL conditions however they want. Here's an example: class ARTIST_DISPLAYNAME_CRITERIA ( ARTIST_CRITERIA ): def __init__ ( self, displayname ): self.displayname = displayname def make_sql_condition ( self ): return "displayname="+PgSQL._quote(self.displayname) There are many more like it, and I also have ways to 'join' the criteria together. The resultant conditions can be quote complex, and there's also a way for it to ask the 'select' to join extra tables to get the criteria it needs. (For example, I might want all artist that have new artwork in the last 14 days, which would require a join on several other tables). I've omitted all that code for brevity. So... my questions are these: - I'm piecemealing the SQL together from different sources, meaning I need to quote values using _quote rather then inside the 'execute' function. I don't like the idea of me using a 'underscored' function, but there seems to be no way around it. Is there a better way? (The 'as shipped' pg module has a 'bare' quote function) - Am I causing more work for myself with the method for the condition separate from the execute? Do other people find some way of passing all the necessary values into the 'execute', with all the SQL being generated at the last moment ? - I /believe/ that if 'execute' does not see any list or dictionary following, it does not quote the SQL at all, which is necessary for this method to work. Is my assumption correct? Thanks for your attention! -- ("`-/")_.-'"``-._ Chris Cogdon . . `; -._ )-;-,_`) (v_,)' _ )`-.\ ``-' _.- _..-_/ / ((.' ((,.-' ((,/ fL From mal@lemburg.com Mon Mar 31 08:41:40 2003 From: mal@lemburg.com (M.-A. Lemburg) Date: Mon, 31 Mar 2003 10:41:40 +0200 Subject: [DB-SIG] EuroPython 2003: Call for Papers (Business Track) Message-ID: <3E87FF44.30804@lemburg.com> Hello, now that PyCon is over and people are just getting ready to head off to Python UK, we'd like to reissue our request: Tim Couper and I are looking for talks for the "Python in Business" track at EuroPython 2003, Charleroi. If you have a good idea for a talk, then please submit the talk via the EuroPython talk database interface at: http://www.europython.org/Talks/callFor If you have problems with that form, please write to mal@lemburg.com or tim@2wave.net directly. Speakers will get free entry to the event, but will have to pay for catering. Thanks, -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Mar 31 2003) >>> Python/Zope Products & Consulting ... http://www.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ Python UK 2003, Oxford: 1 day left EuroPython 2003, Charleroi, Belgium: 85 days left