Re: MySQL schema sync or diff

2017-01-06 Thread Chris Angelico
On Thu, Jan 5, 2017 at 11:02 AM, Charles Heizer wrote: > I have a MySQL database that is not managed (yet) and I would like to get an output or diff against my new model file. I'm using flask-sqlalchemy. > > Are there any modules that would help me discover the differences so that I can script a m

Re: MySQL schema sync or diff

2017-01-05 Thread Chris Angelico
On Thu, Jan 5, 2017 at 11:02 AM, Charles Heizer wrote: > I have a MySQL database that is not managed (yet) and I would like to get an > output or diff against my new model file. I'm using flask-sqlalchemy. > > Are there any modules that would help me discover the differences so that I > can scri

RE: MySQL connector issue

2016-10-23 Thread Joseph L. Casale
> Interesting. Generally, I allocate cursors exactly at the same time as I open > transactions; > not sure if this works with the mysql connector, but with psycopg2 > (PostgreSQL), my code looks like this: > > with conn, conn.cursor() as cur: > cur.execute(...) > ... = cur.fetchall() > >

Re: MySQL connector issue

2016-10-23 Thread Chris Angelico
On Mon, Oct 24, 2016 at 3:46 AM, Joseph L. Casale wrote: > It really is that simple which is why I am baffled. Given the throughput is so > low, if I close the cursor and connection at the end of loop and instantiate > them > both at the start of the loop, it works as expected but that's obviousl

RE: MySQL connector issue

2016-10-23 Thread Joseph L. Casale
> Perhaps you simplified too much, but changes between the select and the > update could be lost. I think you need at least three states: > > 1 mark rows where baz is null (by setting baz to some value other than NULL > or 42, 24, say: set baz = 24 where baz is NULL) > 2 show marked rows (select

Re: MySQL connector issue

2016-10-23 Thread Peter Otten
Joseph L. Casale wrote: > I have some code that I am testing on Windows without c extensions which > runs on a RHEL server with c extensions. In a simplified test case as > follows: > > connection = mysql.connector.connect(...) > cursor = connection.cursor(cursor_class=MySQLCursorDict) > while Tr

Re: MySQL - Django can not display international characters

2016-04-08 Thread INADA Naoki
How did you create DB? http://dev.mysql.com/doc/refman/5.7/en/charset-database.html On Fri, Apr 8, 2016 at 7:26 PM, asimkon . wrote: > I have connected successfully MySQL with Django after installing MySQL > module via easy_install command. But unfortunately I have a problem setting > mysql db t

Re: MySQL connection over SSH

2015-05-12 Thread chrismeek4542
(2003, "Can't connect to MySQL server on 'mcsdev.croft-it.com' (60)") -- https://mail.python.org/mailman/listinfo/python-list

Re: [OT] Re: MySQL connections

2015-01-15 Thread Jacob Kruger
- Original Message - > functions. When was the last time those systems had Windows Update and reboots performed? Daily basis. Think, in line with your other message, will just try rewrite code - and, issue relating to structure etc. is left over from when pulled it out of wxPython im

Re: MySQL connections

2015-01-15 Thread Mark Lawrence
On 15/01/2015 16:40, Jacob Kruger wrote: If you want to check it out, have attached the full code file - might be a bit messy/large - but, effectively, right at bottom, launch an instance of the class a2m, passing through arguments, and then from within __init__ call convertProcess function, whi

Re: [OT] Re: MySQL connections

2015-01-15 Thread Jacob Kruger
- Original Message - From: "Dennis Lee Bieber" To: Sent: Thursday, January 15, 2015 4:22 PM Subject: Re: [OT] Re: MySQL connections On Thu, 15 Jan 2015 13:48:34 +0200, "Jacob Kruger" declaimed the following: Agree with that, but, like said in prior e-mail, ju

Re: MySQL connections

2015-01-15 Thread Jacob Kruger
- Original Message - From: "Chris Angelico" Cc: Sent: Thursday, January 15, 2015 2:33 PM Subject: Re: MySQL connections On Thu, Jan 15, 2015 at 10:59 PM, Jacob Kruger wrote: Tried generating .exe with both cx_freeze, and pyInstaller, and the code itself, and both v

Re: MySQL connections

2015-01-15 Thread Chris Angelico
On Thu, Jan 15, 2015 at 10:59 PM, Jacob Kruger wrote: > Tried generating .exe with both cx_freeze, and pyInstaller, and the code > itself, and both versions of executable generate errors, same as running it > from command line - only difference is the source of the error mentioned in > error messa

Re: MySQL connections

2015-01-15 Thread Jacob Kruger
- Original Message - From: "Chris Angelico" You've posted your working versions; can you post a non-working version? Problem is that works fine in interpreter, but, not when executing it as part of code in file. Also, I'm seeing a very small hint here that might indicate a huge

Re: [OT] Re: MySQL connections

2015-01-15 Thread Jacob Kruger
- Original Message - From: "Peter Otten" <__pete...@web.de> To: Sent: Thursday, January 15, 2015 12:40 PM Subject: [OT] Re: MySQL connections Jacob Kruger wrote: However, if implement similar code - down to just trying to open a connection, wait a few seconds, a

Re: MySQL connections

2015-01-15 Thread Chris Angelico
On Thu, Jan 15, 2015 at 7:13 PM, Jacob Kruger wrote: > However, if implement similar code - down to just trying to open a > connection, wait a few seconds, and then close it again, inside a function > called from a prior function, in the class am implementing in a file > called/executed from comma

[OT] Re: MySQL connections

2015-01-15 Thread Peter Otten
Jacob Kruger wrote: > However, if implement similar code - down to just trying to open a > connection, wait a few seconds, and then close it again, inside a function > called from a prior function, in the class am implementing in a file > called/executed from command line, then, the moment I try t

Re: MySQL connections

2015-01-15 Thread Jacob Kruger
And, FWIW, if I compile the 2.7 version on the other machine where it works, in both code and compiled forms, and then copy .exe back to the main machine, same error message pops up, so must be something to do with machine's configuration, etc. Stay well Jacob Kruger Blind Biker Skype: BlindZA

Re: MySQL data types vs Django/Python data types

2013-09-04 Thread Fábio Santos
On 1 Sep 2013 21:54, "Gary Roach" wrote: > > Hi all, > > System: > Debian Wheezy Linux > Python 2.7 > Django 1.5 > MySql 5.5 > > I am new to Python and Django and am having trouble matching Python data types with those of MySQL. MySQL has about 7 basic data types in

Re: MySQL dymanic query in Python

2013-05-30 Thread RAHUL RAJ
On Wednesday, May 29, 2013 3:32:51 PM UTC+5:30, Fábio Santos wrote: > On 29 May 2013 10:13, "RAHUL RAJ" wrote: > > > > > > Can anyone tell me the proper way in which I can execute dynamic MySQL > > queries in Python? > > > > > > I want to do dynamic queries for both CREATE and INSERT statemen

Re: MySQL dymanic query in Python

2013-05-29 Thread Fábio Santos
On 29 May 2013 10:13, "RAHUL RAJ" wrote: > > Can anyone tell me the proper way in which I can execute dynamic MySQL queries in Python? > > I want to do dynamic queries for both CREATE and INSERT statement. > > Here is my attempted code: > > > sql="create table %s (%%s, %%s, %%s ... )" % (tablename

Re: MySQL Database

2013-05-08 Thread Kevin Holleran
Thanks, I actually intend to, was just whipping something up to be an example for my question. -- Kevin Holleran Master of Science, Computer Information Systems Grand Valley State University Master of Business Administration Western Michigan University GCFA, GCFE, CCNA, ISA, MCSA, MCDST, MCP "

Re: MySQL Database

2013-05-08 Thread MRAB
On 08/05/2013 19:52, Kevin Holleran wrote: Hello, I want to connect to a MySQL database, query for some records, manipulate some data, and then update the database. When I do something like this: db_c.execute("SELECT a, b FROM Users") for row in db_c.fetchall(): (r,d) = row[0].

Re: MySQL Database

2013-05-08 Thread Kevin Holleran
On Wed, May 8, 2013 at 2:56 PM, Chris Angelico wrote: > On Thu, May 9, 2013 at 4:52 AM, Kevin Holleran wrote: > > Will using db_c to update the database mess up the loop that is cycling > > through db_c.fetchall()? > > Nope; fetchall() returns a list, which you're then iterating over. > Nothing

Re: MySQL Database

2013-05-08 Thread Chris Angelico
On Thu, May 9, 2013 at 4:52 AM, Kevin Holleran wrote: > Will using db_c to update the database mess up the loop that is cycling > through db_c.fetchall()? Nope; fetchall() returns a list, which you're then iterating over. Nothing the database does can disrupt that. ChrisA -- http://mail.python.

Re: MySQL database schema discovery

2013-03-22 Thread Tim Golden
On 22/03/2013 16:01, Roy Smith wrote: > What are my options for MySQL schema discovery? I want to be able to > find all the tables in a database, and discover the names and types of > each column (i.e. the standard schema discovery stuff). > > PEP 249 doesn't seem to have any discovery methods.

Re: mysql solution

2013-01-26 Thread Ferrous Cranus
Τη Παρασκευή, 25 Ιανουαρίου 2013 11:56:44 μ.μ. UTC+2, ο χρήστης Dennis Lee Bieber έγραψε: = #find the visitor record for the (saved) cID and current host cur.execute('''SELECT * FROM visitors WHERE counterID = %s and host = %s

Re: mysql solution

2013-01-25 Thread Ferrous Cranus
Τη Πέμπτη, 24 Ιανουαρίου 2013 10:43:59 μ.μ. UTC+2, ο χρήστης Dennis Lee Bieber έγραψε: > On Thu, 24 Jan 2013 03:04:46 -0800 (PST), Ferrous Cranus > > declaimed the following in > > gmane.comp.python.general: > > > > > # insert new page record in table counters or update it if already exists

Re: MySQL - "create table" creates malfunctioning tables

2013-01-24 Thread Walter Hurry
On Fri, 25 Jan 2013 07:55:06 +0100, F.R. wrote: > The other day, for unfathomable reasons, I lost control over tables > which I create. There was no concurrent change of anything on the > machine, such as an update. So I have no suspect. Does the following > action log suggest any recommendation t

Re: mysql solution

2013-01-24 Thread Ferrous Cranus
Τη Πέμπτη, 24 Ιανουαρίου 2013 5:39:54 μ.μ. UTC+2, ο χρήστης Lele Gaifax έγραψε: > UPDATE visitors > >SET visitors.hits=visitors.hits+1, > >visitors.useros=%s, > >visitors.browser=%s, > >visitors.date=%s > > WHERE visitors.pin=(SELECT counters.pin > >

Re: mysql solution

2013-01-24 Thread Lele Gaifax
Duncan Booth writes: > I'm not MySQL expert, but something like this might work: > > cursor.execute('''UPDATE visitors,counter > SET visitors.hits=visitors.hits+1, visitors.useros=%s, > visitors.browser =%s, visitors.date=%s > WHERE visitors.pin=counter.pin AND counter.page = %s > AND v

Re: mysql solution

2013-01-24 Thread Chris Angelico
On Fri, Jan 25, 2013 at 2:19 AM, Duncan Booth wrote: > Ferrous Cranus wrote: > >> I can do that but then i have to use that pin column's value in my >> next statement. >> >> cursor.execute( '''UPDATE visitors SET hits = hits + 1, useros = %s, >> browser = %s, date = %s WHERE pin = %s AND host = %

Re: mysql solution

2013-01-24 Thread Duncan Booth
Ferrous Cranus wrote: > I can do that but then i have to use that pin column's value in my > next statement. > > cursor.execute( '''UPDATE visitors SET hits = hits + 1, useros = %s, > browser = %s, date = %s WHERE pin = %s AND host = %s''', (useros, > browser, date, pin, host)) I'm not MySQL

Re: mysql solution

2013-01-24 Thread Chris Angelico
On Fri, Jan 25, 2013 at 12:31 AM, Ferrous Cranus wrote: > Τη Πέμπτη, 24 Ιανουαρίου 2013 1:16:51 μ.μ. UTC+2, ο χρήστης Chris Angelico > έγραψε: >> Glad you've listened to at least some of what you've been told. But if >> you want to be taken seriously on this list, I recommend going back to >> you

Re: mysql solution

2013-01-24 Thread Ferrous Cranus
Τη Πέμπτη, 24 Ιανουαρίου 2013 3:37:24 μ.μ. UTC+2, ο χρήστης Lele Gaifax έγραψε: > How? What's the error message/traceback? REURNING is not a correct mysql syntax thats why it produces errors. > If, as Chris said, MySQL does not support the “RETURNING” syntax, you > > cannot use that. I gave two

Re: mysql solution

2013-01-24 Thread Lele Gaifax
Ferrous Cranus writes: > The following statement fails. > > [code] > cursor.execute( '''INSERT INTO counters(page, hits) VALUES(%s, %s) RETURNING > (pin) > ON DUPLICATE KEY UPDATE hits = hits + 1''', > (htmlpage, 1) ) > [/code] How? What's the error message/traceback?

Re: mysql solution

2013-01-24 Thread Ferrous Cranus
Τη Πέμπτη, 24 Ιανουαρίου 2013 1:16:51 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > On Thu, Jan 24, 2013 at 10:04 PM, Ferrous Cranus > wrote: > > > I;am now convinced the hash solution isn't reversible and also isn't unique. > > > I'am trying the database oriented solution. > > > > Glad yo

Re: mysql solution

2013-01-24 Thread Ferrous Cranus
column 'pin' is an 5-digit integer auto_increment primary key. What i want is to insert a new record or update the existing one, if 'pin' column's value exist. The following statement fails. [code] cursor.execute( '''INSERT INTO counters(page, hits) VALUES(%s, %s) RETURNING (pin)

Re: mysql solution

2013-01-24 Thread Lele Gaifax
Ferrous Cranus writes: > Τη Πέμπτη, 24 Ιανουαρίου 2013 1:25:20 μ.μ. UTC+2, ο χρήστης Lele Gaifax > έγραψε: Please, trim your response messages, cutting away useless details. > > I just tried this statement: > > == > cursor.execute( '''INSERT INTO counter

Re: mysql solution

2013-01-24 Thread Ferrous Cranus
Τη Πέμπτη, 24 Ιανουαρίου 2013 1:25:20 μ.μ. UTC+2, ο χρήστης Lele Gaifax έγραψε: > Ferrous Cranus writes: > > > > > I;am now convinced the hash solution isn't reversible and also isn't > > > unique. > > > > Great! > > > > > how is the mysql statement is going to find the 'pin' to update t

Re: mysql solution

2013-01-24 Thread Chris Angelico
On Thu, Jan 24, 2013 at 10:25 PM, Lele Gaifax wrote: > The simplest way is to execute a SELECT just after the insertion, doing > a > > SELECT pin FROM counters WHERE page = %s > > I don't use MySQL, so I can't say if it supports "INSERT ... RETURNING ..." > SQL syntax: should it, then you could

Re: mysql solution

2013-01-24 Thread Lele Gaifax
Ferrous Cranus writes: > I;am now convinced the hash solution isn't reversible and also isn't > unique. Great! > how is the mysql statement is going to find the 'pin' to update the > specific record. The simplest way is to execute a SELECT just after the insertion, doing a SELECT pin FROM c

Re: mysql solution

2013-01-24 Thread Chris Angelico
On Thu, Jan 24, 2013 at 10:04 PM, Ferrous Cranus wrote: > I;am now convinced the hash solution isn't reversible and also isn't unique. > I'am trying the database oriented solution. Glad you've listened to at least some of what you've been told. But if you want to be taken seriously on this list,

Re: mysql insert with tuple

2012-11-22 Thread Christian
Am Mittwoch, 21. November 2012 20:49:14 UTC+1 schrieb Hans Mulder: > On 21/11/12 18:19:15, Christian wrote: > > > Hi , > > > > > > my purpose is a generic insert via tuple , because the number of fields > > and can differ. But I'm stucking . > > > > > > ilist=['hello',None,7,None,None] >

Re: mysql insert with tuple

2012-11-21 Thread Hans Mulder
On 21/11/12 18:19:15, Christian wrote: > Hi , > > my purpose is a generic insert via tuple , because the number of fields and > can differ. But I'm stucking . > > ilist=['hello',None,7,None,None] > > #This version works, but all varchar fields are in extra '' enclosed. > con.execute(""" INSER

Re: mysql insert with tuple

2012-11-21 Thread Chris Rebert
On Wed, Nov 21, 2012 at 9:19 AM, Christian wrote: > Hi , > > my purpose is a generic insert via tuple , because the number of fields and > can differ. But I'm stucking . > > ilist=['hello',None,7,None,None] > > #This version works, but all varchar fields are in extra '' enclosed. > con.execute(

Re: MySQL with Python

2012-10-15 Thread Roy Smith
In article , Dennis Lee Bieber wrote: > For routine database /access/ (that is, someone has created the > database user account that will be used), MySQLdb is the Python adapter > to connect to the server. For using THAT, you basically need to know SQL > (MySQL's flavor in particular), along wit

Re: MySQL with Python

2012-10-15 Thread Anurag Chourasia
Don't worry about what book you have (or don't have) in your Library..And let this not dictate your technology stack. PostgreSQL is one of the popular choice and you will never be short of documentation...Just Google and you will find lot of helpful tutorials... Regards, Anurag On Mon, Oct 1

Re: MySQL with Python

2012-10-15 Thread Chris Angelico
On Tue, Oct 16, 2012 at 1:47 AM, রুদ্র ব্যাণার্জী wrote: > On Tue, 2012-10-16 at 01:01 +1100, Chris Angelico wrote: >> But you may wish to consider using PostgreSQL instead. > Thanks, as I am very much new in database thing, I am not very aware of > the options I have. > But in my library, I did

Re: MySQL with Python

2012-10-15 Thread রুদ্র ব্যাণার্জী
On Tue, 2012-10-16 at 01:01 +1100, Chris Angelico wrote: > But you may wish to consider using PostgreSQL instead. Thanks, as I am very much new in database thing, I am not very aware of the options I have. But in my library, I did not found any thing on PostgreSQL. Though, I will google its supp

Re: MySQL with Python

2012-10-15 Thread Demian Brecht
On 12-10-15 06:45 AM, রুদ্র ব্যাণার্জী wrote: if yes, can you kindly suggest a book/reference on this? There are a few different ways to connect to MySQL, two of which are: For reference on connecting and querying MySQL through mysql-python, take a read through http://mysql-python.sourceforg

Re: MySQL with Python

2012-10-15 Thread Chris Angelico
On Tue, Oct 16, 2012 at 12:45 AM, রুদ্র ব্যাণার্জী wrote: > Dear friends, > I am starting a project of creating a database using mySQL(my first > project with database). > I went to my institute library and find that, all books are managing > "mySQL with perl and php" > > I am new to python itself

Re: MySQL with Python

2012-10-15 Thread Anurag Chourasia
Yes you can. There are libraries available in python to make this happen. Read this for a starter http://dev.mysql.com/usingmysql/python/ Regards, Anurag On Oct 15, 2012 10:53 AM, "রুদ্র ব্যাণার্জী" wrote: > Dear friends, > I am starting a project of creating a database using mySQL(my first >

Re: MySQL: AttributeError: cursor

2012-02-11 Thread Albert W. Hopkins
On Sat, 2012-02-11 at 09:40 -0800, Kevin Murphy wrote: > Hi All, > I'm using Python 2.7 and having a problem creating the cursor below. > Any suggestions would be appreciated! > > import sys > import _mysql > > print "cursor test" > > db = > _mysql.connect(host="localhost",user="root",passwd="my

Re: MySQL Query Problem

2010-09-17 Thread MRAB
On 17/09/2010 15:59, Victor Subervi wrote: I rebooted MySQL and it now works fine ;) I recommend that you always list the column names explicitly to be on the safe side: cursor.execute('insert into Passengers (flights_id, customer_id, name, sex , weight, price, round_trip, confirmation, l

Re: MySQL Query Problem

2010-09-17 Thread Victor Subervi
I rebooted MySQL and it now works fine ;) On Fri, Sep 17, 2010 at 9:26 AM, Victor Subervi wrote: > Here's some more data: > > print 'insert into Passengers values (Null, %s, %s, %s, %s, %s, %s, > %s, %s, "no", "n/a")' % (curr_flight, curr_customer, name, curr_sex, > curr_weight, price, cu

Re: MySQL Query Problem

2010-09-17 Thread Victor Subervi
Here's some more data: print 'insert into Passengers values (Null, %s, %s, %s, %s, %s, %s, %s, %s, "no", "n/a")' % (curr_flight, curr_customer, name, curr_sex, curr_weight, price, curr_rt, curr_confirmation) cursor.execute('insert into Passengers values (Null, %s, %s, %s, %s, %s, %

Re: MySQL Problem

2010-09-03 Thread Ian
On 03/09/2010 14:29, Victor Subervi wrote: This is an addendum to my last post. Please observe the following: mysql> select * from spreadsheets where Temp=1; +-++---+-++--+ | ID | Client | Multi | Item| Markup | Temp | +-+

Re: MySQL Problem

2010-09-03 Thread Victor Subervi
On Fri, Sep 3, 2010 at 9:25 AM, Richard Arts wrote: > These are also mere suggestions. > > The statements you use in your print statement and the one you use to > feed the cursor differ slightly. The latter is missing quotes around > your search criterium. > > Isn't it possible to fetch results r

Re: MySQL Problem

2010-09-03 Thread Victor Subervi
This is an addendum to my last post. Please observe the following: mysql> select * from spreadsheets where Temp=1; +-++---+-++--+ | ID | Client | Multi | Item| Markup | Temp | +-++---+-++--

Re: MySQL Problem

2010-09-03 Thread Richard Arts
These are also mere suggestions. The statements you use in your print statement and the one you use to feed the cursor differ slightly. The latter is missing quotes around your search criterium. Isn't it possible to fetch results row by row and see if the missing row is in the set? That way you c

Re: MySQL Problem

2010-09-03 Thread Victor Subervi
On Thu, Sep 2, 2010 at 3:02 PM, Ian wrote: > On 02/09/2010 19:34, Victor Subervi wrote: > >> for some reason running the command through python *omits* this one data!! >> The only difference is that a flag in spreadsheets (Temp) is set to 1. Why >> on earth doesn't it work in python?? >> > Some

Re: MySQL Problem

2010-09-02 Thread Ian
On 02/09/2010 19:34, Victor Subervi wrote: for some reason running the command through python *omits* this one data!! The only difference is that a flag in spreadsheets (Temp) is set to 1. Why on earth doesn't it work in python?? Some ideas to follow up. (These are only guesses). 1) One of t

Re: MySQL One More Again

2010-07-16 Thread John Nagle
On 7/16/2010 7:39 AM, MRAB wrote: Victor Subervi wrote: Hi; I have the following code: cursor.execute('select MyTable from optionsDetails where Store=%s', (store,)) options_tables = [item[0] for item in cursor] for table in options_tables: cursor.execute('select * from %' % table) As has b

Re: MySQL One More Again

2010-07-16 Thread Victor Subervi
On Fri, Jul 16, 2010 at 10:09 AM, MRAB wrote: > Victor Subervi wrote: > >> Hi; >> I have the following code: >> >>cursor.execute('select MyTable from optionsDetails where Store=%s', >> (store,)) >>options_tables = [item[0] for item in cursor] >>for table in options_tables: >> cur

Re: MySQL One More Again

2010-07-16 Thread MRAB
Victor Subervi wrote: Hi; I have the following code: cursor.execute('select MyTable from optionsDetails where Store=%s', (store,)) options_tables = [item[0] for item in cursor] for table in options_tables: cursor.execute('select * from %' % table) Should be: 'select *

Re: mysql query results to web page

2010-06-22 Thread Aaron Watters
On Jun 22, 4:50 pm, Greg wrote: > I'd like to query my local MySQL db and send the results to a locally > served web page.  I've poked around and found complex examples using > web2py and pylons What's best for beginners?  Can somebody lay out > the basic steps for me? > > thanks, > > Greg Yo

Re: MySQL, Python, NumPy and formatted read

2010-05-26 Thread John Nagle
Ian Hoffman wrote: Hello, I'm having significant Python difficulties (and I'm new to Python). I'm trying to read BLOB ASCII (numerical) data from a MySQL database using MySQLdb in a formatted fashion. The BLOB data is a sequence of numbers separated by newlines (\n), like this: 5 6 10 45 etc.

Re: MySQL, Python, NumPy and formatted read

2010-05-24 Thread Ian Hoffman
On May 24, 2:11 am, Dennis Lee Bieber wrote: > On Sun, 23 May 2010 21:44:30 -0700 (PDT), Ian Hoffman > declaimed the following in gmane.comp.python.general: > > > The problem is the tuple is contained in a single value separated by > > newlines (only a[0] has a record), otherwise I could do as yo

Re: MySQL, Python, NumPy and formatted read

2010-05-23 Thread Ian Hoffman
On May 23, 6:54 pm, Matteo Landi wrote: > I know anything about mysqldb and fetchone method, but it's easy to > create a numpy array, given a tuple of data: > > > > >>> import numpy > > >>> t = ('1', '2', '3') > >>> numpy.array(t, int) > array([1, 2, 3]) > > I made the assumption that mysqldb.fetc

Re: MySQL, Python, NumPy and formatted read

2010-05-23 Thread Matteo Landi
I know anything about mysqldb and fetchone method, but it's easy to create a numpy array, given a tuple of data: >>> import numpy >>> >>> t = ('1', '2', '3') >>> numpy.array(t, int) array([1, 2, 3]) >>> I made the assumption that mysqldb.fetchone return a tuple of strings, so we need to create an

Re: MySQL Error

2010-01-01 Thread MRAB
Benjamin Kaplan wrote: On Fri, Jan 1, 2010 at 1:32 PM, Victor Subervi wrote: On Fri, Jan 1, 2010 at 12:10 PM, MRAB wrote: Victor Subervi wrote: Hi; I'm trying to avoid the mortal sin of blank excepts. I intentionally threw this error: Traceback (most recent call last): File "/var/www/html/

Re: MySQL Error

2010-01-01 Thread Benjamin Kaplan
On Fri, Jan 1, 2010 at 1:32 PM, Victor Subervi wrote: > On Fri, Jan 1, 2010 at 12:10 PM, MRAB wrote: >> >> Victor Subervi wrote: >>> >>> Hi; >>> I'm trying to avoid the mortal sin of blank excepts. I intentionally >>> threw this error: >>> >>> Traceback (most recent call last): >>>  File "/var/ww

Re: MySQL Error

2010-01-01 Thread Victor Subervi
On Fri, Jan 1, 2010 at 12:10 PM, MRAB wrote: > Victor Subervi wrote: > >> Hi; >> I'm trying to avoid the mortal sin of blank excepts. I intentionally threw >> this error: >> >> Traceback (most recent call last): >> File "/var/www/html/angrynates.com/cart/createAssociations2.py < >> http://angryn

Re: MySQL Error

2010-01-01 Thread MRAB
Victor Subervi wrote: Hi; I'm trying to avoid the mortal sin of blank excepts. I intentionally threw this error: Traceback (most recent call last): File "/var/www/html/angrynates.com/cart/createAssociations2.py ", line 137, in ? create

Re: MySQL Error

2010-01-01 Thread Carsten Haese
Victor Subervi wrote: > However, "ProgrammingError" is not an error. How do I discover the real > error, so I can write the appropriate except statement? You're not making any sense. How did you determine that ProgrammingError is not an error or that it's not the "real error"? Show us the code you

Re: MySQL set and enum, calling values

2009-12-12 Thread Carsten Haese
Victor Subervi wrote: > On Fri, Dec 11, 2009 at 8:13 PM, Gabriel Genellina > mailto:gagsl-...@yahoo.com.ar>> wrote: > Are you sure the column is declared as SET and not, say, VARCHAR? > > > yes Indeed it is, and knowing that, I can actually decode your original post. I apologize that I didn'

Re: MySQL set and enum, calling values

2009-12-12 Thread Victor Subervi
On Fri, Dec 11, 2009 at 8:13 PM, Gabriel Genellina wrote: > En Fri, 11 Dec 2009 16:28:23 -0300, Victor Subervi < > victorsube...@gmail.com> escribió: > > On Fri, Dec 11, 2009 at 3:12 PM, Carsten Haese > >wrote: >> >> Victor Subervi wrote: >>> > [...] if I go to print, say, >>> > colFieldValues[2

Re: MySQL set and enum, calling values

2009-12-11 Thread Gabriel Genellina
En Fri, 11 Dec 2009 16:28:23 -0300, Victor Subervi escribió: On Fri, Dec 11, 2009 at 3:12 PM, Carsten Haese wrote: Victor Subervi wrote: > [...] if I go to print, say, > colFieldValues[20], which is a set, it prints out the whole set: > set('Extra-small','Small','Medium','Large','XLarge

Re: MySQL set and enum, calling values

2009-12-11 Thread Victor Subervi
On Fri, Dec 11, 2009 at 3:12 PM, Carsten Haese wrote: > Victor Subervi wrote: > > [...] if I go to print, say, > > colFieldValues[20], which is a set, it prints out the whole set: > > set('Extra-small','Small','Medium','Large','XLarge','XXLarge','XXXLarge') > > But if I print out colFieldValues[20

Re: MySQL set and enum, calling values

2009-12-11 Thread Carsten Haese
Victor Subervi wrote: > [...] if I go to print, say, > colFieldValues[20], which is a set, it prints out the whole set: > set('Extra-small','Small','Medium','Large','XLarge','XXLarge','XXXLarge') > But if I print out colFieldValues[20][0], it prints out "s". The only reasonable explanation of this

Re: mySQL access speed

2009-11-16 Thread John Nagle
Hans Müller wrote: Hello, I have some programs doing a lot sql IO in some mySQL databases. This works very fine and the DBAPI is quite simple to understand. Now I came to the point where I had to insert millions of lines into a table. If you're loading into an empty table, use the LOAD comm

Re: mySQL access speed

2009-11-16 Thread Dikkie Dik
> ... But it isn't very fast. > For executemany I have some hundred thousend lines in a list of tuples. > I joined() these lines to form an insert into table values () statement > and > blew it into the mysql cmdline client via os.popen(). > This was 60(!) times faster and loaded my table in s

Re: mysql select some sort of caching

2009-10-21 Thread Gabriel Genellina
En Wed, 21 Oct 2009 22:24:49 -0300, David Sfiligoi escribió: On Wed, 21 Oct 2009 00:45:21 -0300, Gabriel Genellina wrote: If you want to keep the cursor open, you must commit the (implicit) current transaction, even if it only contains selects (a rollback would work too). Alternatively, low

Re: mysql select some sort of caching

2009-10-21 Thread David Sfiligoi
On Wed, 21 Oct 2009 00:45:21 -0300, Gabriel Genellina wrote: > > If you want to keep the cursor open, you must commit the (implicit) > current transaction, even if it only contains selects (a rollback would > work too). > Alternatively, lower the transaction isolation level below "repeatable > rea

Re: mysql select some sort of caching

2009-10-20 Thread Gabriel Genellina
En Tue, 20 Oct 2009 23:41:10 -0300, David Sfiligoi escribió: whatever prior date I put in the table's last task date colum somehow they are not seen by the SELECT query sqlcur.execute("SELECT `url`d` from `url_snapshot` WHERE `url` = %s and `lastsnapshotdate` < %s",(url,currentdate)) that que

Re: mysql select some sort of caching

2009-10-20 Thread Stephen Hansen
On Tue, Oct 20, 2009 at 7:41 PM, David Sfiligoi wrote: > So normally I would open a connection and instentiate a cursor for my > queries once at a global level(like find out if the current date is > > than the last task date). Then go in an infinite loop that wait for data > to arrive in the queu

Re: MySQL Matrix manipulation in Python

2009-09-29 Thread MRAB
Threader Slash wrote: Hello Everybody, My doubt is about matrix data manipulation in python - I hope someone can point me some direction. I googled around, but there is not much good examples about playing with matrix in python on internet. My following function works pretty well, and give

Re: mysql hash generator in python

2008-12-17 Thread News123
Hi Matias. Could you show us the 'class implementation'? Whether class or not the result should be the same. If it isn't, then there should be a small error. If we have both code versions to look at it's easier to help you. bye N Matías Hernández wrote: > (sorry for my english, but i'm sp

Re: mySQL problems

2008-11-17 Thread John Nagle
Alfons Nonell-Canals wrote: Hello, I've developed a program using python that have to connect to a mysql server several times. In a local machine (running the program in the same machine where the mysql server is) I have no problems. I can run several instances of the program at the same time wi

Re: mySQL problems

2008-10-31 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Alfons Nonell-Canals wrote: > _mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL > server on 'HOST' (110)") Error 110 is ETIMEDOUT (Connection timed out). -- http://mail.python.org/mailman/listinfo/python-list

Re: mySQL problems

2008-10-28 Thread Tino Wildenhain
Alfons Nonell-Canals wrote: Hi, Maybe there is a certain connection limit which hits if your client programms reconnect in random order? I saw this on some PHP web sites. Probably some configuration adjustments and persistent connections could help you in this situation. I know I can check

Re: mySQL problems

2008-10-28 Thread Alfons Nonell-Canals
Hi, > Maybe there is a certain connection limit which hits if your client > programms reconnect in random order? I saw this on some PHP web sites. > > Probably some configuration adjustments and persistent connections > could help you in this situation. I know I can check it but I am not the ad

Re: mySQL problems

2008-10-28 Thread Tino Wildenhain
Hi, Alfons Nonell-Canals wrote: Hello, I've developed a program using python that have to connect to a mysql server several times. In a local machine (running the program in the same machine where the mysql server is) I have no problems. I can run several instances of the program at the same ti

Re: MySQL Insert

2008-07-16 Thread maestroQC
Thanks to all for your time and patience with this! The insert is working fine based on the suggestions in this thread. I now have another problem that should be resolved with a regular expression to remove currency formatting before inserting into the db. -- http://mail.python.org/mailman/listinf

Re: MySQL Insert

2008-07-15 Thread maestroQC
Thanks for the information. However I must stick to decimal since I'm dealing with monetary values. I loose the decimals with int and float has only supports one decimal place. I tried as you suggested to use the %s instead of the %d to no avail. -- http://mail.python.org/mailman/listinfo/python-l

Re: MySQL Insert

2008-07-15 Thread Ethan Furman
maestroQC wrote: Hi, Its one of those days. I cannot solve this. Any help would be greatly appreciated! When I execute this: class Db(object): def insertAccount(self, date, accountNumber, description, openingBalance): dec = decimal.Decimal(openingBalance) db = MySQLdb.connec

Re: MySQL Insert

2008-07-15 Thread Ethan Furman
maestroQC wrote: Hi, Its one of those days. I cannot solve this. Any help would be greatly appreciated! When I execute this: class Db(object): def insertAccount(self, date, accountNumber, description, openingBalance): dec = decimal.Decimal(openingBalance) db = MySQLdb.connec

Re: MySQL Insert

2008-07-15 Thread Carsten Haese
maestroQC wrote: cursor.execute("INSERT INTO es_accounts (dateCreated, accountNumber, description, openingBalance) VALUES (%s, %s, %s , %d)", (date, accountNumber, description, dec)) File "c:\python25\lib\site-packages\MySQLdb\cursors.py", line 151, in execute query = query % db.literal

Re: mysql to sqlite

2008-06-11 Thread Nick Craig-Wood
Gandalf <[EMAIL PROTECTED]> wrote: > I'm trying to convert mysql database to sqlite. is their any free tool > that does that? > I can convert my mysql db to XML file through phpmyadmin, will it be > easier to convert from XML to SQlite then from Mysql? I'd probably create the sqlite tables f

  1   2   >