[CentOS] mysql-python
Is it me or does the MySQLdb module in Centos not support python's DBAPI 2.0? ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] mysql-python
On Thu, 2010-03-25 at 14:14 +0800, Christopher Chan wrote: Is it me or does the MySQLdb module in Centos not support python's DBAPI 2.0 --- Well you give no clue to the code your using. Post what type your using, It uses cursors so it it is compliant as far as I see. I get you installed it and it is dbapi 2. What does your python code look like? db = MySQLdb.connect (dsn='192.168.0.1:your_db', user='root', password='password') ## def addEntry(names): cursor.initialize() cursor = db.cursor () ### I think a good idea would be to drop it and go to postgres, and import pgdb. John ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] mysql-python
On Thursday, March 25, 2010 09:11 PM, JohnS wrote: On Thu, 2010-03-25 at 14:14 +0800, Christopher Chan wrote: Is it me or does the MySQLdb module in Centos not support python's DBAPI 2.0 --- Well you give no clue to the code your using. Post what type your using, It uses cursors so it it is compliant as far as I see. I get you installed it and it is dbapi 2. What does your python code look like? The same as everything below except for the initialize() call. db = MySQLdb.connect (dsn='192.168.0.1:your_db', user='root', password='password') ## def addEntry(names): cursor.initialize() cursor = db.cursor () ### I think a good idea would be to drop it and go to postgres, and import pgdb. I would love to were it not for the fact that one of the target clients runs OpenSolaris and does not package a postgresql module for python. Grr... Thanks, I will give this another shot before I give up on learning python and go back to perl or php land. ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] mysql-python
On Fri, Mar 26, 2010 at 08:23:26AM +0800, Christopher Chan wrote: On Thursday, March 25, 2010 09:11 PM, JohnS wrote: On Thu, 2010-03-25 at 14:14 +0800, Christopher Chan wrote: Is it me or does the MySQLdb module in Centos not support python's DBAPI 2.0 --- Well you give no clue to the code your using. Post what type your using, It uses cursors so it it is compliant as far as I see. I get you installed it and it is dbapi 2. What does your python code look like? The same as everything below except for the initialize() call. db = MySQLdb.connect (dsn='192.168.0.1:your_db', user='root', password='password') ## def addEntry(names): cursor.initialize() cursor = db.cursor () ### I think a good idea would be to drop it and go to postgres, and import pgdb. I would love to were it not for the fact that one of the target clients runs OpenSolaris and does not package a postgresql module for python. Grr... Thanks, I will give this another shot before I give up on learning python and go back to perl or php land. db = MySQLdb.connect() cursor = db.cursor() cursor.execute(SELECT) results = cursor.fetchall() Ray ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] mysql-python
On Friday, March 26, 2010 08:52 AM, Ray Van Dolson wrote: On Fri, Mar 26, 2010 at 08:23:26AM +0800, Christopher Chan wrote: On Thursday, March 25, 2010 09:11 PM, JohnS wrote: On Thu, 2010-03-25 at 14:14 +0800, Christopher Chan wrote: Is it me or does the MySQLdb module in Centos not support python's DBAPI 2.0 --- Well you give no clue to the code your using. Post what type your using, It uses cursors so it it is compliant as far as I see. I get you installed it and it is dbapi 2. What does your python code look like? The same as everything below except for the initialize() call. db = MySQLdb.connect (dsn='192.168.0.1:your_db', user='root', password='password') ## def addEntry(names): cursor.initialize() cursor = db.cursor () ### I think a good idea would be to drop it and go to postgres, and import pgdb. I would love to were it not for the fact that one of the target clients runs OpenSolaris and does not package a postgresql module for python. Grr... Thanks, I will give this another shot before I give up on learning python and go back to perl or php land. db = MySQLdb.connect() cursor = db.cursor() con=MySQLdb.connection(...) con.ping() curs = con.cursor() Traceback (most recent call last): File stdin, line 1, in ? AttributeError: cursor cursor.execute(SELECT) results = cursor.fetchall() However: con.query(SELECT SF.MOBILE FROM SF) res=con.store_result() res.fetch_row() Will work. Unless you want to tell me that things are slightly different when running the script and doing things interactively... ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] mysql-python
On Fri, Mar 26, 2010 at 09:03:11AM +0800, Christopher Chan wrote: On Friday, March 26, 2010 08:52 AM, Ray Van Dolson wrote: On Fri, Mar 26, 2010 at 08:23:26AM +0800, Christopher Chan wrote: On Thursday, March 25, 2010 09:11 PM, JohnS wrote: On Thu, 2010-03-25 at 14:14 +0800, Christopher Chan wrote: Is it me or does the MySQLdb module in Centos not support python's DBAPI 2.0 --- Well you give no clue to the code your using. Post what type your using, It uses cursors so it it is compliant as far as I see. I get you installed it and it is dbapi 2. What does your python code look like? The same as everything below except for the initialize() call. db = MySQLdb.connect (dsn='192.168.0.1:your_db', user='root', password='password') ## def addEntry(names): cursor.initialize() cursor = db.cursor () ### I think a good idea would be to drop it and go to postgres, and import pgdb. I would love to were it not for the fact that one of the target clients runs OpenSolaris and does not package a postgresql module for python. Grr... Thanks, I will give this another shot before I give up on learning python and go back to perl or php land. db = MySQLdb.connect() cursor = db.cursor() con=MySQLdb.connection(...) con.ping() curs = con.cursor() Traceback (most recent call last): File stdin, line 1, in ? AttributeError: cursor cursor.execute(SELECT) results = cursor.fetchall() However: con.query(SELECT SF.MOBILE FROM SF) res=con.store_result() res.fetch_row() Will work. Unless you want to tell me that things are slightly different when running the script and doing things interactively... Strange. I've always done it exactly the way I shared in my code snippet. Have many scripts coded that way... Where'd you get your MySQLdb module from? Ray ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] mysql-python
Where'd you get your MySQLdb module from? yum install MySQL-python ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] mysql-python
On Fri, Mar 26, 2010 at 09:32:35AM +0800, Christopher Chan wrote: Where'd you get your MySQLdb module from? yum install MySQL-python Well, don't know what to tell you: $ rpm -qi MySQL-python Name: MySQL-python Relocations: (not relocatable) Version : 1.2.1 Vendor: CentOS Release : 1 Build Date: Fri 05 Jan 2007 08:40:16 PM PST Install Date: Thu 25 Mar 2010 06:35:52 PM PDT Build Host: builder1.centos.org Group : Development/Libraries Source RPM: MySQL-python-1.2.1-1.src.rpm Size: 283388 License: GPL Signature : DSA/SHA1, Tue 03 Apr 2007 05:25:09 PM PDT, Key ID a8a447dce8562897 URL : http://sourceforge.net/projects/mysql-python/ Summary : An interface to MySQL Description : Python interface to MySQL MySQLdb is an interface to the popular MySQL database server for Python. The design goals are: - Compliance with Python database API version 2.0 - Thread-safety - Thread-friendliness (threads will not block each other) - Compatibility with MySQL 3.23 and up $ python Python 2.4.3 (#1, Sep 3 2009, 15:37:12) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2 Type help, copyright, credits or license for more information. import MySQLdb conn = MySQLdb.connect(user='rayvd', passwd='XX', db='bludgeon') cursor=conn.cursor() cursor.execute(SELECT * FROM quotes LIMIT 1) 1L results = cursor.fetchone() Ray ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] mysql-python
On Friday, March 26, 2010 09:39 AM, Ray Van Dolson wrote: On Fri, Mar 26, 2010 at 09:32:35AM +0800, Christopher Chan wrote: Where'd you get your MySQLdb module from? yum install MySQL-python Well, don't know what to tell you: $ rpm -qi MySQL-python Name: MySQL-python Relocations: (not relocatable) Version : 1.2.1 Vendor: CentOS Release : 1 Build Date: Fri 05 Jan 2007 08:40:16 PM PST Install Date: Thu 25 Mar 2010 06:35:52 PM PDT Build Host: builder1.centos.org Group : Development/Libraries Source RPM: MySQL-python-1.2.1-1.src.rpm Size: 283388 License: GPL Signature : DSA/SHA1, Tue 03 Apr 2007 05:25:09 PM PDT, Key ID a8a447dce8562897 Hmm, some slight differences... Name: MySQL-python Relocations: (not relocatable) Version : 1.2.1 Vendor: CentOS Release : 1 Build Date: Sat 06 Jan 2007 12:38:14 PM HKT Install Date: Tue 16 Mar 2010 12:24:16 PM HKT Build Host: builder3.centos.org Group : Development/Libraries Source RPM: MySQL-python-1.2.1-1.src.rpm Size: 294516 License: GPL Signature : DSA/SHA1, Wed 04 Apr 2007 08:25:45 AM HKT, Key ID a8a447dce8562897 URL : http://sourceforge.net/projects/mysql-python/ Summary : An interface to MySQL Description : Python interface to MySQL MySQLdb is an interface to the popular MySQL database server for Python. The design goals are: - Compliance with Python database API version 2.0 - Thread-safety - Thread-friendliness (threads will not block each other) - Compatibility with MySQL 3.23 and up $ python Python 2.4.3 (#1, Sep 3 2009, 15:37:12) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2 Type help, copyright, credits or license for more information. import MySQLdb conn = MySQLdb.connect(user='rayvd', passwd='XX', db='bludgeon') cursor=conn.cursor() cursor.execute(SELECT * FROM quotes LIMIT 1) 1L results = cursor.fetchone() Oh brother, it looks like initialize() don't exist too... con=MySQLdb.connection(passwd=,user=esf,db=maze_bs) curs=con.cursor() Traceback (most recent call last): File stdin, line 1, in ? AttributeError: cursor curs=con.initialize() Traceback (most recent call last): File stdin, line 1, in ? AttributeError: initialize ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Re: [CentOS] mysql-python
con=MySQLdb.connection(passwd=,user=esf,db=maze_bs) Blast, it is because I am using connection instead of connect. Sorry for the noise. ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos