From paul@boddie.net Fri Mar 1 11:56:10 2002 From: paul@boddie.net (paul@boddie.net) Date: 1 Mar 2002 11:56:10 -0000 Subject: [DB-SIG] Re: Probelem with inserting into postgres database using python Message-ID: <20020301115610.14542.qmail@www2.nameplanet.com> Mubaraka Arif wrote: > >> Thanks for providing sample code accessing postgres database thru >> python interface. Earlier , i was using the "pg" module which worked >> fine , but it would not allow cursor handling. But yr approach thru >> "pgdb" interface uses the cursor mechanisms , so I shall include it in >> my development too. I can recommend the pyPgSql module as being easy to install and robust, although I've not used it extensively yet. >> On 2002.02.27 12:31 Kevin Cole wrote: >> > >> > bookstore = pgdb.connect("localhost:boox") # Open the "boox" database >> > newz = bookstore.cursor() # Establish a "cursor" [...] >> > inst = replace(title, "'", "''") # Escape all single quotes >> > insw = replace(author, "'", "''") >> > insk = replace(keywords, "'", "''") >> > insa = replace(abstract, "'", "''") >> > values = (id,yr,issue,page,article,inst,insw,insk,insa,pdf,touched) >> > insert = "insert into newz values >> > (%s,%s,%s,%s,%s,'%s','%s','%s','%s','%s','%s');" >> > newz.execute(insert % (values)) >> > boox.commit() It's one of my favourite topics, but I really must point out that the way the values have been "escaped" and then "merged" with the statement should be avoided - you should use statement parameters (bind variables) instead. For example, with pyPgSQL: # Don't bother escaping single quotes. values = (id,yr,issue,page,article,inst,insw,insk,insa,pdf,touched) # pyPgSQL uses %s as its parameter marker, but this is *not* the # same as "merging" values into the statement. We haven't put quotes # in the statement either because with parameters, they aren't needed. insert = "insert into newz values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" # We aren't using the % operator here - values is another parameter. newz.execute(insert, values) boox.commit() Other database modules/systems use different parameter markers. With Sybase databases and apparently throughout JDBC, one would write the following: insert = "insert into newz values (?,?,?,?,?,?,?,?,?,?,?)" Parameters save you the effort of encoding your data to work with SQL syntax, and consequently close one kind of security hole that apparently exists more frequently than many people might suspect. If your database module doesn't support them, switch to one that does - PostgreSQL offers enough of a choice to make this a non-issue. Paul P.S. Was a unified parameter marker ever proposed for that compatibility layer on top of DB-API? -- Get your firstname@lastname email at http://Nameplanet.com/?su From =?iso-8859-1?Q?Dario_Lopez-K=E4sten?= Sun Mar 3 17:04:46 2002 From: =?iso-8859-1?Q?Dario_Lopez-K=E4sten?= (=?iso-8859-1?Q?Dario_Lopez-K=E4sten?=) Date: Sun, 3 Mar 2002 18:04:46 +0100 Subject: [DB-SIG] Status of gadfly? Message-ID: <006601c1c2d5$857c4120$2135b5d4@ita.chalmers.se> Hello, is anyone aware of the status of Gadfly? What about Gadfly 2? Thanx, /dario - -------------------------------------------------------------------- Dario Lopez-Kästen Systems Developer Chalmers Univ. of Technology dario@ita.chalmers.se ICQ will yield no hits IT Systems & Services From magnus@thinkware.se Sun Mar 3 18:07:15 2002 From: magnus@thinkware.se (Magnus =?iso-8859-1?Q?Lyck=E5?=) Date: Sun, 03 Mar 2002 19:07:15 +0100 Subject: [DB-SIG] Status of gadfly? In-Reply-To: <006601c1c2d5$857c4120$2135b5d4@ita.chalmers.se> Message-ID: <5.1.0.14.0.20020303190103.03798bb0@mail.irrblosset.se> At 18:04 2002-03-03 +0100, Dario Lopez-K=E4sten wrote: >Hello, > >is anyone aware of the status of Gadfly? What about Gadfly 2? The author, Aaron Watters, seems very busy with his Python job at ReportLab (www.reportlab.com) but Gadfly is used in Zope, and works. Perhaps it would be a good idea if the maintenance was officially moved to someone else... I guess you should ask Aaron... --=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 andy47@halfcooked.com Mon Mar 4 09:04:30 2002 From: andy47@halfcooked.com (Andy Todd) Date: Mon, 04 Mar 2002 20:04:30 +1100 Subject: [DB-SIG] Status of gadfly? References: <5.1.0.14.0.20020303190103.03798bb0@mail.irrblosset.se> Message-ID: <3C83389E.9010008@halfcooked.com> Magnus Lyckå wrote: > At 18:04 2002-03-03 +0100, Dario Lopez-Kästen wrote: > >> Hello, >> >> is anyone aware of the status of Gadfly? What about Gadfly 2? > > > The author, Aaron Watters, seems very busy with his Python > job at ReportLab (www.reportlab.com) but Gadfly is used > in Zope, and works. > > Perhaps it would be a good idea if the maintenance was > officially moved to someone else... > > I guess you should ask Aaron... > > I sent an email to Aaron (on his ifu.net address) on the 6th of November last year. So far I have not received a response. I'm getting no response from http://www.chordate.com either (as mentioned on c.l.p. last week) even though whois says that the dns registration is valid until the 28th of September 2003. I think we can safely say that the only reason gadfly is still looking like it is alive are the nails attaching it to the perch. Regards, Andy -- ----------------------------------------------------------------------- From the desk of Andrew J Todd esq. "So I curtailed my Walpoling activities, sallied forth and infiltrated your place of purveyance to negotiate the vending of some cheesy comestibles." - Monty Python. From =?iso-8859-1?Q?Dario_Lopez-K=E4sten?= Mon Mar 4 17:20:54 2002 From: =?iso-8859-1?Q?Dario_Lopez-K=E4sten?= (=?iso-8859-1?Q?Dario_Lopez-K=E4sten?=) Date: Mon, 4 Mar 2002 18:20:54 +0100 Subject: [DB-SIG] Status of gadfly? References: <5.1.0.14.0.20020303190103.03798bb0@mail.irrblosset.se> <3C83389E.9010008@halfcooked.com> Message-ID: <010901c1c3a1$2d39acb0$2135b5d4@ita.chalmers.se> ----- Original Message ----- > > I'm getting no response from http://www.chordate.com either (as > mentioned on c.l.p. last week) even though whois says that the dns > registration is valid until the 28th of September 2003. the address resolves but does not respond to pings... so I guess it is safe to assume that there is no machine listening on that adress :P > I think we can safely say that the only reason gadfly is still looking > like it is alive are the nails attaching it to the perch. and the inclusionin zope. afaik ZC are the ones that make the current gadfly work with newr pythons... Oh, well, I guess it is a suitable candidate for a hobby project :-) /dario From Mikhail Astafiev Wed Mar 6 11:11:17 2002 From: Mikhail Astafiev (Mikhail Astafiev) Date: Wed, 6 Mar 2002 18:11:17 +0700 Subject: [DB-SIG] Passing Unicode strings to Database Message-ID: <77188782494.20020306181117@tomsk.net> [Env: Win2k, Python 1.5.2] Hi people! I have a string in Japanese encoded in UTF8. I need to put it into database in Unicode form. import dbi, odbc o=odbc.odbc(self.ODBC_name+"/"+self.ODBC_sql_username+"/"+self.ODBC_sql_password) c=o.cursor() runes = UTF82Runes(string.replace(self.pr_table[row]["description"],"'","''")) operator="""INSERT INTO %s VALUES('%s','%s');"""%(self.ODBC_table, int(self.pr_table[row]["pr_no"]), runes.tostring()) c.execute(operator) # update database I'm getting the following error trace: Traceback (innermost last): File "C:\dev\Products\MRATES~1\server.py", line 34, in ? PR.sync_all() File "C:\dev\Products\MRATES~1\PRML\code\prml.py", line 2837, in sync_all self.__sync_with_sql__(i) File "C:\dev\Products\MRATES~1\PRML\code\prml.py", line 2797, in __sync_with_sql__ c.execute(operator) # update database TypeError: argument 1: expected string without null bytes, string found runes is array.array('H') containing Unicode string. Database string field has "ntext" type. How can I overcome this problem? Thanks in advance, Mick. From mal@lemburg.com Wed Mar 6 11:20:05 2002 From: mal@lemburg.com (M.-A. Lemburg) Date: Wed, 06 Mar 2002 12:20:05 +0100 Subject: [DB-SIG] Passing Unicode strings to Database References: <77188782494.20020306181117@tomsk.net> Message-ID: <3C85FB65.546871F5@lemburg.com> Mikhail Astafiev wrote: > > [Env: Win2k, Python 1.5.2] > > Hi people! > > I have a string in Japanese encoded in UTF8. I need to put it into > database in Unicode form. > > import dbi, odbc > o=odbc.odbc(self.ODBC_name+"/"+self.ODBC_sql_username+"/"+self.ODBC_sql_password) > c=o.cursor() > runes = UTF82Runes(string.replace(self.pr_table[row]["description"],"'","''")) > operator="""INSERT INTO %s VALUES('%s','%s');"""%(self.ODBC_table, > int(self.pr_table[row]["pr_no"]), > runes.tostring()) > c.execute(operator) # update database > > I'm getting the following error trace: > > Traceback (innermost last): > File "C:\dev\Products\MRATES~1\server.py", line 34, in ? > PR.sync_all() > File "C:\dev\Products\MRATES~1\PRML\code\prml.py", line 2837, in sync_all > self.__sync_with_sql__(i) > File "C:\dev\Products\MRATES~1\PRML\code\prml.py", line 2797, in __sync_with_sql__ > c.execute(operator) # update database > TypeError: argument 1: expected string without null bytes, string found > > runes is array.array('H') containing Unicode string. > > Database string field has "ntext" type. How can I overcome this > problem? Use mxODBC ? It has Unicode support builtin. Whether your ODBC driver has is a different question, though. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From daniel.dittmar@sap.com Wed Mar 6 11:28:20 2002 From: daniel.dittmar@sap.com (Dittmar, Daniel) Date: Wed, 6 Mar 2002 12:28:20 +0100 Subject: [DB-SIG] None and BOOLEAN columns Message-ID: What is the expected behaviour with regard to NULL, TRUE, FALSE and BOOLEAN columns? In the SAP DB driver, I translate None (or any other value interpreted as false) to a SQL False value, so there is currently no possibility to insert a real NULL value. On SELECT, I translate both NULL and FALSE to None. Admittedly, this comes from my own Python + SQL style, where I use None as false on the Python side and try to stay away from three valued logic on the SQL side. What do other drivers do? Daniel -- Daniel Dittmar SAP DB, SAP Labs Berlin daniel.dittmar@sap.com http://www.sapdb.org/ From mal@lemburg.com Wed Mar 6 11:49:17 2002 From: mal@lemburg.com (M.-A. Lemburg) Date: Wed, 06 Mar 2002 12:49:17 +0100 Subject: [DB-SIG] None and BOOLEAN columns References: Message-ID: <3C86023D.7F5B0D36@lemburg.com> "Dittmar, Daniel" wrote: > > What is the expected behaviour with regard to NULL, TRUE, FALSE and BOOLEAN > columns? > > In the SAP DB driver, I translate None (or any other value interpreted as > false) to a SQL False value, so there is currently no possibility to insert > a real NULL value. > > On SELECT, I translate both NULL and FALSE to None. > > Admittedly, this comes from my own Python + SQL style, where I use None as > false on the Python side and try to stay away from three valued logic on the > SQL side. > > What do other drivers do? I'd suggest to use PyObject_IsTrue() on the input side and to return Py_True/Py_False on the output side. None should always map to NULL on input. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From fog@debian.org Wed Mar 6 11:50:08 2002 From: fog@debian.org (Federico Di Gregorio) Date: 06 Mar 2002 12:50:08 +0100 Subject: [DB-SIG] None and BOOLEAN columns In-Reply-To: References: Message-ID: <1015415404.5554.30.camel@nenya> --=-84YnhbKyHWBX2eTYpURt Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Wed, 2002-03-06 at 12:28, Dittmar, Daniel wrote: > What is the expected behaviour with regard to NULL, TRUE, FALSE and BOOLE= AN > columns? >=20 > In the SAP DB driver, I translate None (or any other value interpreted as > false) to a SQL False value, so there is currently no possibility to inse= rt > a real NULL value. >=20 > On SELECT, I translate both NULL and FALSE to None. >=20 > Admittedly, this comes from my own Python + SQL style, where I use None a= s > false on the Python side and try to stay away from three valued logic on = the > SQL side. >=20 > What do other drivers do? psycopg uses the following map: NULL <-> None False (postgres value is 'f') -> 0 True (postgres value is 't') -> 1 we are still discussion on the python to postgres conversion, because 0 and 1 can't be inserted in postgres (it expects t and f). i think psycopg 1.1 will return two litle specialized objects for t and f that work correctly in python 'if's and can be reinserted into the db. ciao, federico --=20 Federico Di Gregorio Debian GNU/Linux Developer & Italian Press Contact fog@debian.org INIT.D Developer fog@initd.org La felicit=E0 =E8 una tazza di cioccolata calda. Sempre. -- I= o --=-84YnhbKyHWBX2eTYpURt Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iEYEABECAAYFAjyGAmsACgkQvcCgrgZGjevjuwCgiSrlwETAbHwyezAeWlJ5gbB8 5dUAn1INoYd+DvayKC/pE7/kNSbZlfBl =encN -----END PGP SIGNATURE----- --=-84YnhbKyHWBX2eTYpURt-- From aaron@reportlab.com Wed Mar 6 18:49:38 2002 From: aaron@reportlab.com (Aaron Watters) Date: Wed, 06 Mar 2002 13:49:38 -0500 Subject: [DB-SIG] gadfly Message-ID: <3C8664C2.70105@reportlab.com> """ I sent an email to Aaron (on his ifu.net address) on the 6th of November last year. So far I have not received a response. I'm getting no response from http://www.chordate.com either (as mentioned on c.l.p. last week) even though whois says that the dns registration is valid until the 28th of September 2003. I think we can safely say that the only reason gadfly is still looking like it is alive are the nails attaching it to the perch. Regards, Andy -- ----------------------------------------------------------------------- From the desk of Andrew J Todd esq. """ It works better to use pins for insects. ;) chordate.com was a complimentary hosting that looks like they decided to kill -- and I stopped reading arw@ifu.net a long time ago -- about 100 spams a day and virtually no real mail. Ok. I will try in a month or so to get gadfly reinvigorated (at least so it doesn't issue warnings about obsolete modules) and to get chordate.com back some how. Right now I'm pretty busy making sure the government gets paid this year :(. -- Aaron Watters From andy47@halfcooked.com Thu Mar 7 09:34:59 2002 From: andy47@halfcooked.com (Andy Todd) Date: Thu, 07 Mar 2002 20:34:59 +1100 Subject: [DB-SIG] gadfly References: <3C8664C2.70105@reportlab.com> Message-ID: <3C873443.4090208@halfcooked.com> Aaron Watters wrote: > """ > > I sent an email to Aaron (on his ifu.net address) on the 6th of November > last year. So far I have not received a response. > > I'm getting no response from http://www.chordate.com either (as > mentioned on > c.l.p. last week) even though whois says that the dns registration is valid > until the 28th of September 2003. > > I think we can safely say that the only reason gadfly is still looking like > it is alive are the nails attaching it to the perch. > > Regards, > Andy > -- > ----------------------------------------------------------------------- > From the desk of Andrew J Todd esq. > > """ > > It works better to use pins for insects. ;) > > chordate.com was a complimentary hosting that looks like they decided to > kill -- > and I stopped reading arw@ifu.net a long time ago -- about 100 spams a day > and virtually no real mail. > > Ok. I will try in a month or so to get gadfly reinvigorated (at least > so it doesn't > issue warnings about obsolete modules) and to get chordate.com back some > how. > > Right now I'm pretty busy making sure the government gets paid this year > :(. > > -- Aaron Watters > Thanks Aaron, If you need any help; testing, updating documentation, etc please just shout. Regards, Andy -- ----------------------------------------------------------------------- From the desk of Andrew J Todd esq. "So I curtailed my Walpoling activities, sallied forth and infiltrated your place of purveyance to negotiate the vending of some cheesy comestibles." - Monty Python. From arthuralbano@hotmail.com Sat Mar 9 15:24:00 2002 From: arthuralbano@hotmail.com (Arthur Albano) Date: Sun, 10 Mar 2002 00:24:00 +0900 Subject: [DB-SIG] Passing Unicode strings to Database Message-ID: >From: Mikhail Astafiev >Reply-To: Mikhail Astafiev >To: db-sig@python.org, python-list@python.org >Subject: [DB-SIG] Passing Unicode strings to Database >Date: Wed, 6 Mar 2002 18:11:17 +0700 > >[Env: Win2k, Python 1.5.2] > >Hi people! > >I have a string in Japanese encoded in UTF8. I need to put it into >database in Unicode form. > >import dbi, odbc >o=odbc.odbc(self.ODBC_name+"/"+self.ODBC_sql_username+"/"+self.ODBC_sql_password) >c=o.cursor() >runes = >UTF82Runes(string.replace(self.pr_table[row]["description"],"'","''")) >operator="""INSERT INTO %s VALUES('%s','%s');"""%(self.ODBC_table, > int(self.pr_table[row]["pr_no"]), > runes.tostring()) >c.execute(operator) # update database > >I'm getting the following error trace: > >Traceback (innermost last): > File "C:\dev\Products\MRATES~1\server.py", line 34, in ? > PR.sync_all() > File "C:\dev\Products\MRATES~1\PRML\code\prml.py", line 2837, in >sync_all > self.__sync_with_sql__(i) > File "C:\dev\Products\MRATES~1\PRML\code\prml.py", line 2797, in >__sync_with_sql__ > c.execute(operator) # update database >TypeError: argument 1: expected string without null bytes, string found > >runes is array.array('H') containing Unicode string. > >Database string field has "ntext" type. How can I overcome this >problem? > >Thanks in advance, >Mick. Mikhail, If the problem is just conversion from UTF-8 to UNICODE, try this: unicode(string_in_utf8_to_be_converted,'UTF-8') It returns a unicode string. Arthur Albano "Just a Weekend Programmer" _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. From djc@object-craft.com.au Sun Mar 10 05:58:25 2002 From: djc@object-craft.com.au (Dave Cole) Date: 10 Mar 2002 16:58:25 +1100 Subject: [DB-SIG] Sybase module 0.33 released Message-ID: What is it: The Sybase module provides a Python interface to the Sybase relational database system. It supports all of the Python Database API, version 2.0 with extensions. Note: Since the 0.32 release I have come to the realisation that the Sybase dynamic SQL functionality is not nearly general enough to use for correct DB-API functionality. I have thrown up my hands and gone back to the drawing board with the high level Sybase.py module. There were four pre-releases of the module. The following is a summary of what has changed since 0.32: 1) Bulkcopy support has been temporarily removed from Sybase.py. The low level support is still present in the sybasect extension module. 2) Cursors are no longer using dynamic SQL so there will no longer be an extra result set which reported the status of the temporary stored procedure. This should remove some of the confusion behaviour of cursors. There should be fewer restrictions on the use of cursors. 3) The paramstyle is now 'named'. This means that you can now do this: c.execute("select * from titles where title like @arg", {'@arg': 'The %'}) 4) You can send arguments to Cursor.callproc() the old way: c.callproc('sp_help', ['titles']) or the new way: c.callproc('sp_help', {'@objname': 'titles'}) 5) Some internal cursor state constants were privatised (via leading '_'). Sadly no money was raised in the process and the conditions of the privatisation contract are commercial-in-confidence. 6) You can now compile the extension module without bulkcopy support by doing this: python setup.py build_ext -U WANT_BULKCOPY python setup.py install 7) The default build does not do threading any more so if you want threading enabled you will have to do this: python setup.py build_ext -D WANT_THREADS python setup.py install 8) There is some initial work to support FreeTDS. One of the problems with FreeTDS is that it does not support inline error handling. The callback error handling works well if you do not compile for threads support, but causes problems when compiled for threading. The problem occurs when the extension module releases the global interpreter lock when calling the Sybase CT library. A Python callback causes the interpreter to be reentered by the callback which leads to bad things when the following warning from the Python include file ceval.h is violated: WARNING: NEVER NEST CALLS TO Py_BEGIN_ALLOW_THREADS AND Py_END_ALLOW_THREADS!!! At the moment the module will compile for FreeTDS (at least it does on my machine) and some things do work. All you have to do is compile like this: python setup.py build_ext -D HAVE_FREETDS -U WANT_BULKCOPY python setup.py install There is no error handling and reporting for FreeTDS yet. 9) There is now some basic locale support in the sybasect extension module. I do not have a need for this so am really depending upon someone to try it and report problems: >>> from sybasect import * >>> status, ctx = cs_ctx_alloc() >>> status, loc = ctx.cs_loc_alloc() >>> loc.cs_locale(CS_GET, CS_SYB_LANG) (1, 'us_english') >>> loc.cs_dt_info(CS_GET, CS_DT_CONVFMT) (1, 3) >>> loc.cs_dt_info(CS_GET, CS_MONTH, 1) (1, 'February') >>> loc.cs_dt_info(CS_GET, CS_DATEORDER) (1, 'dmy') In theory you could do something like this: >>> import Sybase >>> from Sybase import _ctx, CS_SUCCEED, CS_SET, CS_SYB_LANG, CS_LOC_PROP >>> >>> status, locale = _ctx.cs_loc_alloc() >>> if status != CS_SUCCEED: ... raise 'cs_loc_alloc' ... >>> if locale.cs_locale(CS_SET, CS_SYB_LANG, 'french') != CS_SUCCEED: ... raise 'cs_locale CS_SYB_LANG' ... >>> db = Sybase.connect('SYBASE', 'sa', '', delay_connect = 1) >>> db.set_property(CS_LOC_PROP, locale) >>> db.connect() 10) There is some extra debugging detail for CS_DATAFMT which means you now get messages like this: >>> import Sybase >>> db = Sybase.connect('SYBASE', 'sa', '', 'pubs2') >>> db._conn.debug = 1 >>> c = db.cursor() ct_cmd_alloc(conn0, &cmd) -> CS_SUCCEED, cmd1 >>> c.callproc('sp_help', {'@objname': 'titles'}) ct_command(cmd1, CS_RPC_CMD, "sp_help", CS_NULLTERM, CS_UNUSED) -> CS_SUCCEED ct_param(cmd1, &databuf0->fmt=[name:"@objname" type:CS_CHAR_TYPE status:CS_INPUTVALUE format:CS_FMT_NULLTERM count:1 maxlength:7], databuf0->buff, 6, 0) -> CS_SUCCEED ct_send(cmd1) -> CS_SUCCEED ct_results(cmd1, &result) -> CS_SUCCEED, CS_ROW_RESULT ct_res_info(cmd1, CS_NUMDATA, &value, CS_UNUSED, NULL) -> CS_SUCCEED, 3 ct_describe(cmd1, 1, &fmt) -> CS_SUCCEED, datafmt0=[name:"Name" type:CS_CHAR_TYPE status:CS_UPDATABLE format:CS_FMT_UNUSED count:0 maxlength:30] ct_bind(cmd1, 1, &datafmt0->fmt=[name:"Name" type:CS_CHAR_TYPE status:CS_UPDATABLE format:CS_FMT_UNUSED count:1 maxlength:30], databuf1->buff, databuf1->copied, databuf1->indicator) -> CS_SUCCEED, databuf1 ct_describe(cmd1, 2, &fmt) -> CS_SUCCEED, datafmt1=[name:"Owner" type:CS_CHAR_TYPE status:48 format:CS_FMT_UNUSED count:0 maxlength:30] ct_bind(cmd1, 2, &datafmt1->fmt=[name:"Owner" type:CS_CHAR_TYPE status:48 format:CS_FMT_UNUSED count:1 maxlength:30], databuf2->buff, databuf2->copied, databuf2->indicator) -> CS_SUCCEED, databuf2 ct_describe(cmd1, 3, &fmt) -> CS_SUCCEED, datafmt2=[name:"Type" type:CS_CHAR_TYPE status:48 format:CS_FMT_UNUSED count:0 maxlength:22] ct_bind(cmd1, 3, &datafmt2->fmt=[name:"Type" type:CS_CHAR_TYPE status:48 format:CS_FMT_UNUSED count:1 maxlength:22], databuf3->buff, databuf3->copied, databuf3->indicator) -> CS_SUCCEED, databuf3 11) The was a minor change to setup.py for Linux. No longer looks for both libsybtcl and libtcl. Now just looks for libinsck. 12) The tar file now unpacks to a directory called sybase-. The module is available here: http://www.object-craft.com.au/projects/sybase/sybase-0.33.tar.gz The module home page is here: http://www.object-craft.com.au/projects/sybase/ - Dave -- http://www.object-craft.com.au From lacaille.maryse@ic.gc.ca Wed Mar 13 16:36:26 2002 From: lacaille.maryse@ic.gc.ca (lacaillm) Date: Wed, 13 Mar 2002 11:36:26 -0500 Subject: [DB-SIG] (no subject) Message-ID: <3C8F800A.F341D170@ic.gc.ca> wath is the abreviation for "month" thank you From ig_laselva@hotmail.com Sun Mar 17 21:41:46 2002 From: ig_laselva@hotmail.com (Ignacio Guerrero) Date: Sun, 17 Mar 2002 18:41:46 -0300 Subject: [DB-SIG] Beginner in troubles. Message-ID:
I have a little problem... be patient, I'm a beginner.
I'm exercising my newly aquired skills and I found myself with a problem that outskills me.
I'm writing a script that:
-asks you if you're a new user or a registred one.
-then, if you're new, asks you to:
 -fill a form with personal data...
 -and prompts you for a userName and a userPass (which you have to type twise with exact spelling).
 -then, verifies if the userName is already taken or not and...
  -if it is, takes you back to the previous prompt or...
  -if it's not, adds your pass and Id to a database file.
-I leave the else: to you :-)
Now, my problem is that I'm not working with a database file but with a text file, appending the userName and the userPass to it, and retrieving them later.
What I want to know is: How do I work with a database file?
I work under Windows 98 (sadly, I wish I could use Linux, but my mom would die, or may be kill me.)
-I have looked for every tutorial and nothing...
-I went to the SQL site, red a tutorial... looks easy.
-I had no troubles with Python, so far... lots of doc.
-I had no troubles with Tkinter nor wxPython either... lot of doc too.
-But (and it's a big BUT)... I can't find a single tutorial for beginners on working with DB's under Windows OS.
 -Should I download a Db's API?
 -Should I create a DB file or does my script should do that?
 -How do I link the data generated by my script to de DB file?
¡¡¡HEEEEEEEEELP!!! Please.
If it sounds like a stupid question just tell me where to FAQ myself (FAQ... I said FAQ).
Thanks.
Ignacio.


MSN Photos es la manera más sencilla de compartir e imprimir sus fotos. http://photos.latam.msn.com/Support/WorldWide.aspx
From andy47@halfcooked.com Mon Mar 18 09:32:20 2002 From: andy47@halfcooked.com (Andy Todd) Date: Mon, 18 Mar 2002 20:32:20 +1100 Subject: [DB-SIG] Beginner in troubles. References: Message-ID: <3C95B424.5000307@halfcooked.com> Ignacio Guerrero wrote: > I have a little problem... be patient, I'm a beginner. > I'm exercising my newly aquired skills and I found myself with a problem > that outskills me. > I'm writing a script that: > -asks you if you're a new user or a registred one. > -then, if you're new, asks you to: > -fill a form with personal data... > -and prompts you for a userName and a userPass (which you have to type > twise with exact spelling). > -then, verifies if the userName is already taken or not and... > -if it is, takes you back to the previous prompt or... > -if it's not, adds your pass and Id to a database file. > -I leave the else: to you :-) > > Now, my problem is that I'm not working with a database file but with a > text file, appending the userName and the userPass to it, and retrieving > them later. > What I want to know is: How do I work with a database file? > > I work under Windows 98 (sadly, I wish I could use Linux, but my mom > would die, or may be kill me.) > -I have looked for every tutorial and nothing... > -I went to the SQL site, red a tutorial... looks easy. > -I had no troubles with Python, so far... lots of doc. > -I had no troubles with Tkinter nor wxPython either... lot of doc too. > -But (and it's a big BUT)... I can't find a single tutorial for > beginners on working with DB's under Windows OS. > -Should I download a Db's API? > -Should I create a DB file or does my script should do that? > -How do I link the data generated by my script to de DB file? > > ¡¡¡HEEEEEEEEELP!!! Please. > > If it sounds like a stupid question just tell me where to FAQ myself > (FAQ... I said FAQ). > Thanks. > Ignacio. Ah, You've hit a bit of a problem area there I believe. I searched Google for 'python database tutorial' and the results were a little sparse to say the least. I think the problem here is that most people who come to the DB-SIG know how to use databases and how to program in Python but just need to join those two areas of knowledge together. I think it would be a very good idea to write a getting started type document which could fit into the Python HOWTO Documents (http://py-howto.sourceforge.net). Sadly, I don't have the time to do it but if anyone would like to volunteer ... If you want to persevere with a relational database the one I've had the most success with on Windows 98 is MySQL. You can download the database from http://www.mysql.com/ and the DB-API module from http://sourceforge.net/projects/mysql-python. In the short term, if a full blown relational database is too much to learn in the short term maybe you should check out the anydbm module (http://www.python.org/doc/lib/module-anydbm.html). Whichever you choose please let us know how you get on and the list is always here for you to ask questions if you get stuck. Regards, Andy -- ----------------------------------------------------------------------- From the desk of Andrew J Todd esq. "So I curtailed my Walpoling activities, sallied forth and infiltrated your place of purveyance to negotiate the vending of some cheesy comestibles." - Monty Python. From arthuralbano@hotmail.com Mon Mar 18 12:58:34 2002 From: arthuralbano@hotmail.com (Arthur Albano) Date: Mon, 18 Mar 2002 21:58:34 +0900 Subject: [DB-SIG] Including variables in SQL queries Message-ID: Maybe this: >>>a="World!" >>>b="Hello %s" % (a) >>>b 'Hello World!' >>> Arthur. "Just a Weekend Programmer." _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx From arthuralbano@hotmail.com Mon Mar 18 13:06:49 2002 From: arthuralbano@hotmail.com (Arthur Albano) Date: Mon, 18 Mar 2002 22:06:49 +0900 Subject: [DB-SIG] Beginner in troubles. Message-ID: This is a multi-part message in MIME format. ------=_NextPart_000_4bdc_348a_1aeb Content-Type: text/plain; format=flowed Ignacio, There are many databases on the market, but on you case I would recomend MySQL (www.mysql.org). If anyone else has any suggestions, please. Then you need to install it. Pretty easy. But you have to set come configuration files. There's a nice manual about how to make it start on the same site. Then, and just after it, you have to connect it to Python, using a nice module. Details later if you think its a nice ideo or someone else here have another. If you still use another SQL server, please tell. Arthur. "Just a weekend programmer." _________________________________________________________________ Join the world’s largest e-mail service with MSN Hotmail. http://www.hotmail.com ------=_NextPart_000_4bdc_348a_1aeb Content-Type: message/rfc822 >From db-sig-admin@python.org Sun, 17 Mar 2002 13:56:58 -0800 Received: from [63.102.49.29] by hotmail.com (3.2) with ESMTP id MHotMailBE5E5BC40007400438963F66311D0BC00; Sun, 17 Mar 2002 13:55:16 -0800 Received: from localhost.localdomain ([127.0.0.1] helo=mail.python.org) by mail.python.org with esmtp (Exim 3.35 #2) id 16micJ-0003AA-00; Sun, 17 Mar 2002 16:55:03 -0500 Received: from [64.4.23.102] (helo=hotmail.com) by mail.python.org with esmtp (Exim 3.35 #2) id 16mibJ-00036F-00 for db-sig@python.org; Sun, 17 Mar 2002 16:54:01 -0500 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sun, 17 Mar 2002 13:41:46 -0800 Received: from 200.43.21.71 by lw15fd.law15.hotmail.msn.com with HTTP; Sun, 17 Mar 2002 21:41:46 GMT X-Originating-IP: [200.43.21.71] From: "Ignacio Guerrero" To: db-sig@python.org Bcc: Mime-Version: 1.0 Content-Type: text/html; charset=iso-8859-1 Message-ID: X-OriginalArrivalTime: 17 Mar 2002 21:41:46.0595 (UTC) FILETIME=[89885330:01C1CDFC] Subject: [DB-SIG] Beginner in troubles. Sender: db-sig-admin@python.org Errors-To: db-sig-admin@python.org X-BeenThere: db-sig@python.org X-Mailman-Version: 2.0.8 (101270) Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: SIG on Python Tabular Databases List-Unsubscribe: , List-Archive: Date: Sun, 17 Mar 2002 18:41:46 -0300
I have a little problem... be patient, I'm a beginner.
I'm exercising my newly aquired skills and I found myself with a problem that outskills me.
I'm writing a script that:
-asks you if you're a new user or a registred one.
-then, if you're new, asks you to:
 -fill a form with personal data...
 -and prompts you for a userName and a userPass (which you have to type twise with exact spelling).
 -then, verifies if the userName is already taken or not and...
  -if it is, takes you back to the previous prompt or...
  -if it's not, adds your pass and Id to a database file.
-I leave the else: to you :-)
Now, my problem is that I'm not working with a database file but with a text file, appending the userName and the userPass to it, and retrieving them later.
What I want to know is: How do I work with a database file?
I work under Windows 98 (sadly, I wish I could use Linux, but my mom would die, or may be kill me.)
-I have looked for every tutorial and nothing...
-I went to the SQL site, red a tutorial... looks easy.
-I had no troubles with Python, so far... lots of doc.
-I had no troubles with Tkinter nor wxPython either... lot of doc too.
-But (and it's a big BUT)... I can't find a single tutorial for beginners on working with DB's under Windows OS.
 -Should I download a Db's API?
 -Should I create a DB file or does my script should do that?
 -How do I link the data generated by my script to de DB file?
¡¡¡HEEEEEEEEELP!!! Please.
If it sounds like a stupid question just tell me where to FAQ myself (FAQ... I said FAQ).
Thanks.
Ignacio.


MSN Photos es la manera más sencilla de compartir e imprimir sus fotos. http://photos.latam.msn.com/Support/WorldWide.aspx
_______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig ------=_NextPart_000_4bdc_348a_1aeb-- From arthuralbano@hotmail.com Mon Mar 18 13:29:42 2002 From: arthuralbano@hotmail.com (Arthur Albano) Date: Mon, 18 Mar 2002 22:29:42 +0900 Subject: [DB-SIG] Beginner in troubles. Message-ID: This is a multi-part message in MIME format. ------=_NextPart_000_63d2_56dc_5f91 Content-Type: text/plain; format=flowed >-Should I download a Db's API? Yes. MySQL Python API information can be found at: http://sourceforge.net/projects/mysql-python You "have to" install it in order to make "inserts & selects" the following file: mysql-python Arthur. "Just a bothered bank database manager..." _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx ------=_NextPart_000_63d2_56dc_5f91 Content-Type: message/rfc822 >From db-sig-admin@python.org Sun, 17 Mar 2002 13:56:58 -0800 Received: from [63.102.49.29] by hotmail.com (3.2) with ESMTP id MHotMailBE5E5BC40007400438963F66311D0BC00; Sun, 17 Mar 2002 13:55:16 -0800 Received: from localhost.localdomain ([127.0.0.1] helo=mail.python.org) by mail.python.org with esmtp (Exim 3.35 #2) id 16micJ-0003AA-00; Sun, 17 Mar 2002 16:55:03 -0500 Received: from [64.4.23.102] (helo=hotmail.com) by mail.python.org with esmtp (Exim 3.35 #2) id 16mibJ-00036F-00 for db-sig@python.org; Sun, 17 Mar 2002 16:54:01 -0500 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sun, 17 Mar 2002 13:41:46 -0800 Received: from 200.43.21.71 by lw15fd.law15.hotmail.msn.com with HTTP; Sun, 17 Mar 2002 21:41:46 GMT X-Originating-IP: [200.43.21.71] From: "Ignacio Guerrero" To: db-sig@python.org Bcc: Mime-Version: 1.0 Content-Type: text/html; charset=iso-8859-1 Message-ID: X-OriginalArrivalTime: 17 Mar 2002 21:41:46.0595 (UTC) FILETIME=[89885330:01C1CDFC] Subject: [DB-SIG] Beginner in troubles. Sender: db-sig-admin@python.org Errors-To: db-sig-admin@python.org X-BeenThere: db-sig@python.org X-Mailman-Version: 2.0.8 (101270) Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: SIG on Python Tabular Databases List-Unsubscribe: , List-Archive: Date: Sun, 17 Mar 2002 18:41:46 -0300
I have a little problem... be patient, I'm a beginner.
I'm exercising my newly aquired skills and I found myself with a problem that outskills me.
I'm writing a script that:
-asks you if you're a new user or a registred one.
-then, if you're new, asks you to:
 -fill a form with personal data...
 -and prompts you for a userName and a userPass (which you have to type twise with exact spelling).
 -then, verifies if the userName is already taken or not and...
  -if it is, takes you back to the previous prompt or...
  -if it's not, adds your pass and Id to a database file.
-I leave the else: to you :-)
Now, my problem is that I'm not working with a database file but with a text file, appending the userName and the userPass to it, and retrieving them later.
What I want to know is: How do I work with a database file?
I work under Windows 98 (sadly, I wish I could use Linux, but my mom would die, or may be kill me.)
-I have looked for every tutorial and nothing...
-I went to the SQL site, red a tutorial... looks easy.
-I had no troubles with Python, so far... lots of doc.
-I had no troubles with Tkinter nor wxPython either... lot of doc too.
-But (and it's a big BUT)... I can't find a single tutorial for beginners on working with DB's under Windows OS.
 -Should I download a Db's API?
 -Should I create a DB file or does my script should do that?
 -How do I link the data generated by my script to de DB file?
¡¡¡HEEEEEEEEELP!!! Please.
If it sounds like a stupid question just tell me where to FAQ myself (FAQ... I said FAQ).
Thanks.
Ignacio.


MSN Photos es la manera más sencilla de compartir e imprimir sus fotos. http://photos.latam.msn.com/Support/WorldWide.aspx
_______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig ------=_NextPart_000_63d2_56dc_5f91-- From paulturcotte@bbg.org Mon Mar 18 15:05:12 2002 From: paulturcotte@bbg.org (Turcotte, Paul) Date: Mon, 18 Mar 2002 10:05:12 -0500 Subject: [DB-SIG] Including variables in SQL queries Message-ID: <951DC0D57185D311B88B00A0C9E9258D8010EA@MIDNIGHT> Something like this may work for you: query = "select password from table where userid like '" + formid + "'" c.execute(query) No doubt there are many other ways to do the same, likely many of them more elegant than my newbie code, but it works for me. Also, you can tweak it depending on what type formid is. Hope it helps, PT ________________________________ Paul Turcotte Director of Computer Technology Brooklyn Botanic Garden paulturcotte@bbg.org 718.623.7232 | fax 622.7839 -----Original Message----- From: Hugh [mailto:h.e.w.frater@cs.cf.ac.uk] Sent: Saturday, March 17, 2001 4:43 PM To: db-sig@python.org Subject: [DB-SIG] Including variables in SQL queries Hi All, I got DCOracle2 installed and working a while back and am progressing with the project OK. What I want to know, is how to include variables in an SQL query. This is so I can select an encryted password from a table given the userID which is parsed using the cgi.py module into a variable in my python script. The code I've got is as follows: Note I have yet to try this because the tables are not yet finalised. formid = form.getvalue('id') ....... c.execute("select password from tblborrower where userid = formid") I have a suspision that this won't work because it will try and use "formid" as the value for userid instead of the value of the string formid. I know there are probably better ways to make a secure login, but it's only a first year project, and it doesn't matter that much. Thanks in advance for any help. Hugh Frater _______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig From j.andrusaitis@konts.lv Mon Mar 18 16:03:37 2002 From: j.andrusaitis@konts.lv (Jekabs Andrushaitis) Date: Mon, 18 Mar 2002 18:03:37 +0200 Subject: [DB-SIG] Including variables in SQL queries In-Reply-To: <951DC0D57185D311B88B00A0C9E9258D8010EA@MIDNIGHT> Message-ID: <000f01c1ce96$775ffc40$262a949f@konts.lv> Most Python DB wrapper modules support "bind variables" in SQL (there are some exceptions - for example PostgreSQL module which is part of PostgreSQL distribution, but there are other PostgreSQL modules which do support bind variables:) Most commonly used are Python-style and positional bind variables. Advantage in using bind variables is that their values are not actually inserted into SQL, but passed to DB engine directly, thus allowing to use any values for the variables. Without that one has to eliminate or prefix all the special symbols from string variables. Python-style syntax: args=3D {"a":"a","b":1} sql=3D "select a,b from c where a=3D%(a)s and b=3D%(b)d" sqlc.execute(sql,args) Positional style syntax: args=3D ("a",1) sql=3D "select a,b from c where a=3D:1 and b=3D:2" sqlc.execute(sql,args) If the values of fields used in SQL statements are user-supplied, it is highly recommended to use bind variables and not insert the values of string constants directly into SQL statements, as it might become potential security hole, point of failure etc :) Example: username=3D "asd';delete from users;commit;select name from users where name=3D'aa" sql=3D "select password from users where name=3D'%s'" % username sqlc.execute(sql) This would execute a statement: select password from users where name=3D'asd';delete from users;commit;s= elect name from users where name=3D'aa' For more details you might want to look into your databases Python module docs! P.S. Sorry if some of this is incomplete or innacurate :) Jekabs Andrushaitis Senior system analyst Tieto Konts Financial Systems Ltd. 41 Lacplesa Str. Riga, LV-1011, Latvia Tel: +371 7286660 Fax: +371 7243000 E-mail: j.andrusaitis@konts.lv > -----Original Message----- > From: db-sig-admin@python.org > [mailto:db-sig-admin@python.org]On Behalf > Of Turcotte, Paul > Sent: pirmdiena, 2002. gada 18. mart=D7 17:05 > To: 'Hugh' > Cc: 'db-sig@python.org' > Subject: RE: [DB-SIG] Including variables in SQL queries > > > Something like this may work for you: > > query =3D "select password from table where userid like '" + > formid + "'" > c.execute(query) > > No doubt there are many other ways to do the same, likely > many of them more > elegant than my newbie code, but it works for me. Also, you > can tweak it > depending on what type formid is. > > Hope it helps, > PT > ________________________________ > Paul Turcotte > Director of Computer Technology > Brooklyn Botanic Garden > paulturcotte@bbg.org > 718.623.7232 | fax 622.7839 > > > -----Original Message----- > From: Hugh [mailto:h.e.w.frater@cs.cf.ac.uk] > Sent: Saturday, March 17, 2001 4:43 PM > To: db-sig@python.org > Subject: [DB-SIG] Including variables in SQL queries > > > Hi All, > I got DCOracle2 installed and working a while back and am > progressing with the project OK. What I want to know, is how > to include > variables in an SQL query. This is so I can select an > encryted password from > a table given the userID which is parsed using the cgi.py > module into a > variable in my python script. The code I've got is as > follows: Note I have > yet to try this because the tables are not yet finalised. > > formid =3D form.getvalue('id') > ....... > c.execute("select password from tblborrower where userid =3D formid") > > I have a suspision that this won't work because it will try > and use "formid" > as the value for userid instead of the value of the string formid. > > I know there are probably better ways to make a secure login, > but it's only > a first year project, and it doesn't matter that much. Thanks > in advance for > any help. Hugh Frater > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig From paul@boddie.net Mon Mar 18 17:24:32 2002 From: paul@boddie.net (paul@boddie.net) Date: 18 Mar 2002 17:24:32 -0000 Subject: [DB-SIG] Including variables in SQL queries Message-ID: <20020318172432.11421.qmail@www3.nameplanet.com> Hugh wrote: > [Variables in SQL - my favourite topic, apparently] > >formid = form.getvalue('id') >....... >c.execute("select password from tblborrower where userid = formid") If you want to know the best and most secure method, just follow the advice at the end of this message. Let's look at some of the suggested approaches: "Arthur Albano" wrote: > >Maybe this: > > >>>a="World!" > >>>b="Hello %s" % (a) Effectively, this is the same as... b="Hello " + a And using this basic principle, we have the following suggestion: "Turcotte, Paul" wrote: > >Something like this may work for you: > >query = "select password from table where userid like '" + formid + "'" >c.execute(query) Apart from the frequently-arising encoding issues that emerge from using this approach, there's a danger in using the above. Consider the following value for formid: "' or ''='" Hopefully, any validation that might be present in an application would filter this kind of thing out. Otherwise the value of query becomes... "select password from table where userid like '" + \ "' or ''='" + \ "'" ...which becomes... "select password from table where userid like '' or ''=''" What this query will do is to select all passwords from the table. That's probably not what you want, unless you really want to allow users to retrieve other people's passwords. In any case, there are other situations where such statement manipulation will probably open large security holes. "Jekabs Andrushaitis" wrote: > >Most Python DB wrapper modules support "bind variables" in SQL (there >are some exceptions - for example PostgreSQL module which is part of >PostgreSQL distribution, but there are other PostgreSQL modules which >do support bind variables:) This is the "right answer". One must not get confused by the use of %s as a paremeter marker in the DB-API, however. It is possible to construct a statement using such notation, but remember that Python's % operator will not be used. Moreover, it will never be necessary to put quotes in the statement either (unless you're actually willing to hard-code certain constants, but even then it's hardly necessary or desirable). For example: # For pyPgSQL - where %s is the parameter marker: query = "select password from table where userid like %s" # For Sybase modules, typically: query = "select password from table where userid like ?" Now, with a cursor: # The second parameter is a sequence: cursor.execute(query, (formid,)) I hope this helps! Paul -- Get your firstname@lastname email at http://Nameplanet.com/?su From arthuralbano@hotmail.com Tue Mar 19 05:17:57 2002 From: arthuralbano@hotmail.com (Arthur Albano) Date: Tue, 19 Mar 2002 14:17:57 +0900 Subject: [DB-SIG] Beginner in troubles. Message-ID: Ignacio, MySQL is a database software. SQL(*2) is the acronym for 'Structured Query Language'. Therefore, SQL is a programming language. You can find various references to SQL history and usage(*2). Python(*3) is a programming language. An API (Application Program[ming] Interface) works like a 'glue' or a messenger (daemon): sends information from one side to another. In our case, sends information from Python to the SQL server, and may return a result back to Python. Like this: Python -> SQL Server -> Python The API is the arrows. I kindly ask to CC: your messages to [DB-SIG], so everybody can read and discuss. You're welcome, Arthur. "The sky is blue even for the blind when they want to see the light." Me *1 MySQL Website http://www.mysql.com/ *2 Yahoo - SQL http://dir.yahoo.com/Computers_and_Internet/Programming_and_Development/Languages/SQL/ *3 Python Website http://www.python.org/ Ignacio wrote: Arthur, Thank you very much for the tip. I'll start working on it right now. I have another question. what's the difference between SQL and MySQL? I've found SQL basic functions easy to work with. I suppose there are no big differences between both lenguages, are there? Thanks again. _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. From ig_laselva@hotmail.com Tue Mar 19 06:20:15 2002 From: ig_laselva@hotmail.com (Ignacio Guerrero) Date: Tue, 19 Mar 2002 03:20:15 -0300 Subject: [DB-SIG] Begginer getting out of troubles... I hope. Message-ID:

I want to thank you for your answers. They've been more than useful. But, as you know, an answer usually leads us to new questions.

I've already downloaded MySQL 4.0.1 and the MySQL - Python module. I'm working on the MySQL tutorial and it's quite clear.

What I don'r get is the module. There is not a Mysqldb.py module but a CompatMysqldb.py and a _mysql_exceptions.py modules in \Python22\Lib\site-packages. There are some __init__.py, connections.py,converters.py, cursors.py, sets.py and times.py modules in the \lib\site-packages\MySqldb folder.

I thought that the one I needed was CompatMysqldb.py module so I went to the interpreter and tried:

 

>>>import CompatMysqldb

>>>print CompatMysqldb.__doc__

 

It saids something about an older version of the module, blablablabla... but then there is an example which begins with:

import Mysqldb

So, what should I do? Should I rename the file? Is that the file I need? Did I download the wrong package?

I havn't got to it yet. I'm still bussy learning MySQL.

I really don't want to bother you with every single problem I step into and I would really preffer to read some document a thousand times until I get it but again, there is no documentation on this particular module, or may be there is but I didn't find it.

Anyone with a compass?

By the way, I'm preatty confortable with the english but if any of you wants to try spanish is welcome. Unless, of course, is necessary for all of you to read the answers.

Thank you.

Ignacio


Hable con sus amigos en línea, pruebe MSN Messenger: http://messenger.msn.es
From ig_laselva@hotmail.com Tue Mar 19 07:00:19 2002 From: ig_laselva@hotmail.com (Ignacio Guerrero) Date: Tue, 19 Mar 2002 04:00:19 -0300 Subject: [DB-SIG] Beginner getting out... Message-ID:


I just wanted to say that I've just found some documentation on the module. In fact I have downloaded a MySQL-python-0.9.1.tar.gz that differs with the MySQL-python-0.9.1.win32-py2.2.exe that I've already installed. This one (the tar.gz) comes with the HTML documentation.

Saddly I read in chapter 1.1 that "Windows is not a supported platform." But then it sais that it can be fixed, somehow.

I'll read it. If anything comes up I'll let you know.

Thanks again.

Ignacio


Con MSN Hotmail súmese al servicio de correo electrónico más grande del mundo. http://www.hotmail.com/ES
From andy47@halfcooked.com Tue Mar 19 09:57:06 2002 From: andy47@halfcooked.com (Andy Todd) Date: Tue, 19 Mar 2002 20:57:06 +1100 Subject: [DB-SIG] Beginner getting out... References: Message-ID: <3C970B72.9020107@halfcooked.com> Ignacio Guerrero wrote: > > I just wanted to say that I've just found some documentation on the > module. In fact I have downloaded a MySQL-python-0.9.1.tar.gz that > differs with the MySQL-python-0.9.1.win32-py2.2.exe that I've already > installed. This one (the tar.gz) comes with the HTML documentation. > > Saddly I read in chapter 1.1 that "Windows is /not/ a supported > platform." But then it sais that it can be fixed, somehow. > > I'll read it. If anything comes up I'll let you know. > > Thanks again. > > */Ignacio/* > > Ignacio, You want the MySQL-python-0.9.1.win32-py2.2.exe, not MySQL-python-0.9.1.tar.gz. The first one is pre-compiled windows self extracting executable which works on Windows. The other is the source code, useful only if you are on Unix, Linux, BSD or if you have Visual C for Windows. Regards, Andy -- ----------------------------------------------------------------------- From the desk of Andrew J Todd esq. "So I curtailed my Walpoling activities, sallied forth and infiltrated your place of purveyance to negotiate the vending of some cheesy comestibles." - Monty Python. From magnus@thinkware.se Tue Mar 19 10:53:40 2002 From: magnus@thinkware.se (Magnus =?iso-8859-1?Q?Lyck=E5?=) Date: Tue, 19 Mar 2002 11:53:40 +0100 Subject: [DB-SIG] Beginner in troubles. In-Reply-To: Message-ID: <5.1.0.14.0.20020319114024.00b86e50@mail.irrblosset.se> At 14:17 2002-03-19 +0900, Arthur Albano wrote: > MySQL is a database software. SQL(*2) is the acronym for 'Structured=20 > Query Language'. Therefore, SQL is a programming language. ... >Ignacio wrote: > I have another question. what's the difference between SQL and MySQL?=20 > I've found SQL basic functions easy to work with. I suppose there are no= =20 > big differences between both lenguages, are there? Well, to muddy the waters a bit... SQL is standard for programming languages. The MySQL system includes one implementation of that standard, which is not complete, but on the other hand contains a number of extensions. Neither a subset not a superset. A sideset you might say.. The same goes to some extent for all the RDBMS products such as Oracle, PostgreSQL, Sybase and MS SQL Server etc. So Ignacios question is relevant. Having said that I think a beginner can go on for quite a while without noticing a difference. But don't be surprised if some examples from a SQL tutorial won't work on MySQL. Notably, sub-selects are missing. So you will have to consult the specific MySQL documentation, but that's ok. MySQL is well documented. On the other hand, if you want your program to run also on other database engines without a lot of modifications, make sure that you don't use constructs that are not in the standard. Just because something works with MySQL doesn't mean that it will work with Oracle etc. But if you do it right, the same code might well work with a large number of database engines if you just change the import statement and the connect string. I use Martin Gruber's "SQL Instant Reference" to make sure that I'm always kosher. --=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 ig_laselva@hotmail.com Tue Mar 19 16:34:36 2002 From: ig_laselva@hotmail.com (Ignacio Guerrero) Date: Tue, 19 Mar 2002 13:34:36 -0300 Subject: [DB-SIG] Beginner getting out... Message-ID:

OK, so then I should keep on working with the one I've already installed on my computer: The win32-py2.2.exe.

But, Does the documentation coming with the other module applies to the one I'm using? The win32-py2.2.exe comes with no docs at all.




Ignacio
>From: Andy Todd
>To: Ignacio Guerrero
>CC: db-sig@python.org
>Subject: Re: [DB-SIG] Beginner getting out...
>Date: Tue, 19 Mar 2002 20:57:06 +1100
>
>Ignacio,
>
>You want the MySQL-python-0.9.1.win32-py2.2.exe, not
>MySQL-python-0.9.1.tar.gz. The first one is pre-compiled windows
>self
>extracting executable which works on Windows. The other is the
>source
>code, useful only if you are on Unix, Linux, BSD or if you have
>Visual C
>for Windows.
>
>Regards,
>Andy
>--
>-----------------------------------------------------------------------
>From the desk of Andrew J Todd esq.
>"So I curtailed my Walpoling activities, sallied forth and
>infiltrated
> your place of purveyance to negotiate the vending of some cheesy
> comestibles." - Monty Python.
>


Hable con sus amigos en línea, pruebe MSN Messenger: http://messenger.msn.es
From andy@dustman.net Tue Mar 19 16:40:13 2002 From: andy@dustman.net (Andy Dustman) Date: 19 Mar 2002 11:40:13 -0500 Subject: [DB-SIG] Beginner getting out... In-Reply-To: References: Message-ID: <1016556014.6748.3.camel@chef.neosouth.net> On Tue, 2002-03-19 at 02:00, Ignacio Guerrero wrote: I just wanted to say that I've just found some documentation on the module. In fact I have downloaded a MySQL-python-0.9.1.tar.gz that differs with the MySQL-python-0.9.1.win32-py2.2.exe that I've already installed. This one (the tar.gz) comes with the HTML documentation. Saddly I read in chapter 1.1 that "Windows is not a supported platform." But then it sais that it can be fixed, somehow. It's not supported but it does work on Windows. HTML mail, we hates it, we hatesss it. -- Andy Dustman PGP: 0x930B8AB6 @ .net http://dustman.net/andy You can have my keys when you pry them from my dead, cold neurons. From ig_laselva@hotmail.com Wed Mar 20 19:08:06 2002 From: ig_laselva@hotmail.com (Ignacio Guerrero) Date: Wed, 20 Mar 2002 16:08:06 -0300 Subject: [DB-SIG] Re:Beginner getting out... Message-ID: I want to apologize for the HTML mails I've been sending. There's a perfectly good explanation. I opened my Hotmail account because some friends of mine use its Messenger and, as I usually send my personal correspondence via Yahoo! mail, I decided to use this spare account to comunicate with the db-sig. I just wasn't aware that it was configured to send mails in HTML. I noticed it when I was looking for more information on the archives. My messages were full of tags. About my answers... It's my first time in a mail list and I thought it would be nice to thank individualy to all those who helped my. Now I know, I have to send every answer with a CC to dg-sig. You may not now it but you've became my teachers now, and I ment to be a good student. Andy, thanks for the tip, it won't happen again. And I do hate HTML mail too. Ignacio _________________________________________________________________ Con MSN Hotmail súmese al servicio de correo electrónico más grande del mundo. http://www.hotmail.com/ES From ig_laselva@hotmail.com Wed Mar 20 20:10:18 2002 From: ig_laselva@hotmail.com (Ignacio Guerrero) Date: Wed, 20 Mar 2002 17:10:18 -0300 Subject: [DB-SIG] Beginner getting out... Message-ID: At the risk of becoming a "Nonsense Threader" within the mail list I want to say something else. On my first answer to Arthur Albano I asked him what, I'm now aware, was a stupid question. I asked him the difference between SQL and MySQL. Marcus Lycka (sorry Marcus, I can't find the little circule that goes over the "a") tried to, mercifully, cover my misstake by stating that my question wasn't relevant (thanks for that). Truth is, it was a stupid question. I hadn't even looked for an SQL nor MySQL FAQ. Anyway, I still can't make run my script, and that's because I don't know how to add the Mysqldb module to it. I'm just trying to do a simple (I believe) thing. To check whether a user and his password are in a table or not. My script so far goes like this... comments are in spanish, uncomplete and is full of errors and bugs (I know... I'll fix them). Just try to get the picture: ####################################################################### # Módulo: passig.py # Creado: 15-03-2002, por Ignacio Guerrero. ####################################################################### # Función: Este módulo permite registrar nuevos usuarios y sus # contraseñas o verificar los datos de usuarios existentes. # ####################################################################### import sys, string from Tkinter import * ######### Definición de funciones ######################################## class rastUsr: "Verifica y, en caso de ser nuevo, Registra, identidad y clave de usuario" def confirmar(indicador, intentos=4, queja='Si o No'): # ¡Gracias, Guido Van Rossum! "Confirma con SI o con NO" while 1: respuesta = raw_input(indicador) if respuesta in ('s', 'si', 'sí', 'S', 'Si', 'Sí', 'SI'): return 1 if respuesta in ('n', 'no', 'nanay', 'nasti'): return 0 intentos = intentos - 1 if intentos < 0: raise IOError, 'Usuario rechazado' print queja def nuevoUsuario(id): "Ingresa nuevo nombre de usuario" usuario = raw_input(id) return usuario def nuevaClave(preg, repreg, nocomputa = 4, error = 'Las claves ingresadas difieren'): #Funciona "ingresa y confirma nueva clave de usuario" while clave == valid: clave = raw_input(preg) valid = raw_input(repreg) if clave != valid: print "Claves difieren" return clave def ingreseUsuario(id): "Ingresa nombre de usuario existente" usuario = raw_input(id) return usuario def ingreseClave(preg): "ingresa clave de usuario existente" clave = raw_input(preg) return clave def verificarId(usr, pwd): #Revisado, funciona bien. "Verifica si los datos ingresados están en el fichero" file = open('D:\\Programaci\363n\\misModulos\\passig.txt','r') while 1: x = file.readline() import string xdata = string.split(x,',') if xdata[0] == usr and xdata[1] == pwd: return 1 if xdata[0] == usr and xdata[1] != pwd: return 2 if xdata == ['']: file.close() return 0 def escribirId(usr,pwd): file = open('D:\\Programaci\363n\\misModulos\\passig.txt','a') datus = usr + ',' + pwd file.write(datus) file.close() def registrarUsuario(preg): datos = raw_input(preg) return datos ######### Ejecución de Módulo ################################################### def __init__(self) verif = self.confirmar(" ¿Nuevo usuario? (S/N)") if verif == 1: while verusr != 0: regu = self.nuevoUsuario(" Elija su nombre de usuario: ") regp = self.nuevaClave(" Ingrese su nueva contraseña: "," Reingrese su contraseña: ") verusr = self.verificarId(regu, regp) return verusr self.escribirId(datos) if verif == 0: usr = self.ingreseUsuario(" Ingrese su nombre de usuario: ") pwd = self.ingreseClave(" Ingrese contraseña: ") print "Bienbenido", usr ---------------------------------------------------------------------- Please, don't waste your time trying to fix it. I'll figure that out later. Just give my an example (a simple one) of how to connect with MySQL and add something to a table. That would do. Once I get the idea I'll see how to retrieve, modify, etc. Thank you. Ignacio _________________________________________________________________ MSN Photos es la manera más sencilla de compartir e imprimir sus fotos: http://photos.latam.msn.com/Support/WorldWide.aspx From paulturcotte@bbg.org Wed Mar 20 20:16:22 2002 From: paulturcotte@bbg.org (Turcotte, Paul) Date: Wed, 20 Mar 2002 15:16:22 -0500 Subject: [DB-SIG] Beginner getting out... Message-ID: <951DC0D57185D311B88B00A0C9E9258D80110B@MIDNIGHT> > Just give my an example (a simple one) of how to connect with MySQL and add > something to a table. That would do. Once I get the idea I'll see how to > retrieve, modify, etc. This FAQ may help you get started. http://dustman.net/andy/python/MySQLdb_obsolete/faq/MySQLdb-FAQ-3.html >From FAQ: Okay, it goes something like this: 1. Import MySQLdb. 2. Create a Connection object. 3. Create a Cursor object. 4. Execute your query on the Cursor object. 5. If your query returns rows, you can use the Cursor object to fetch them. 6. Rinse, lather, repeat. Example: import MySQLdb db = MySQLdb.connect(db='mydb',user='myuser',passwd='mypasswd') c = db.cursor() c.execute(myquery) results = c.fetchall() Suerte, PT From andy@dustman.net Wed Mar 20 21:10:51 2002 From: andy@dustman.net (Andy Dustman) Date: 20 Mar 2002 16:10:51 -0500 Subject: [DB-SIG] DB-API Tutorial Session at OSCon In-Reply-To: <951DC0D57185D311B88B00A0C9E9258D80110B@MIDNIGHT> References: <951DC0D57185D311B88B00A0C9E9258D80110B@MIDNIGHT> Message-ID: <1016658652.7575.7.camel@chef.neosouth.net> On Wed, 2002-03-20 at 15:16, Turcotte, Paul wrote: > > > Just give my an example (a simple one) of how to connect with MySQL and > add > > something to a table. That would do. Once I get the idea I'll see how to > > retrieve, modify, etc. > > > This FAQ may help you get started. > > http://dustman.net/andy/python/MySQLdb_obsolete/faq/MySQLdb-FAQ-3.html I'll take this opportunity to mention that I'm giving a 3-hr tutorial on the Python DB-API (mostly using MySQLdb) at OSCon (San Diego, CA) in July. http://conferences.oreillynet.com/os2002/ If you have any points that you think ought to be covered, please let me know off-list. Also, I invite any interested parties to give me money by visiting my web site (http://dustman.net/andy) and putting a large dollar amount in the field labeled "Gimme some money". -- Andy Dustman PGP: 0x930B8AB6 @ .net http://dustman.net/andy You can have my keys when you pry them from my dead, cold neurons. From andy47@halfcooked.com Wed Mar 20 23:32:49 2002 From: andy47@halfcooked.com (Andy Todd) Date: Thu, 21 Mar 2002 10:32:49 +1100 Subject: [DB-SIG] Beginner getting out... References: <951DC0D57185D311B88B00A0C9E9258D80110B@MIDNIGHT> Message-ID: <3C991C21.4080606@halfcooked.com> Turcotte, Paul wrote: >>Just give my an example (a simple one) of how to connect with MySQL and > > add > >>something to a table. That would do. Once I get the idea I'll see how to >>retrieve, modify, etc. > > > > This FAQ may help you get started. > > http://dustman.net/andy/python/MySQLdb_obsolete/faq/MySQLdb-FAQ-3.html > >>From FAQ: > > > > Okay, it goes something like this: > > 1. Import MySQLdb. > 2. Create a Connection object. > 3. Create a Cursor object. > 4. Execute your query on the Cursor object. > 5. If your query returns rows, you can use the Cursor object to fetch > them. > 6. Rinse, lather, repeat. > > Example: > > import MySQLdb > db = MySQLdb.connect(db='mydb',user='myuser',passwd='mypasswd') > c = db.cursor() > c.execute(myquery) > results = c.fetchall() > > > > Suerte, > PT > And don't forget that 'myquery' in the above example must contain a valid SQL statement. e.g, with a vanilla MySQL installation on Windows; >>> import MySQLdb >>> db = MySQLDb.connect(db='mysql') >>> c = db.cursor() >>> myquery = "SELECT * FROM user" >>> c.execute(myquery) 5L >>> results = c.fetchall() >>> results (('localhost', 'root', '', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', ... And it is always good practice to close a cursor when you are done with it; >>> c.close() Regards, Andy -- ---------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com From ig_laselva@hotmail.com Thu Mar 21 22:14:35 2002 From: ig_laselva@hotmail.com (Ignacio Guerrero) Date: Thu, 21 Mar 2002 19:14:35 -0300 Subject: [DB-SIG] Beginner's last words Message-ID: Andy: (I really don't know if I should address to you as Andy or Mr Dustman but, as everyone in this mail list addresses everyone else by their first name...) I've been looking, in many different ways, for a solution to my problem. I believe I may not been enterelly clear, so I'll try to put it in a different way: I downloaded two versions of the same module: - MySQL-python-0.9.1.tar.gz: This one, I've been told, is NOT the one I need but, has its own HTML documentation. - MySQL-python-0.9.1.win32-py2.2.exe: This is the one I installed on my computer. It's ment to work on "case-insensitive brain-dead operating systems" which I agree. It has no HTML documentation so I looked for the comments in the module. The module is called CompatMysqldb.py and this are its comments: """ Original author: James Henstridge Adapted by: Andy Dustman This is the original Mysqldb.py module which came with MySQLmodule-1.4, only it has been adapted to use _mysql instead MySQL. It is intended for backwards compatibility purposes only. But as a bonus, transactions will work if your database server and table types support them. It is called CompatMysqldb instead of Mysqldb so as not to interfere with an existing Mysqldb, or MySQLdb on case-insensitive brain-dead operating systems. Under no circumstances should you bug James Henstridge about this!!! ----- This is a class that implements an interface to mySQL databases, conforming to the API published by the Python db-sig at http://www.python.org/sigs/db-sig/DatabaseAPI.html It is really just a wrapper for an older python interface to mySQL databases called mySQL, which I modified to facilitate use of a cursor. That module was Joseph Skinner's port of the mSQL module by David Gibson, which was a modified version of Anthony Baxter's msql module. As an example, to add some extra (unprivelledged) users to your database system, and delete them again: >>>import Mysqldb >>>conn = Mysqldb.mysqldb('mysql@localhost root rootpasswd') >>>curs = conn.cursor() >>>curs.execute("insert into user (host, user) values ('%s', '%s')", ... [('localhost', 'linus'), ('somewhere.com.au', 'james')]) 2 >>>curs.execute("select * from user") >>>curs.fetchall() -- record listing -- >>>curs.execute("delete from user where host = 'somewhere.com.au' or user = >>>'linus'") 2 >>>curs.close() >>>conn.close() The argument to mysqldb.mysqldb is of the form 'db@host user pass', 'db@host user', 'db@host', 'db', 'db user pass' or 'db user'. As always, the source is a good manual :-) James Henstridge """ This may look cristal clear to everyone else but me. You see, the example states: >>>import Mysqldb But not just the example. The lines that follow the example go like this: import _mysql MySQL = _mysql from string import upper, split, join error = 'mysqldb.error' from MySQLdb.constants import FIELD_TYPE _type_conv = { FIELD_TYPE.TINY: int, FIELD_TYPE.SHORT: int, FIELD_TYPE.LONG: long, FIELD_TYPE.FLOAT: float, FIELD_TYPE.DOUBLE: float, FIELD_TYPE.LONGLONG: long, FIELD_TYPE.INT24: int, FIELD_TYPE.YEAR: int } Furthermore, I reciebed answers to my previous question by Andy Todd and Paul Turcotte. They give me, as I requested, some examples: Paul Turcotte said: > 1. Import MySQLdb. 2. Create a Connection object. 3. Create a Cursor >object. 4. Execute your query on the Cursor object. 5. If your query >returns rows, you can use the Cursor object to fetch them. 6. Rinse, >lather, repeat. > >Example: > >import MySQLdb db = >MySQLdb.connect(db='mydb',user='myuser',passwd='mypasswd') c = db.cursor() >c.execute(myquery) results = c.fetchall() > > > >Suerte, PT and Andy Todd said: >And don't forget that 'myquery' in the above example must contain a valid >SQL statement. > >e.g, with a vanilla MySQL installation on Windows; > >>>import MySQLdb db = MySQLDb.connect(db='mysql') c = db.cursor() myquery = >>>"SELECT * FROM user" c.execute(myquery) 5L results = c.fetchall() results >(('localhost', 'root', '', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', ... > >And it is always good practice to close a cursor when you are done with it; > >>>c.close() > >Regards, Andy Finally, this is the log file of the module installation: *** Installation started 2002/03/18 17:19 *** Source: D:\MIS DOCUMENTOS\MYSQL-PYTHON-0.9.1.WIN32-PY2.2.EXE 020 Reg DB Key: [Software\Microsoft\Windows\CurrentVersion\Uninstall]MySQL-python-py2.2 040 Reg DB Value: [Software\Microsoft\Windows\CurrentVersion\Uninstall]DisplayName=Python 2.2 MySQL-python-0.9.1 040 Reg DB Value: [Software\Microsoft\Windows\CurrentVersion\Uninstall]UninstallString="D:\PROGRA~1\PYTHON22\RemoveMySQL-python.exe" -u "D:\PROGRA~1\PYTHON22\MySQL-python-wininst.log" 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\CompatMysqldb.py 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\_mysql_exceptions.py 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\_mysql.pyd 100 Made Dir: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\__init__.py 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\converters.py 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\connections.py 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\cursors.py 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\sets.py 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\times.py 100 Made Dir: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\__init__.py 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\CR.py 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\FIELD_TYPE.py 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\ER.py 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\FLAG.py 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\REFRESH.py 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\CLIENT.py 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\CLIENT.pyc 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\REFRESH.pyc 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\FLAG.pyc 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\ER.pyc 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\FIELD_TYPE.pyc 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\CR.pyc 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\__init__.pyc 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\times.pyc 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\sets.pyc 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\cursors.pyc 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\connections.pyc 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\converters.pyc 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\__init__.pyc 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\_mysql_exceptions.pyc 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\CompatMysqldb.pyc 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\CLIENT.pyo 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\REFRESH.pyo 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\FLAG.pyo 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\ER.pyo 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\FIELD_TYPE.pyo 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\CR.pyo 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\constants\__init__.pyo 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\times.pyo 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\sets.pyo 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\cursors.pyo 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\connections.pyo 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\converters.pyo 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\MySQLdb\__init__.pyo 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\_mysql_exceptions.pyo 200 File Copy: D:\PROGRA~1\PYTHON22\Lib\site-packages\CompatMysqldb.pyo *** Installation finished 2002/03/18 17:19 *** I hope you see my problem, there is not such a module called Mysqldb.py nor MySQLdb.py so: - Should I use this CompatMysqldb.py module instead of the Mysqldb.py that I've been told to use? or... - Should I Rename this CompatMysqldb.py module to Mysqldb.py? or... - Is it posible that the main module is missing? I'm really starting to feel very stupid, which I believe I'm not, and I don't feel confortable by wasting your time. I tryed to analize the code but I got seasick. I looked for the proper documentation but everything I founded seems NOT to applie to the module I have. So, what is the name of the module I should import to my script? I guess it's not Mysqldb.py because such module didn't come whitin the package. Thank you for your time and patience. Sincerelly, Ignacio Guerrero _________________________________________________________________ Descargue GRATUITAMENTE MSN Explorer en http://explorer.yupimsn.com/intl.asp From andy@dustman.net Thu Mar 21 22:48:05 2002 From: andy@dustman.net (Andy Dustman) Date: 21 Mar 2002 17:48:05 -0500 Subject: [DB-SIG] Beginner's last words In-Reply-To: References: Message-ID: <1016750885.13838.27.camel@chef.neosouth.net> On Thu, 2002-03-21 at 17:14, Ignacio Guerrero wrote: > Andy: (I really don't know if I should address to you as Andy or Mr Dustman > but, as everyone in this mail list addresses everyone else by their first > name...) > > I've been looking, in many different ways, for a solution to my problem. I > believe I may not been enterelly clear, so I'll try to put it in a different > way: > > I downloaded two versions of the same module: > > - MySQL-python-0.9.1.tar.gz: This one, I've been told, is NOT the one I need > but, has its own HTML documentation. Yes, this is the source distribution, and unless you have a C compiler (not common on Windows machines), you can't compile the _mysql module. However, the documentation is perfectly good. > - MySQL-python-0.9.1.win32-py2.2.exe: This is the one I installed on my > computer. It's ment to work on "case-insensitive brain-dead operating > systems" which I agree. It has no HTML documentation so I looked for the > comments in the module. The module is called CompatMysqldb.py and this are > its comments: You probably don't want to use this module. You have a couple of options: 1) Use the HTML docs from the source distribution. 2) Use the online docs: http://sourceforge.net/docman/?group_id=22307 3) Use pydoc. Not sure how you would invoke pydoc as a separate program on windows, or if it would work, but you can do this in Python 2.2: >>> import MySQLdb >>> help(MySQLdb) No examples that I recall in the built-in documentation, but the HTML documentation certainly does. Also, the reason you see no MySQLdb.py is because MySQLdb is a Python package, i.e. it's a directory with an __init__.py file in it. -- Andy Dustman PGP: 0x930B8AB6 @ .net http://dustman.net/andy You can have my keys when you pry them from my dead, cold neurons. From ig_laselva@hotmail.com Thu Mar 21 23:19:42 2002 From: ig_laselva@hotmail.com (Ignacio Guerrero) Date: Thu, 21 Mar 2002 20:19:42 -0300 Subject: [DB-SIG] Stubborn's apology Message-ID: I believe I owe you all an apology. Arthur Albano, Andy Todd, Marcus Lycka, Paul Turcotte and Andy Dustman tryed to show me the way to solve my beginner's problem. They told me to use: >>>import MySQLdb But I kept on replying that I hadn't have that module. Well, I opened the Python Interpreter and write what Andy Todd told me to write... >>>import MySQLdb db = MySQLDb.connect(db='mysql') c = db.cursor() myquery = >>>"SELECT * FROM user" c.execute(myquery) 5L >>>results = c.fetchall() results (('localhost', 'root', '', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', ... ... and, surprise, it worked. I still don't know where that MySQLdb came from but, evidently, it's there. So, I'm sorry. I should have trust you. I read somewhere that "Ignacio" means exactly that: Stubborn. That name REALLY fits me. Ignacio "Want to teach me? Bring your hammer." _________________________________________________________________ Con MSN Hotmail súmese al servicio de correo electrónico más grande del mundo. http://www.hotmail.com/ES From olc@openlearningcommunity.org Sat Mar 23 01:23:02 2002 From: olc@openlearningcommunity.org (Michael Hall) Date: Sat, 23 Mar 2002 10:53:02 +0930 (CST) Subject: [DB-SIG] MySQL Message-ID: G'day All: I've been writing PHP/MySQL for a couple of years now and am now cross-skilling into Perl and Python. I'm interested in web database integration for Python CGI scripts. Is this the right list for general questions about using the MySQLdb module? If so: I have installed the MySQLdb module but find the docs pretty sparse. Can anyone suggest a good tutorial that demonstrates the basic moves in extracting and printing data using MySQLdb? If not: Where do I go? Thanks Mick ----------------------------- Michael Hall mick@ninti.com ----------------------------- From djc@object-craft.com.au Sat Mar 23 05:18:49 2002 From: djc@object-craft.com.au (Dave Cole) Date: 23 Mar 2002 16:18:49 +1100 Subject: [DB-SIG] Python Sybase mailing list released In-Reply-To: References: Message-ID: What is it: The python-sybase mailing list is a list where users of the Sybase module for Python can discuss issues concerning the module. Since the person who wrote the Sybase module is a hopeless joke who only has access to the Linux platform and knows less than all of the module users, the list is a good place for modules users to discuss platform issues at the very least. Where is it: https://www.object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase - Dave -- http://www.object-craft.com.au From djc@object-craft.com.au Sat Mar 23 06:38:27 2002 From: djc@object-craft.com.au (Dave Cole) Date: 23 Mar 2002 17:38:27 +1100 Subject: [DB-SIG] Sybase module 0.34 released In-Reply-To: References: Message-ID: What is it: The Sybase module provides a Python interface to the Sybase relational database system. It supports all of the Python Database API, version 2.0 with extensions. This is mostly a bug fix release. 1) Cursor state machine fix from Phillip J. Eby. 2) Fix for MS compiler reported by Roberto M Esguerra. 3) Added CS_IFILE option to ct_config() for Erik A. Dahl. The module is available here: http://www.object-craft.com.au/projects/sybase/sybase-0.34.tar.gz The mailing list for discussing the module is here: https://www.object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase The module home page is here: http://www.object-craft.com.au/projects/sybase/ - Dave -- http://www.object-craft.com.au From ig_laselva@hotmail.com Wed Mar 27 03:38:37 2002 From: ig_laselva@hotmail.com (Ignacio Guerrero) Date: Wed, 27 Mar 2002 00:38:37 -0300 Subject: [DB-SIG] More questions from a stubborn beginner. Message-ID: Hi there!, OK, I have a few questions. I've been practicing MySQL, It's a little bit complex than I thought. - Can anyone tell me the difference between PRIMARY_KEY, KEY and INDEX? - Suppose I want a row to show only fixed data like, for instance, ('LivingRoom', 'BathRoom', 'BedRoom', 'Kitchen', 'Garage'). Should I use SET or is there another way? A Tough one: I've almost finished my little program. Remember? The one that prompt you for a User ID and a Password. Let's say I want to send a copy of the program to a friend so he can try it, or that I decided to distribute it. I have Python and MySQL installed on my computer, but my friend (or mostly anyone who downloads the program) hasn't. My script weights 5 Kb and the table I use shouldn't weight more than 20 Kb. I have the py2exe module installed but I haven't tried it yet. - So, in general terms, how could I distribute this program without other people having to install Python and MySQL? Thank you, Ignacio _________________________________________________________________ Con MSN Hotmail súmese al servicio de correo electrónico más grande del mundo. http://www.hotmail.com/ES From andy@dustman.net Wed Mar 27 04:48:03 2002 From: andy@dustman.net (Andy Dustman) Date: 26 Mar 2002 23:48:03 -0500 Subject: [DB-SIG] More questions from a stubborn beginner. In-Reply-To: References: Message-ID: <1017204484.31846.10.camel@chef.neosouth.net> On Tue, 2002-03-26 at 22:38, Ignacio Guerrero wrote: > - Can anyone tell me the difference between PRIMARY_KEY, KEY and INDEX? Well, obviously they are all indexes. PRIMARY KEY is generally going to be the fastest type of index. It also must be UNIQUE and NOT NULL. Other types of INDEX don't have to be UNIQUE or NOT NULL. The PRIMARY KEY is also the default used by REFERENCES . Recent versions of MySQL with InnoDB tables support foreign key references. > - Suppose I want a row to show only fixed data like, for instance, > ('LivingRoom', 'BathRoom', 'BedRoom', 'Kitchen', 'Garage'). Should I use SET > or is there another way? You may want ENUM instead of SET; SET allows you to indicate multiple values for a given row. Another way to do it (more standard, more expandable) is to create a RoomTypes table and ensure that the column matches an existing room type. > - So, in general terms, how could I distribute this program without other > people having to install Python and MySQL? You don't, or at least not very easily. py2exe will produce a large executable, and may not even work, due to the required shared libraries. -- Andy Dustman PGP: 0x930B8AB6 @ .net http://dustman.net/andy You can have my keys when you pry them from my dead, cold neurons. From multimediatik@hotmail.com Wed Mar 27 05:02:56 2002 From: multimediatik@hotmail.com (God) Date: Wed, 27 Mar 2002 00:02:56 -0500 Subject: [DB-SIG] Bonjour! Message-ID: Bonjour db-sig@python.org La vie est étrange, pleine de surprise... si cela vous intrigue, répondez à multimediatik@hotmail.com Bonne Journée ____________________________________ This message was sent by the originator using trial software ____________________________________ From magnus@thinkware.se Wed Mar 27 10:53:54 2002 From: magnus@thinkware.se (Magnus =?iso-8859-1?Q?Lyck=E5?=) Date: Wed, 27 Mar 2002 11:53:54 +0100 Subject: [DB-SIG] More questions from a stubborn beginner. In-Reply-To: Message-ID: <5.1.0.14.0.20020327111058.02ad0e48@mail.irrblosset.se> At 00:38 2002-03-27 -0300, Ignacio Guerrero wrote: >Hi there!, > >OK, I have a few questions. I've been practicing MySQL, It's a little bit= =20 >complex than I thought. > >- Can anyone tell me the difference between PRIMARY_KEY, KEY and INDEX? A key is any column or combination of columns that will be enough to identify any row. I.e. if a column can have the same value for several rows, it's not a key. For instance if you have a table with data about cars, both REGISTRATION_NUMBER and CHASSIS_NUMBER will be primary keys. A primary key is a key that you have chosen to be the primary key. (Perhaps CHASSIS_NUMBER in this case.) An index is a construct which can either be used to enforce non-primary keys (unique index) or just to speed up database searches. (In the above case you would make a unique index on the other key (REGIST- RATION_NUMBER).) Please note that some SQL databases don't actaully use the primary key statement in CREATE TABLE for anything useful, so you might need to CREATE UNIQUE INDEX for your primary key as well. Or is this just a problem of the past? I've written a little about relational databases at: http://www.thinkware.se/cgi-bin/thinki.cgi/RelationalDatabase >- Suppose I want a row to show only fixed data like, for instance,=20 >('LivingRoom', 'BathRoom', 'BedRoom', 'Kitchen', 'Garage'). Should I use=20 >SET or is there another way? Are we talking about a data type called SET? That doesn't exixt in my SQL book at least. Unless it appeared in a standard after SQL 92 it's a MySQL extension. The normal SQL solution is to have a table for these data. A table is a SET! The whole relational algebra and calculus is based on set theory. A table is also much easier to change than a data type. Just make a table for the room types with just one column, and use foreign keys to that table wherever you need room types: See 3.5.6 Using Foreign Keys in the MySQL manual. >- So, in general terms, how could I distribute this program without other= =20 >people having to install Python and MySQL? with py2exe or McMillan installer they won't have to install Python, but they will have to install MySQL. I suppose you could use a normal windows installer program such as InstallShield to make your own custom installation that will install everything you need in one package. But that seems like over- doing it to me. If you want a simpler installation, you might use the Python SQL engine "gadfly" instead. I've never used that though, so I can't help you with details. Note the gadfly is far from a full fledged SQL engine. I don't think it has foreign key constraints for instance. --=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 andy@dustman.net Thu Mar 28 00:46:05 2002 From: andy@dustman.net (Andy Dustman) Date: 27 Mar 2002 19:46:05 -0500 Subject: [DB-SIG] Update of the DB API 2.0 Spec In-Reply-To: <3C5F0F16.31F12D17@lemburg.com> References: <3C5F0F16.31F12D17@lemburg.com> Message-ID: <1017276365.32613.12.camel@chef.neosouth.net> On Mon, 2002-02-04 at 17:45, M.-A. Lemburg wrote: > As promised, I've integrated the optional DB API extension > definition we talked about the last few months into the > DB API PEP 0249: > > http://python.sourceforge.net/peps/pep-0249.html One thing I wish I had thought of three months ago is putting paramstyle on the database connection... -- Andy Dustman PGP: 0x930B8AB6 @ .net http://dustman.net/andy You can have my keys when you pry them from my dead, cold neurons. From hbl@st-andrews.ac.uk Thu Mar 28 12:36:44 2002 From: hbl@st-andrews.ac.uk (Hamish Lawson) Date: Thu, 28 Mar 2002 12:36:44 +0000 Subject: [DB-SIG] Porting a Postgres Python library to Ingres? Message-ID: <3CA30E5C.9288D496@st-andrews.ac.uk> I need a Python module for Ingres. The only one I have found is at http://www.informatik.uni-rostock.de/~hme/software/ However it claims a thread safety of only 0, and I think it may need some development in other areas. Therefore I was wondering how feasible it would be to port one of the Postgres Python libraries (pgdb, psycopg or PyPgSQL) to Ingres; I'm hoping that the historical relationship between Ingres and Postgres means that there will be some similarity in the C API (does anyone know if this is so?). Hamish Lawson From hme@informatik.uni-rostock.de Thu Mar 28 13:30:06 2002 From: hme@informatik.uni-rostock.de (hme@informatik.uni-rostock.de) Date: Thu, 28 Mar 2002 14:30:06 +0100 Subject: [DB-SIG] Porting a Postgres Python library to Ingres? In-Reply-To: <3CA30E5C.9288D496@st-andrews.ac.uk>; from hbl@st-andrews.ac.uk on Thu, Mar 28, 2002 at 12:36:44PM +0000 References: <3CA30E5C.9288D496@st-andrews.ac.uk> Message-ID: <20020328143006.A16522@informatik.uni-rostock.de> Hello Hamish, You (Hamish Lawson) wrote: > I need a Python module for Ingres. The only one I have found is at > > http://www.informatik.uni-rostock.de/~hme/software/ > > However it claims a thread safety of only 0, This means I didn't care about thread safety up to now. I think, my code (ingmod.ec) can easily be converted into thread safe code but I'm not sure about the Ingres runtime library and thread safety, e.g. the IISQLCA structure is static and the handling seems to be not thread safe. The first time thread safety was mentioned in the ESQL for C manual was in Version 2.0 of OpenIngres. So all the embedded SQL statements have to be put in a ciritcal region. This will be the case in the next version of my ingmod Module. > and I think it may need > some development in other areas. Which other areas You are refering to? Maybe I'm working on it? Due to heavy workload (book project) I didn't published a new version but there were several bug fixes, enhancements ... in the last year. > Therefore I was wondering how feasible > it would be to port one of the Postgres Python libraries (pgdb, psycopg > or PyPgSQL) to Ingres; I'm hoping that the historical relationship > between Ingres and Postgres means that there will be some similarity in > the C API (does anyone know if this is so?). AFAIK, even UCB Ingres and UCB Postgres didn't share any piece of code. I'll hope to have the new [thread safe] version out end of April. I'll let You know by email. Peace Holger -- Holger Meyer, Uni of Rostock, Dpt. of CS, DB Research Group hm at IEEE.org, http://wwwdb.informatik.uni-rostock.de/ From fog@debian.org Thu Mar 28 13:53:33 2002 From: fog@debian.org (Federico Di Gregorio) Date: 28 Mar 2002 14:53:33 +0100 Subject: [DB-SIG] Porting a Postgres Python library to Ingres? In-Reply-To: <3CA30E5C.9288D496@st-andrews.ac.uk> References: <3CA30E5C.9288D496@st-andrews.ac.uk> Message-ID: <1017323614.847.30.camel@nenya> --=-fRWHAClGGAkY4kjdXvxd Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Il gio, 2002-03-28 alle 13:36, Hamish Lawson ha scritto: > I need a Python module for Ingres. The only one I have found is at > =20 > http://www.informatik.uni-rostock.de/~hme/software/ >=20 > However it claims a thread safety of only 0, and I think it may need > some development in other areas. Therefore I was wondering how feasible > it would be to port one of the Postgres Python libraries (pgdb, psycopg > or PyPgSQL) to Ingres; I'm hoping that the historical relationship > between Ingres and Postgres means that there will be some similarity in > the C API (does anyone know if this is so?). psycopg is enginered quite well and all the calls to the database use only 5-10 functions from libpq. i think should be quite easy to wrap them in code that converts from ingres api to postgres one. type casting of the result may require some more work though. --=20 Federico Di Gregorio Debian GNU/Linux Developer & Italian Press Contact fog@debian.org INIT.D Developer fog@initd.org 99.99999999999999999999% still isn't 100% but sometimes suffice. -- Me --=-fRWHAClGGAkY4kjdXvxd Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: Per informazioni si veda http://www.gnupg.org iEYEABECAAYFAjyjIF0ACgkQvcCgrgZGjevBawCfY1dEv4u7Hs/nzeS4loM+X9YZ DAEAoMo0E9PNHxQpw2Rpz9QDTWKMfHze =osjA -----END PGP SIGNATURE----- --=-fRWHAClGGAkY4kjdXvxd-- From hbl@st-andrews.ac.uk Thu Mar 28 16:08:48 2002 From: hbl@st-andrews.ac.uk (Hamish Lawson) Date: Thu, 28 Mar 2002 16:08:48 +0000 Subject: [DB-SIG] Porting a Postgres Python library to Ingres? References: <3CA30E5C.9288D496@st-andrews.ac.uk> <20020328143006.A16522@informatik.uni-rostock.de> Message-ID: <3CA34010.B90B3866@st-andrews.ac.uk> Hello Holger! Firstly, thanks for making your ingmod module available, which I have been using for some time now. > I think, my code (ingmod.ec) can easily be converted into thread safe code > I'll hope to have the new [thread safe] version out end of April. That is good news! I look forward to it. > I'll let You know by email. Thank you. > > I think it may need some development in other areas. > > Which other areas You are refering to? Maybe I'm working on it? Due > to heavy workload (book project) I didn't published a new version but > there were several bug fixes, enhancements ... in the last year. I wasn't sure if you were still developing ingmod, which is why I was looking at other options. There were a couple of issues I had found. The MAXCURSPERSESSION limit appears to be a limit on how many cursors can get allocated, not just a limit on how many can be open at the same time; that is, successively allocating and then closing a cursor will cause the limit to be exceed after MAXCURSPERSESSION times. See listing 1 below. Under Python 2.2 (including 2.2.1c2), attempting to iterate through cursor.description sometimes causes a "tuple index out of range" error. One such occasion is running the ingtest.py script that comes with ingmod; see listing 2 below. Might this be related to the new iterator protocol introduced in Python 2.2? > AFAIK, even UCB Ingres and UCB Postgres didn't share any piece of code. I thought it possible that they might not share much actual code, but do you also think that the application programming interface is different too? Regards, Hamish --------- LISTING 1 --------- >>> import ingmod >>> conn = ingmod.connect('iidbdb') >>> for i in range(20): ... cursor = conn.cursor() ... cursor.execute("select * from ingres_access_requests") ... cursor.close() ... print i ... 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Traceback (most recent call last): File "", line 2, in ? ingmod.OperationalError: max # of cursors per session reached --------- LISTING 2 --------- ... ('attver_dropped', , None, 2, None, None, 0) ('attval_from', , None, 2, None, None, 0) ('attfree', , None, 24, None, None, 0) Traceback (most recent call last): File "ingtest.py", line 86, in ? for t in cu.description: IndexError: tuple index out of range From hme@informatik.uni-rostock.de Thu Mar 28 18:49:14 2002 From: hme@informatik.uni-rostock.de (hme@informatik.uni-rostock.de) Date: Thu, 28 Mar 2002 19:49:14 +0100 Subject: [DB-SIG] Porting a Postgres Python library to Ingres? In-Reply-To: <3CA34010.B90B3866@st-andrews.ac.uk> References: <3CA30E5C.9288D496@st-andrews.ac.uk> <20020328143006.A16522@informatik.uni-rostock.de> <3CA34010.B90B3866@st-andrews.ac.uk> Message-ID: <20020328184914.GA10921@informatik.uni-rostock.de> Hello Hamish, You (Hamish Lawson) wrote: [...] > > I'll let You know by email. > > Thank you. > > > > I think it may need some development in other areas. > > > > Which other areas You are refering to? Maybe I'm working on it? Due > > to heavy workload (book project) I didn't published a new version but > > there were several bug fixes, enhancements ... in the last year. > > I wasn't sure if you were still developing ingmod, which is why I was > looking at other options. There were a couple of issues I had found. > > The MAXCURSPERSESSION limit appears to be a limit on how many cursors > can get allocated, not just a limit on how many can be open at the same > time; that is, successively allocating and then closing a cursor will > cause the limit to be exceed after MAXCURSPERSESSION times. See listing > 1 below. That's right. > Under Python 2.2 (including 2.2.1c2), attempting to iterate through > cursor.description sometimes causes a "tuple index out of range" error. Another user of ingmod reported that too. > One such occasion is running the ingtest.py script that comes with > ingmod; see listing 2 below. Might this be related to the new iterator > protocol introduced in Python 2.2? Yes, You are right. Since I didn't compile ingmod under 2.2, I was not aware of that up to now. > > AFAIK, even UCB Ingres and UCB Postgres didn't share any piece of code. > > I thought it possible that they might not share much actual code, but do > you also think that the application programming interface is different > too? > > Regards, > Hamish > > > --------- > LISTING 1 > --------- > >>> import ingmod > >>> conn = ingmod.connect('iidbdb') > >>> for i in range(20): > ... cursor = conn.cursor() > ... cursor.execute("select * from ingres_access_requests") > ... cursor.close() > ... print i > ... > 0 > 1 > 2 > 3 > 4 > 5 > 6 > 7 > 8 > 9 > 10 > 11 > 12 > 13 > 14 > 15 > Traceback (most recent call last): > File "", line 2, in ? > ingmod.OperationalError: max # of cursors per session reached > --------- I have to re-design the cursor allocation to fix that, but it is not an expensive job. > LISTING 2 > --------- > ... > ('attver_dropped', , None, 2, None, None, 0) > ('attval_from', , None, 2, None, None, 0) > ('attfree', , None, 24, None, None, 0) > Traceback (most recent call last): > File "ingtest.py", line 86, in ? > for t in cu.description: > IndexError: tuple index out of range I had just a look at the new Python interface today. You are right, it causes this IndexError. Thanks for Your hints and comments Wish You a peaceful ``Osterfest'' Holger -- Holger Meyer, Uni of Rostock, Dpt. of CS, DB Research Group hm at IEEE.org, http://wwwdb.informatik.uni-rostock.de/ From jmunoz@telefonica.net Fri Mar 29 02:25:53 2002 From: jmunoz@telefonica.net (=?ISO-8859-1?Q?Juli=E1n_Mu=F1oz?=) Date: Fri, 29 Mar 2002 02:25:53 +0000 (GMT) Subject: [DB-SIG] db-api fetchmany result type Message-ID: The types of the elements of the response of the fetchmany call in the db-api, must correspond with the types defined in the database, or can all be strings ? [('0','1')] is a correct result if botch columns are numbers, or must it be [ (0,1) ] ? Thank you, --=20 __o _ \<_ (_)/(_) Saludos de Juli=E1n EA4ACL -.- Foro Wireless Madrid http://opennetworks.rg3.net From fog@debian.org Fri Mar 29 08:48:24 2002 From: fog@debian.org (Federico Di Gregorio) Date: 29 Mar 2002 09:48:24 +0100 Subject: [DB-SIG] db-api fetchmany result type In-Reply-To: References: Message-ID: <1017391705.909.0.camel@nenya> --=-Gvp4ay0UhPLSp9L/5rlV Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Il ven, 2002-03-29 alle 03:25, Juli=E1n Mu=F1oz ha scritto: >=20 > The types of the elements of the response of the fetchmany call in the > db-api, must correspond with the types defined in the database, or can al= l > be strings ? >=20 > [('0','1')] is a correct result if botch columns are numbers, or must it > be [ (0,1) ] ? i think it is better if db types are converted to the best-matching python types. strings -> strings, numbers -> numbers, date and times -> wrappers around DateTime objects, etc. ciao, federico --=20 Federico Di Gregorio Debian GNU/Linux Developer & Italian Press Contact fog@debian.org INIT.D Developer fog@initd.org La felicit=E0 =E8 una tazza di cioccolata calda. Sempre. -- I= o --=-Gvp4ay0UhPLSp9L/5rlV Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: Per informazioni si veda http://www.gnupg.org iEYEABECAAYFAjykKlgACgkQvcCgrgZGjetihwCcDkRPF/HY1uf0ABp9g//IS5Ob 1gwAn1NlYEI68bIWZj0+7/omC/sM/N59 =RYrq -----END PGP SIGNATURE----- --=-Gvp4ay0UhPLSp9L/5rlV-- From jmunoz@telefonica.net Fri Mar 29 14:10:30 2002 From: jmunoz@telefonica.net (=?ISO-8859-1?Q?Juli=E1n_Mu=F1oz?=) Date: Fri, 29 Mar 2002 14:10:30 +0000 (GMT) Subject: [DB-SIG] db-api fetchmany result type In-Reply-To: <1017391705.909.0.camel@nenya> Message-ID: Ok, but this is not clearly specified in the document !! On 29 Mar 2002, Federico Di Gregorio wrote: > Il ven, 2002-03-29 alle 03:25, Juli=E1n Mu=F1oz ha scritto: > > > > The types of the elements of the response of the fetchmany call in the > > db-api, must correspond with the types defined in the database, or can = all > > be strings ? > > > > [('0','1')] is a correct result if botch columns are numbers, or must i= t > > be [ (0,1) ] ? > > i think it is better if db types are converted to the best-matching > python types. strings -> strings, numbers -> numbers, date and times -> > wrappers around DateTime objects, etc. > > ciao, > federico > > --=20 __o _ \<_ (_)/(_) Saludos de Juli=E1n EA4ACL -.- Foro Wireless Madrid http://opennetworks.rg3.net From arthuralbano@hotmail.com Fri Mar 29 23:07:33 2002 From: arthuralbano@hotmail.com (Arthur Albano) Date: Sat, 30 Mar 2002 08:07:33 +0900 Subject: [DB-SIG] Moving and changing job Message-ID: This is a multi-part message in MIME format. ------=_NextPart_000_2621_7612_77a4 Content-Type: text/plain; format=flowed Hi, Just here to say that I'm changing job, place, server, etc... Reply soon, Arthur. _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. ------=_NextPart_000_2621_7612_77a4 Content-Type: message/rfc822 >From db-sig-admin@python.org Mon, 18 Mar 2002 22:23:49 -0800 Received: from [63.102.49.29] by hotmail.com (3.2) with ESMTP id MHotMailBE6023FD00C5400431543F66311D088C0; Mon, 18 Mar 2002 22:21:50 -0800 Received: from localhost.localdomain ([127.0.0.1] helo=mail.python.org) by mail.python.org with esmtp (Exim 3.35 #2) id 16nCzm-00088e-00; Tue, 19 Mar 2002 01:21:18 -0500 Received: from [64.4.23.195] (helo=hotmail.com) by mail.python.org with esmtp (Exim 3.35 #2) id 16nCzG-00082I-00 for db-sig@python.org; Tue, 19 Mar 2002 01:20:46 -0500 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 18 Mar 2002 22:20:15 -0800 Received: from 200.43.20.219 by lw15fd.law15.hotmail.msn.com with HTTP; Tue, 19 Mar 2002 06:20:15 GMT X-Originating-IP: [200.43.20.219] From: "Ignacio Guerrero" To: db-sig@python.org Bcc: Mime-Version: 1.0 Content-Type: text/html; charset=iso-8859-1 Message-ID: X-OriginalArrivalTime: 19 Mar 2002 06:20:15.0728 (UTC) FILETIME=[226F0F00:01C1CF0E] Subject: [DB-SIG] Begginer getting out of troubles... I hope. Sender: db-sig-admin@python.org Errors-To: db-sig-admin@python.org X-BeenThere: db-sig@python.org X-Mailman-Version: 2.0.8 (101270) Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: SIG on Python Tabular Databases List-Unsubscribe: , List-Archive: Date: Tue, 19 Mar 2002 03:20:15 -0300

I want to thank you for your answers. They've been more than useful. But, as you know, an answer usually leads us to new questions.

I've already downloaded MySQL 4.0.1 and the MySQL - Python module. I'm working on the MySQL tutorial and it's quite clear.

What I don'r get is the module. There is not a Mysqldb.py module but a CompatMysqldb.py and a _mysql_exceptions.py modules in \Python22\Lib\site-packages. There are some __init__.py, connections.py,converters.py, cursors.py, sets.py and times.py modules in the \lib\site-packages\MySqldb folder.

I thought that the one I needed was CompatMysqldb.py module so I went to the interpreter and tried:

 

>>>import CompatMysqldb

>>>print CompatMysqldb.__doc__

 

It saids something about an older version of the module, blablablabla... but then there is an example which begins with:

import Mysqldb

So, what should I do? Should I rename the file? Is that the file I need? Did I download the wrong package?

I havn't got to it yet. I'm still bussy learning MySQL.

I really don't want to bother you with every single problem I step into and I would really preffer to read some document a thousand times until I get it but again, there is no documentation on this particular module, or may be there is but I didn't find it.

Anyone with a compass?

By the way, I'm preatty confortable with the english but if any of you wants to try spanish is welcome. Unless, of course, is necessary for all of you to read the answers.

Thank you.

Ignacio


Hable con sus amigos en línea, pruebe MSN Messenger: http://messenger.msn.es
_______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig ------=_NextPart_000_2621_7612_77a4-- From slrlfl2000@yahoo.co.kr Sat Mar 30 04:31:49 2002 From: slrlfl2000@yahoo.co.kr (slrlfl2000) Date: Sat, 30 Mar 2002 13:31:49 +0900 Subject: [DB-SIG] [±¤°í] Á¾·®Á¦ ºÀÅõ Àý¾àÇü ¾ÐÃྲ·¹±âÅë ¼Ò°³ Message-ID:



 

¢¹ ¿øÄ¡¾ÊÀº Á¤º¸¿´´Ù¸é Á¤ÁßÈ÷ »ç°ú µå¸®¸ç, ¼ö½Å °ÅºÎ¸¦ ÇØÁÖ½Ã¸é ´ÙÀ½ºÎÅÍ´Â ¸ÞÀÏÀÌ ¹ß¼ÛµÇÁö ¾ÊÀ» °ÍÀÔ´Ï´Ù.
¢¹ ¸ÞÀÏŬ¶óÀ̾ðÆ®ÀÇ ÇÊÅÍ ±â´ÉÀ» ÀÌ¿ëÇÏ¿© [±¤°í] ¹®±¸¸¦ ÇÊÅ͸µÇÏ¸é ¸ðµç ±¤°í ¸ÞÀÏÀ» ÀÚµ¿À¸·Î Â÷´ÜÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.

¼ö½Å°ÅºÎ(Unsubscribe)