From andy47 at halfcooked.com Mon Aug 8 06:38:07 2005 From: andy47 at halfcooked.com (Andy Todd) Date: Mon, 08 Aug 2005 14:38:07 +1000 Subject: [DB-SIG] PyGreSQL (pgdb) Problem In-Reply-To: <669261440507271735259be809@mail.gmail.com> References: <669261440507271735259be809@mail.gmail.com> Message-ID: <42F6E1AF.7090409@halfcooked.com> Don Parris wrote: > Greetings, > > I'm running SUSE Linux 9.2, Python 2.3.4. I'm new to > Python/programming. I basically installed most of the DVD when I > installed SUSE last Fall. Things *should* be working properly, but... > > What originally started as a MySQL project is now using Postgres for > the larger feature set. Instead of importing MySQLdb, I now use the > PyGreSQL pgdb module. When attempting to load the pgdb module for use > in my script, I get this traceback (same when I try it at the > command-line): > > >>>>pgdb.connect('localhost:chaddb_a_test:donp:d1o1l2l4') > > Traceback (most recent call last): > File "", line 1, in ? > NameError: name 'pgdb' is not defined > >>>>import pgdb > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.3/site-packages/pgdb.py", line 65, in ? > except ImportError: import DateTime > ImportError: No module named DateTime > > > In the pgdb module, I found this (which matches with the traceback): > # Marc-Andre is changing where DateTime goes. This handles it either way. > try: from mx import DateTime > except ImportError: import DateTime > > I have spent a fair amount of time searching the archives for this > issue, but have thus far turned up nothing useful. I have no module > "mx" that I can find in ../python2.3/lib (or other dirs. Should I > modify the file to use datetime.so instead? I'm not certain of the > implications of that, but it doesn't seem like the correct move. I > greatly appreciate your help. > > Don Don, From the documentation[1] it looks like pgdb requires the mxDateTime module[2] to work properly. You'll need to go to the URL[2], download a copy in the appropriate format and install it on your system. [1] http://www.druid.net/pygresql/README.txt [2] http://www.egenix.com/files/python/mxDateTime.html Regards, Andy -- -------------------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ From gnumathetes at gmail.com Mon Aug 8 21:40:58 2005 From: gnumathetes at gmail.com (Don Parris) Date: Mon, 8 Aug 2005 15:40:58 -0400 Subject: [DB-SIG] PyGreSQL (pgdb) Problem In-Reply-To: <42F6E1AF.7090409@halfcooked.com> References: <669261440507271735259be809@mail.gmail.com> <42F6E1AF.7090409@halfcooked.com> Message-ID: <66926144050808124042f9a174@mail.gmail.com> On 8/8/05, Andy Todd wrote: > Don Parris wrote: > > Don, > > From the documentation[1] it looks like pgdb requires the mxDateTime > module[2] to work properly. You'll need to go to the URL[2], download a > copy in the appropriate format and install it on your system. > > [1] http://www.druid.net/pygresql/README.txt > [2] http://www.egenix.com/files/python/mxDateTime.html > > Regards, > Andy > -- > -------------------------------------------------------------------------------- Yeah, I've got the Egenix package installed now. I ran into a bit of trouble getting connected - most likely my own inexperience with the syntax or something. Pygresql is a little different from MySQLdb. I haven't had time to fiddle with the workings of pgdb to see if I can get it working on my own, as I've been working on two other projects the past couple of weeks. If I can't figure it out when I get back to it, I'll post further questions on the list. Thanks everyone for your help thus far, Don -- DC Parris GNU Evangelist http://matheteuo.org/ gnumathetes at gmail.com "Hey man, whatever pickles your list!" From brett.chadwick at gcserv.com Tue Aug 9 23:08:25 2005 From: brett.chadwick at gcserv.com (Brett Chadwick) Date: Tue, 9 Aug 2005 16:08:25 -0500 Subject: [DB-SIG] MySQL Access Message-ID: <59484F3FC6AE1E498326EBA04E551BF5022CAC3B@email.gcserv.com> I am attempting to access a MySQL server through a graphical python program I have writing. I have successfully made a connection to the database which runs on a Linux server, however I cannot find any syntax/command examples which relate to using the built in _mysql module of python. I believe if someone could give me a simple example of how to obtain a cursor and write data to a specific table/column and retrieve information from this. I can elaborate and finish this program. Thank you for any help you can provide with this, I know it is relatively simple. Thanks, Ex - 3016 Brett Chadwick VO Administrator GC Services brett.chadwick at gcserv.com From farcepest at gmail.com Wed Aug 10 15:51:07 2005 From: farcepest at gmail.com (Andy Dustman) Date: Wed, 10 Aug 2005 09:51:07 -0400 Subject: [DB-SIG] MySQL Access In-Reply-To: <59484F3FC6AE1E498326EBA04E551BF5022CAC3B@email.gcserv.com> References: <59484F3FC6AE1E498326EBA04E551BF5022CAC3B@email.gcserv.com> Message-ID: <9826f38005081006514ec8718d@mail.gmail.com> On 8/9/05, Brett Chadwick wrote: > I am attempting to access a MySQL server through a graphical python program I have writing. > > I have successfully made a connection to the database which runs on a Linux server, however I cannot find any syntax/command examples which relate to using the built in _mysql module of python. > > I believe if someone could give me a simple example of how to obtain a cursor and write data to a specific table/column and retrieve information from this. I can elaborate and finish this program. > > Thank you for any help you can provide with this, I know it is relatively simple. You're not supposed to use _mysql directly. Use MySQLdb instead. Read the user's guide and PEP-249, and use the built-in documentation as reference, i.e. pydoc MySQLdb or help('MySQLdb') in the interpreter. -- Computer interfaces should never be made of meat. http://www.terrybisson.com/meat.html From brett.chadwick at gcserv.com Wed Aug 10 23:50:33 2005 From: brett.chadwick at gcserv.com (Brett Chadwick) Date: Wed, 10 Aug 2005 16:50:33 -0500 Subject: [DB-SIG] MySQL Access UPDATE Message-ID: <59484F3FC6AE1E498326EBA04E551BF550D661@email.gcserv.com> All, This is the current code I am trying to use, it is modeled after some examples I have seen. If someone can provide a better example or way to access the MySQL server and pull or push data to a database on the server that would be appreciated. ##Database name is Test, Table name is Test1, feild is name,Fred, and PKID## def sqlconnect(): import _mysql import MySQLdb db=_mysql.connect(host="10.15.10.201",user="bjchadwick", passwd="checkthis",db="test") db.query("""SELECT * FROM Test1 WHERE name""") print "Connected" sqlconnect() def data(): class Table: def __init__(self, db, test): self.db = db self.name = Test1 self.dbc = self.db.cursor() def __getitem__(self, item): self.dbc.execute("SELECT * FROM Test1" % (self.name, item)) return self.dbc.fetchnone() for i in xrange(80, 100): print "Data %s: %s" (i, Test1[i]) data() Thanks, Ex - 3016 Brett Chadwick VO Administrator GC Services brett.chadwick at gcserv.com -----Original Message----- From: db-sig-bounces at python.org [mailto:db-sig-bounces at python.org]On Behalf Of db-sig-request at python.org Sent: Wednesday, August 10, 2005 3:00 AM To: db-sig at python.org Subject: DB-SIG Digest, Vol 29, Issue 4 Send DB-SIG mailing list submissions to db-sig at python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/db-sig or, via email, send a message with subject or body 'help' to db-sig-request at python.org You can reach the person managing the list at db-sig-owner at python.org When replying, please edit your Subject line so it is more specific than "Re: Contents of DB-SIG digest..." From chris at cogdon.org Thu Aug 11 00:10:27 2005 From: chris at cogdon.org (Chris Cogdon) Date: Wed, 10 Aug 2005 15:10:27 -0700 Subject: [DB-SIG] MySQL Access UPDATE In-Reply-To: <59484F3FC6AE1E498326EBA04E551BF550D661@email.gcserv.com> References: <59484F3FC6AE1E498326EBA04E551BF550D661@email.gcserv.com> Message-ID: <982de8d50b5304bcfb532d57165e3a6c@cogdon.org> On Aug 10, 2005, at 14:50, Brett Chadwick wrote: > All, > This is the current code I am trying to use, it is modeled after some > examples I have seen. If someone can provide a better example or way > to access the MySQL server and pull or push data to a database on the > server that would be appreciated. Actually, by the look of things, just use MySQLdb.connect rather than _mysql.connect. Don't use _mysql directly. There's no need to do the 'test' query on the database. If you DO need to do that, use the standard 'get a cursor' thing like you would do with a normal query. -- ("`-/")_.-'"``-._ Chris Cogdon . . `; -._ )-;-,_`) (v_,)' _ )`-.\ ``-' _.- _..-_/ / ((.' ((,.-' ((,/ fL From catherine.devlin at gmail.com Thu Aug 11 20:23:28 2005 From: catherine.devlin at gmail.com (Catherine Devlin) Date: Thu, 11 Aug 2005 14:23:28 -0400 Subject: [DB-SIG] introduction for Oracle-based newbies; evangelism Message-ID: <6523e39a05081111234ee7900d@mail.gmail.com> Hi, SIG! ("Hi, Catherine!") I'm basically an Oracle DBA who uses Python on the side, and I'm tired of seeing blank stares at Oracle meetings when I mention my Python passion. So I wrote up an article designed to smooth the entry to Python for Oracle people, addressing the things I think are likely to confuse an Oracle-based newbie. Or the things that confused me, at least. The article is at http://www.ioug.org/python.pdf If only I could have read it on my way into Python, it would have made things quite a bit easier for me, time-travel paradoxes notwithstanding. Anyway, I had hoped to publish it in the IOUG's quarterly magazine, but they opted simply to web-publish it at their site. I'm afraid, for evangelism purposes, it's pretty obscure right now. Pushing the evangelism metaphor a little further, my lamp is not at all on a lampstand. I'm bringing it up here for two reasons. 1) If you personally want to help Oracle people to a friendly introduction, please gratify my ego and point them to it. 2) Ideas on where to go with it next. IOUG told me I still have rights to try to publish or post it elsewhere, but I don't really know where. Thoughts? Thanks! - Catherine http://catherinedevlin.blogspot.com/ From mal at egenix.com Thu Aug 11 20:44:00 2005 From: mal at egenix.com (M.-A. Lemburg) Date: Thu, 11 Aug 2005 20:44:00 +0200 Subject: [DB-SIG] introduction for Oracle-based newbies; evangelism In-Reply-To: <6523e39a05081111234ee7900d@mail.gmail.com> References: <6523e39a05081111234ee7900d@mail.gmail.com> Message-ID: <42FB9C70.1090009@egenix.com> Catherine Devlin wrote: > Hi, SIG! ("Hi, Catherine!") > > I'm basically an Oracle DBA who uses Python on the side, and I'm tired > of seeing blank stares at Oracle meetings when I mention my Python > passion. So I wrote up an article designed to smooth the entry to > Python for Oracle people, addressing the things I think are likely to > confuse an Oracle-based newbie. Or the things that confused me, at > least. > > The article is at http://www.ioug.org/python.pdf > > If only I could have read it on my way into Python, it would have made > things quite a bit easier for me, time-travel paradoxes > notwithstanding. > > Anyway, I had hoped to publish it in the IOUG's quarterly magazine, > but they opted simply to web-publish it at their site. I'm afraid, > for evangelism purposes, it's pretty obscure right now. Pushing the > evangelism metaphor a little further, my lamp is not at all on a > lampstand. > > I'm bringing it up here for two reasons. > > 1) If you personally want to help Oracle people to a friendly > introduction, please gratify my ego and point them to it. > 2) Ideas on where to go with it next. IOUG told me I still have > rights to try to publish or post it elsewhere, but I don't really know > where. Thoughts? I suppose the database topic guide would be a good place to place a pointer to the doc. http://www.python.org/topics/database/ I'm just not sure who maintains that part of the python.org tree these days (it used to be Andrew Kuchling IIRC). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Aug 11 2005) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ 2005-07-18: Released mxODBC.Zope.DA for Zope 2.8 ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From gvanrossum at gmail.com Fri Aug 12 00:59:45 2005 From: gvanrossum at gmail.com (Guido van Rossum) Date: Thu, 11 Aug 2005 15:59:45 -0700 Subject: [DB-SIG] introduction for Oracle-based newbies; evangelism In-Reply-To: <6523e39a05081111234ee7900d@mail.gmail.com> References: <6523e39a05081111234ee7900d@mail.gmail.com> Message-ID: On 8/11/05, Catherine Devlin wrote: > 1) If you personally want to help Oracle people to a friendly > introduction, please gratify my ego and point them to it. > 2) Ideas on where to go with it next. IOUG told me I still have > rights to try to publish or post it elsewhere, but I don't really know > where. Thoughts? I sent this to my local Oracle folks, one of whom suggested that you could try the various local oracle user groups next. They might be more interested than IOUG. E.g. http://nocoug.org/ -- --Guido van Rossum (home page: http://www.python.org/~guido/) From andy47 at halfcooked.com Sat Aug 13 01:13:11 2005 From: andy47 at halfcooked.com (Andy Todd) Date: Sat, 13 Aug 2005 09:13:11 +1000 Subject: [DB-SIG] introduction for Oracle-based newbies; evangelism In-Reply-To: <6523e39a05081111234ee7900d@mail.gmail.com> References: <6523e39a05081111234ee7900d@mail.gmail.com> Message-ID: <42FD2D07.3040709@halfcooked.com> Catherine Devlin wrote: > Hi, SIG! ("Hi, Catherine!") > > I'm basically an Oracle DBA who uses Python on the side, and I'm tired > of seeing blank stares at Oracle meetings when I mention my Python > passion. So I wrote up an article designed to smooth the entry to > Python for Oracle people, addressing the things I think are likely to > confuse an Oracle-based newbie. Or the things that confused me, at > least. > > The article is at http://www.ioug.org/python.pdf > > If only I could have read it on my way into Python, it would have made > things quite a bit easier for me, time-travel paradoxes > notwithstanding. > > Anyway, I had hoped to publish it in the IOUG's quarterly magazine, > but they opted simply to web-publish it at their site. I'm afraid, > for evangelism purposes, it's pretty obscure right now. Pushing the > evangelism metaphor a little further, my lamp is not at all on a > lampstand. > > I'm bringing it up here for two reasons. > > 1) If you personally want to help Oracle people to a friendly > introduction, please gratify my ego and point them to it. > 2) Ideas on where to go with it next. IOUG told me I still have > rights to try to publish or post it elsewhere, but I don't really know > where. Thoughts? > > Thanks! > - Catherine > http://catherinedevlin.blogspot.com/ > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > http://mail.python.org/mailman/listinfo/db-sig In my opinion your best bet is to turn it into HTML and post it up on the web somewhere. Then with the combined google-juice of the people reading this mailing list it would soon make the front page of most search results for Oracle+Python. I'm not sure that Oracle would be that interested in promoting this or any similar article as Python isn't a strategic direction for them. Their open source efforts are more focussed towards Linux and PHP at the moment, but you never know where a little perseverance will get you. The home of this kind of content in the Oracle world is OTN [1] so maybe you could try this same question in their forums. [1] http://www.oracle.com/technology/index.html Regards, Andy -- -------------------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ From andy47 at halfcooked.com Mon Aug 15 15:56:23 2005 From: andy47 at halfcooked.com (Andy Todd) Date: Mon, 15 Aug 2005 23:56:23 +1000 Subject: [DB-SIG] pygresql class field auto-generation In-Reply-To: <200507291528.55202.jsaker@americanrelay.com> References: <200507291528.55202.jsaker@americanrelay.com> Message-ID: <43009F07.6020100@halfcooked.com> James Saker wrote: > Hello, > > I've been working with pygresql succesfully through a project that has a need > for classes to mirror my postgresql tables while operating (it's a customer > billing project). To this point, I've manually created classes like customer, > product, subscription all manually by mirroring the structure of the > postgresql table in a static class definition of the same name. Then I've > built methods to initialize the objects after testing for valid criteria > (e.g. valid integer value customer ID of ten digits before querying the > database and populating the customer object). The real downside is that this > takes forever, is terribly static and rather time consuming to build and > maintain. > > Having read some of pg.DB's capabilities like get_attnames(table), and looking > at a psycopg recipe with some similar capabilities, I was curious if anyone > knew if a good pygresql class recipe I can inherit from that would provide > this mechanism of getting all the attributes and automatically generating the > object's attributes to match, along with other useful insertion/query > methods. > > Jamie > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > http://mail.python.org/mailman/listinfo/db-sig Jamie, I don't know if this response is too late, but have you looked at SQLObject? [1] It provides a ready made object-relational mapper which saves you writing a lot of wrapper code and may be just what you are looking for. [1] http://www.sqlobject.org/ Regards, Andy -- -------------------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ From vinjvinj at yahoo.com Thu Aug 18 13:05:35 2005 From: vinjvinj at yahoo.com (Vinj Vinj) Date: Thu, 18 Aug 2005 04:05:35 -0700 (PDT) Subject: [DB-SIG] pickling error with db_row object Message-ID: <20050818110535.69786.qmail@web32805.mail.mud.yahoo.com> I have been using db_row extensively in my application and have been very pleased with it. Some times I end up putting objects which contain db_row objects in the sesssion object. When the session object gets pickled it gives me an error that PicklingError: Can't pickle : attribute lookup db_row.irow failed, Moving all my db_row data to actual python objects would be a lot of effort and hit performance as well. Is there a better way and why will it not pickle db_row objects Thanks, From MReddy at Bear.com Tue Aug 30 17:02:37 2005 From: MReddy at Bear.com (Reddy, Murali (Exchange)) Date: Tue, 30 Aug 2005 11:02:37 -0400 Subject: [DB-SIG] I need PYTHON- DB2 -connection info SUN OS 5.8 Message-ID: Hello, One of my collegue wrote a PYTHON(2.2) Program reads data from DB2 database. The script is on SUN OS (5.8 ) version. I need to install DB2 client libraries on my SUN Server. Any body has any idea , what are the freely available software packages available Pl help me Pl reply Regards -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/db-sig/attachments/20050830/85115990/attachment.html -------------- next part -------------- *********************************************************************** Bear Stearns is not responsible for any recommendation, solicitation, offer or agreement or any information about any transaction, customer account or account activity contained in this communication. *********************************************************************** From denials at gmail.com Wed Aug 31 13:33:28 2005 From: denials at gmail.com (Dan Scott) Date: Wed, 31 Aug 2005 07:33:28 -0400 Subject: [DB-SIG] I need PYTHON- DB2 -connection info SUN OS 5.8 In-Reply-To: References: Message-ID: Freely downloadable DB2 clients are available from http://ibm.com/db2/udb/support/downloadv8.html. If you need to build pyDB2, then you should download and install the DB2 Application Development Client to get the include files. Note that I haven't actually checked to see if Solaris 5.8 is supported -- if that's a relatively recent version, then it _should_ be. Dan On 8/30/05, Reddy, Murali (Exchange) wrote: > > Hello, > > One of my collegue wrote a PYTHON(2.2) Program reads data from DB2 > database. The script is on SUN OS (5.8 ) version. > > I need to install DB2 client libraries on my SUN Server. > > Any body has any idea , what are the freely available software packages > available > > Pl help me > > Pl reply > > Regards > > > > *********************************************************************** > Bear Stearns is not responsible for any recommendation, solicitation, > offer or agreement or any information about any transaction, customer > account or account activity contained in this communication. > *********************************************************************** > > > > _______________________________________________ > DB-SIG maillist - DB-SIG at python.org > http://mail.python.org/mailman/listinfo/db-sig > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/db-sig/attachments/20050831/b8801c3e/attachment.htm