Re: Cursor navigation

2005-07-19 Thread Andy Dustman
TA wrote: > Hi, > > This might be a silly question, but I was wondering how you would navigate > backwards in a PostgreSQL cursor when the Python DB-API 2.0 allows records > to be fetched in a forward-only manner? This is untrue: cursor.scroll() is an optional DB-API 2.0 extension. http://www.pyt

Re: Python, mysql, floating point values question

2005-07-03 Thread Andy Dustman
Use DECIMAL columns with MySQLdb-1.2.0 and Python-2.4 and you should get values back using Python's new decimal type. http://docs.python.org/whatsnew/node9.html This avoids floating point inaccuracies. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to connect python and Mysql?

2005-06-29 Thread Andy Dustman
Post your question here: http://sourceforge.net/forum/forum.php?forum_id=70461 -- http://mail.python.org/mailman/listinfo/python-list

Re: Install MySQL-python-0.9.1

2005-06-21 Thread Andy Dustman
Cathy Hui wrote: > I am trying to install MySQL-Python 0.9.1 on my Solaris 8 system. The > system has Python 2.3.3 and Mysql 4.0.21 installed. You're wasting your time. Use MySQL-python-1.2.0. -- http://mail.python.org/mailman/listinfo/python-list

Re: "/usr/bin/ld: cannot find -lmysqlclient" when building MySQL-Python

2005-05-12 Thread Andy Dustman
[EMAIL PROTECTED] wrote: > Hi. I'm trying to build MySQL-python-1.2.0 on my Linux FC2 > (with MySQL 3.23.58). See: https://sourceforge.net/tracker/index.php?func=detail&aid=1146226&group_id=22307&atid=374932 And also try the new 1.2.1c3 release candidate. -- http://mail.python.org/mailman/list

Re: "mysql.h: No such file or directory" when building MySQL-python

2005-04-28 Thread Andy Dustman
[EMAIL PROTECTED] wrote: > I'm trying to build 'MySQL-python-1.2.0' on my Linux FC2: ... > gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -march=i386 > -mcpu=i686 -D_GNU_SOURCE -fPIC -fPIC -I/usr/include/python2.3 -c > _mysql.c -o build/temp.linux-i686-2.3/_mysql.o -I'/usr/include/mysql'

Re: database in python ?

2005-04-14 Thread Andy Dustman
Mage wrote: > Andy Dustman wrote: > > > > >Transactions available since 3.23.17 (June 2000) > > > > > Transactions only supported on slow database types like innodb. > > If you ever tried it you cannot say that mysql supports transactions. No. > Last time

Re: database in python ?

2005-04-14 Thread Andy Dustman
Steve Holden wrote: > I don't know about the whole picture, but I know form evidence on this > group that there are PostgreSQL driver modules (the name "psycopg" comes > to mind, but this may be false memory) that appear to take diabolical > liberties with DBAPI-2.0, whereas my experience with My

Re: database in python ?

2005-04-12 Thread Andy Dustman
Buck Nuggets wrote: > 1. mysql doesn't support transactions - one of its io layers (innodb) > does. If you're hoping to get your application hosted you will find > that most mysql installations don't support innodb. And due to the > bugs in mysql, when you attempt to create a transaction-safe t

Re: database in python ?

2005-04-11 Thread Andy Dustman
Pierre-Frédéric Caillaud wrote: > > MySQL is an excellent option is very well documented. It is also a > > defacto standard for OpenSource databases. > > MySQL sucks for anything but very very basic stuff as it supports no > transactions, Transactions available since 3.23.17 (June 2000) >

Re: Python & MySQL

2005-04-07 Thread Andy Dustman
[EMAIL PROTECTED] wrote: > Okay, > > I had the brilliant idea right after posting to google the newsgroups > on this. > > db = MySQLdb.connect(user=database_user,passwd=database_password) > > db.autocommit(True) <--- One little line! You would be better off executing db.commit() periodically (at

Re: DBAPI Paramstyle

2005-03-28 Thread Andy Dustman
Tim Roberts wrote: > In theory, using a paramstyle allows the query to be sent to the SQL > database backend and compiled like a program. Then, successive uses of the > same query can be done by sending just the parameters, instead of sending > the entire query string to be parsed and compiled aga

Re: Can't seem to insert rows into a MySQL table

2005-03-15 Thread Andy Dustman
Anthra Norell wrote: > Very true! > I could verify that cursor.execute () seems to understand "... %s ...", > ..."string"... where print () doesn't.. I didn't know that. > I could also verify that gumfish's ineffective insertion command works fine > for me. (Python 2.4, mysql-3.23.38). So it looks

Re: Thank you. New question concerning text encoding

2005-03-13 Thread Andy Dustman
The default character set used by MySQL for the connection is latin1. If you control the server, you can configure this in the system my.cnf. Otherwise, it is possible to set it in a local configuration file and use the read_default_file option to connect to set it. http://dev.mysql.com/doc/mysql/

Re: Trouble with mysql-python 1.2.0 on Solaris 8 sparc

2005-02-25 Thread Andy Dustman
What happens when you try to connect? Be sure to check /etc/hosts.allow and .deny on the server, if your server is compiled with TCP wrapper support. -- http://mail.python.org/mailman/listinfo/python-list

Re: Trouble with mysql-python 1.2.0 on Solaris 8 sparc

2005-02-20 Thread Andy Dustman
Did you build your own MySQL, or did you use a pre-built version? And what version? It's not clear if you're using 4.0 or 4.1. If mysql_config is returning the wrong flags, then that's a bug with MySQL. You should be able to work around this by doing this in setup.py before the call to setup(): e

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Andy Dustman
Looking at the code, it seems that if it finds a unicode object on the first pass (the sizing pass), it punts and returns PyUnicode_Join(self, seq), which is the sequence from above and not necessarily the original object (orig), and starts over. In the worst-case scenario, you have a long sequence

Re: MYSQL - how to install ?

2005-02-17 Thread Andy Dustman
There's a Windows package for MySQL-4.1.9 and Python-2.4 on SourceForge now, thanks to Michal Zylinski. https://sourceforge.net/project/showfiles.php?group_id=22307&package_id=15775&release_id=303257 -- http://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Andy Dustman
I did some timings of ''.join( ) vs. ''.join( ) and found that generator expressions were slightly slower, so I looked at the source code to find out why. It turns out that the very first thing string_join(self, orig) does is: seq = PySequence_Fast(orig, ""); thus iterating over your ge

Re: MYSQL - how to install ?

2005-02-17 Thread Andy Dustman
For those of you who care, the latest stable version of MySQLdb is 1.2.0. Currently there is not a WIndows installer, however. I do not have the toolchain to build it, either; I depend on people to donate installers. If you have Python from the python.org packages and MySQL from the mysql.com pac

Re: Performance Issues of MySQL with Python

2005-02-11 Thread Andy Dustman
Well, it does more than that. It converts each column from a string (because MySQL returns all columns as strings) into the appropriate Python type. Then you were converting all the Python types back into strings. So it's no mystery that using the command line client is faster, since it would take

Re: Performance Issues of MySQL with Python

2005-02-10 Thread Andy Dustman
There aren't any "issues", but there are a few things to keep in mind. First of all, prior to 4.1, MySQL does no parameter binding, which means that the parameters must be inserted into your SQL statements as literals. MySQLdb will do this for you automatically, but keep in mind that you will be c

Re: MySQLdb - Tuples

2005-02-02 Thread Andy Dustman
#33 #! /usr/bin/env python import MySQLdb db=MySQLdb.connect(host='localhost', db='photum_0_6_2', user='root', passwd='thkhgfgd') c=db.cursor() c.execute('select person from persons order by person') for (person,) in c: # or c.fetchall() (may be more portable

Re: An mysql-python tutorial?

2005-01-30 Thread Andy Dustman
It definitely looks like an access control problem; recheck your grants. -- http://mail.python.org/mailman/listinfo/python-list

Re: An mysql-python tutorial?

2005-01-29 Thread Andy Dustman
It's a pretty good tutorial, thought I would recommend you forget about the fetchone() example. The example below demonstrates three additional features that will make your life easier: MySQL option files, tuple unpacking, and cursors as iterators (fourth feature: the default host is localhost; thi

Re: Mac OS and MySQLdb

2005-01-28 Thread Andy Dustman
The source is for all platforms. Use the Source, Luke. If 1.1.9 does not compile on Mac OS X, file a bug. -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem in importing MySQLdb

2005-01-20 Thread Andy Dustman
Gurpreet Sachdeva wrote: > Is there any problem in library files?? Do I need to install anything > I have installed MySQL-shared-3.23.54a-1.i386.rpm, > MySQL-devel-5.0.2-0.i386.rpm, MySQL-client-5.0.2-0.i386.rpm, > MySQL-server-5.0.2-0.i386.rpm You should recheck those version numbers carefully.