Re: MySQLdb, lots of columns and newb-ness

2006-12-20 Thread Andrew Sackville-West
On Wed, Dec 20, 2006 at 09:22:59AM +0100, Fredrik Lundh wrote: > Andrew Sackville-West wrote: > > > I've also tried building tuples and lists and then using this > > > > cursor.execute("insert into daily values (%s)", values) > > > > with no luck. it appears to me that I have to put in all 132 '

Re: MySQLdb, lots of columns and newb-ness

2006-12-20 Thread Andrew Sackville-West
On Wed, Dec 20, 2006 at 07:00:38AM -0800, Ant wrote: > > > On Dec 20, 5:20 am, Andrew Sackville-West <[EMAIL PROTECTED]> > wrote: > > > >>> values = ", ".join([escapeAndQuote(f[:-2]) for f in fields]) > > Obviously this is the appropriate choice since this is a database app. > In general the str

Re: MySQLdb, lots of columns and newb-ness

2006-12-20 Thread Ant
On Dec 20, 5:20 am, Andrew Sackville-West <[EMAIL PROTECTED]> wrote: > > >>> values = ", ".join([escapeAndQuote(f[:-2]) for f in fields]) Obviously this is the appropriate choice since this is a database app. In general the strip() group of string methods do what you want in a safe way - assumin

Re: MySQLdb, lots of columns and newb-ness

2006-12-20 Thread Fredrik Lundh
Andrew Sackville-West wrote: > I've also tried building tuples and lists and then using this > > cursor.execute("insert into daily values (%s)", values) > > with no luck. it appears to me that I have to put in all 132 '%s' in > order to make that work and that just seems stupid. on the other h

Re: MySQLdb, lots of columns and newb-ness

2006-12-19 Thread Felix Benner
Andrew Sackville-West schrieb: > I have an ascii data dump from a POS system that has 131 fields in a > single column in a flat file. I can easily open the file, read in the > data and assemble it into various formats. okay. what I *want* to do > is insert each of these fields into a mysql databas

Re: MySQLdb, lots of columns and newb-ness

2006-12-19 Thread Andrew Sackville-West
On Tue, Dec 19, 2006 at 07:34:58PM -0800, Todd Neal wrote: > Andrew Sackville-West wrote: > > > > I can successfully connect to mysql and do stuff to my tables my > > specific problem is how to efficiently put those 132 fields into the > > thing. All I have been able to figure out is really ugly s

Re: MySQLdb, lots of columns and newb-ness

2006-12-19 Thread Todd Neal
Andrew Sackville-West wrote: > > I can successfully connect to mysql and do stuff to my tables my > specific problem is how to efficiently put those 132 fields into the > thing. All I have been able to figure out is really ugly stuff like: > build the mysql statement out of various pieces with appr