Re: Python MySQL Guide

2018-08-10 Thread Vishal Hule
Sure, no problem. I also added a table of contents at the start of the article you can also refer that On Fri, 10 Aug 2018, 6:43 pm Bob Gailer, wrote: > Thank you for this offer. My reaction is I don't like having to scroll > through one very long page to find what I'm looking for. Might you co

Re: Python MySQL Guide

2018-08-10 Thread Bob Gailer
Thank you for this offer. My reaction is I don't like having to scroll through one very long page to find what I'm looking for. Might you consider breaking it up into a number of smaller pages and giving an index as the main page? On Aug 9, 2018 5:18 PM, wrote: > Refer this complete guide on wor

Re: Python, mySQL and password

2013-12-16 Thread Ervin Hegedüs
Hello Peter, On Mon, Dec 16, 2013 at 12:38:33PM +0100, Peter Otten wrote: > Ervin Hegedüs wrote: > > > dsn['passwd'] = raw_input("Enter password for %s: " % (dsn['user'])) > > [...] > > but at this way the password what you type will showing! > > To avoid that use getpass.getpass() instead of

Re: Python, mySQL and password

2013-12-16 Thread Peter Otten
Ervin Hegedüs wrote: > Hello, > > On Mon, Dec 16, 2013 at 02:55:29AM -0800, Igor Korot wrote: >> Hi, ALL, >> Is there a way to make python script that connects to mySQL DB ask for >> a password on the: >> >> conn = mdb.connect(host, user) >> >> line. >> The host variable is "localhost" and the

Re: Python, mySQL and password

2013-12-16 Thread Ervin Hegedüs
Hello, On Mon, Dec 16, 2013 at 02:55:29AM -0800, Igor Korot wrote: > Hi, ALL, > Is there a way to make python script that connects to mySQL DB ask for > a password on the: > > conn = mdb.connect(host, user) > > line. > The host variable is "localhost" and the user variable is "root" (for > devel

Re: Python - MySQL fetching values

2010-05-07 Thread Kurian Thayil
On Thu, May 6, 2010 at 2:42 PM, Chris Rebert wrote: > On Thu, May 6, 2010 at 1:47 AM, Kurian Thayil > wrote: > > > the expected output is 05:35:05. > > > > Now, here is code snippet, > > > > cursor1=getconnect1.cursor() > > getrows=cursor1.execute("""SELECT > > T

Re: Python - MySQL fetching values

2010-05-06 Thread Chris Rebert
On Thu, May 6, 2010 at 1:47 AM, Kurian Thayil wrote: > the expected output is 05:35:05. > > Now, here is code snippet, > >     cursor1=getconnect1.cursor() >     getrows=cursor1.execute("""SELECT > TIME(DATE_ADD(info_last_calltime, INTERVAL %s MINUTE)) FROM rem_call_info >

Re: Python/MySQL Frustration

2009-09-20 Thread John Nagle
Dennis Lee Bieber wrote: On Sun, 20 Sep 2009 14:25:53 -0400, Victor Subervi declaimed the following in gmane.comp.python.general: Hi; I have the following code: while i < num: cat = 'cat' + str(i) cat = form.getfirst(cat, '') item = 'item' + str(i) item = form.get

Re: Python/MySQL Frustration

2009-09-20 Thread Victor Subervi
Yeah, that was the problem..."num" was a string ;) Just caught it myself, too. Thanks, V On Sun, Sep 20, 2009 at 2:37 PM, Philip Semanchuk wrote: > > On Sep 20, 2009, at 2:25 PM, Victor Subervi wrote: > > Hi; >> I have the following code: >> >>while i < num: >> cat = 'cat' + str(i) >>

Re: Python/MySQL Frustration

2009-09-20 Thread Philip Semanchuk
On Sep 20, 2009, at 2:25 PM, Victor Subervi wrote: Hi; I have the following code: while i < num: cat = 'cat' + str(i) cat = form.getfirst(cat, '') item = 'item' + str(i) item = form.getfirst(item, '') descr = 'descr' + str(i) descr = form.getfirst(descr, '')

Re: Python & MySQL problem with input to table..!

2007-06-29 Thread hiroc13
Thanks It is working! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python & MySQL problem with input to table..!

2007-06-29 Thread Justin Ezequiel
On Jun 29, 4:26 pm, hiroc13 <[EMAIL PROTECTED]> wrote: > >>> import MySQLdb > >>> db = MySQLdb.connect (host = "localhost", user = "root", passwd = "pass", > >>> db = "base1") > >>> c = db.cursor () > >>> c.execute(""" INSERT INTO table1 (prvo, drugo) VALUES ('test', '1') """) > >>> c.execute("SEL

Re: Python/MySQL problem on Windows

2006-09-27 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Eric Smith wrote: > I could have sworn that I got the use of connection() from published > sample code, but I must be mistaken. If all else fails, read the documentation , -- http://mail.python.org/mailman/listinfo/python-

Re: Python/MySQL problem on Windows

2006-09-20 Thread Eric Smith
Carsten Haese <[EMAIL PROTECTED]> writes: > What happens if you use connect(...) instead of connection(...)? Then it works! :-) I could have sworn that I got the use of connection() from published sample code, but I must be mistaken. Thanks! Eric -- http://mail.python.org/mailman/listinfo/

Re: Python/MySQL problem on Windows

2006-09-20 Thread Carsten Haese
On Wed, 2006-09-20 at 16:37, Eric Smith wrote: > I'm trying to use Python 2.4.3 and pywin32-209 to access a MySQL > database on Windows Server 2003 Standard Edition, and not having much > luck. It seems like parts of the MySQLdb module are not getting loaded > correctly, but no error message is giv

Re: python/mysql/list question...

2006-08-10 Thread John Machin
bruce wrote: > hi. > > i have the following sample code. i'm trying to figure out if there's a way > to use a 'list of lists' in a mysql execute... > > i've tried a variety of combinations but i get an error: > Error 1241: Operand should contain 1 column(s) > > the test code is: > > insertSQL = "

RE: python/mysql/list question...

2006-08-10 Thread bruce
never mind... doh!!! executemany as opposed to execute!!! thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of bruce Sent: Thursday, August 10, 2006 6:37 PM To: python-list@python.org Subject: python/mysql/list question... hi. i have the following sa

Re: Python, Mysql, insert NULL

2006-05-18 Thread Yaron Butterfield
I figured this out. Because I am using InnoDB, I need to add the commit statement. Phew. Yaron Butterfield wrote: > Hi, > > I've been having problems using Python to insert data into a MySQL > database. I've donw web searches and pulled my hairs out getting it > to work but cannot. I have

Re: python-mysql on Windows -- How to?

2006-04-21 Thread BartlebyScrivener
Oh, good. Do report back. It comes up often, and I've used only mxODBC. rd -- http://mail.python.org/mailman/listinfo/python-list

Re: python-mysql on Windows -- How to?

2006-04-21 Thread Chris Seymour
HI Rick, I did some searching on SourceForge and found a Windows installer for the mysql-python 1.2.0. (MySQL-python.exe-1.2.0.win32-py2.4.zip). I unzipped and ran this installer and seem to be all set. I will keep testing. Thanks. Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: python-mysql on Windows -- How to?

2006-04-21 Thread BartlebyScrivener
Chris, I'm no expert, but this keeps coming up and the last several people have had better luck with mxODBC. http://tinyurl.com/fmp3y But if you're set on MySql-Python someone will jump in to help. rick -- http://mail.python.org/mailman/listinfo/python-list

Re: Python, Mysql, insert NULL

2005-10-06 Thread Thomas Bartkus
"Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > > If you don't understand parameterized SQL queries you would do well to > refrain from offering database advice :-) Did the poster ask a question about parameterized queries or server security? > Presumably you always

Re: Python, Mysql, insert NULL

2005-10-06 Thread Python_it
Thanks for the many replies! The problem was that is use '%s', i have to use %s and then my problem is solved. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python, Mysql, insert NULL

2005-10-06 Thread Steve Holden
Thomas Bartkus wrote: [...] > > Others here have pointed out that the Python keyword "None" is converted to > "Null" when passed to MySQL. I don't quite understand this and don't really > care. If I have a Python variable that has a value None, and I want to > transmit this to MySQL as Null - I w

Re: Python, Mysql, insert NULL

2005-10-05 Thread Thomas Bartkus
"Python_it" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I know how to insert values in a database. > That's not my problem! > My problem is how i insert NULL values in de mysql-database. > None is een object in Python and NULL not. > None is not converted to NULL? > Table shows No

Re: Python, Mysql, insert NULL

2005-10-05 Thread deelan
Python_it wrote: > I know how to insert values in a database. > That's not my problem! > My problem is how i insert NULL values in de mysql-database. > None is een object in Python and NULL not. > None is not converted to NULL? > Table shows None and not NULL! None is converted to mysql's NULL and

Re: Python, Mysql, insert NULL

2005-10-05 Thread Steve Holden
Python_it wrote: > I know how to insert values in a database. > That's not my problem! > My problem is how i insert NULL values in de mysql-database. So you *don't* know how to insert values in a database: as Laszlo wrote, you might be best using parameterized queries. > None is een object in Py

Re: Python, Mysql, insert NULL

2005-10-05 Thread Gerhard Häring
Python_it wrote: > I know how to insert values in a database. > That's not my problem! > My problem is how i insert NULL values in de mysql-database. > None is een object in Python and NULL not. > None is not converted to NULL? > Table shows None and not NULL! As Laszlo wrote, "None will be conver

Re: Python, Mysql, insert NULL

2005-10-05 Thread Python_it
I know how to insert values in a database. That's not my problem! My problem is how i insert NULL values in de mysql-database. None is een object in Python and NULL not. None is not converted to NULL? Table shows None and not NULL! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python, Mysql, insert NULL

2005-10-05 Thread Laszlo Zsolt Nagy
> > BTW, you did not write which driver are you using. Oh, you did. Sorry. :-( Import your DB module 'yourmodule' and then print yourmodule.paramstyle Description of paramstyle is also in PEP249: paramstyle String constant stating the type of parameter marker

Re: Python, Mysql, insert NULL

2005-10-05 Thread Laszlo Zsolt Nagy
Python_it wrote: >Python 2.4 >MySQL-python.exe-1.2.0.win32-py2.4.zip > >How can I insert a NULL value in a table (MySQL-database). >I can't set a var to NULL? Or is there a other possibility? >My var must be variable string or NULL. >Becaus i have a if statement: >if > cursor.execute("..

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: Python, mysql, floating point values question

2005-07-03 Thread beliavsky
Dennis Lee Bieber wrote: > Considering how often this has come up, I've sort of lost faith > in CS programs at colleges. Now, this might be an unfair statement as I > don't know if any of those bringing up the question ever had college CS > courses... But the fluff of floating point data was

Re: Python, mysql, floating point values question

2005-07-02 Thread Terry Hancock
On Saturday 02 July 2005 10:50 pm, Peter Hansen wrote: > Terry Hancock wrote: > > On Saturday 02 July 2005 08:53 pm, Dennis Lee Bieber wrote: > > And for that matter, some of the posters here have *been* 14. > > Terry, almost every single one of the posters here have been 14. > At some time. :-) U

Re: Python, mysql, floating point values question

2005-07-02 Thread Peter Hansen
Terry Hancock wrote: > On Saturday 02 July 2005 08:53 pm, Dennis Lee Bieber wrote: > And for that matter, some of the posters here have *been* 14. Terry, almost every single one of the posters here have been 14. At some time. :-) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Python, mysql, floating point values question

2005-07-02 Thread Terry Hancock
On Saturday 02 July 2005 08:53 pm, Dennis Lee Bieber wrote: > On Sat, 2 Jul 2005 18:49:20 -0400, Christopher Kang > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > I've been doing the epsilon comparisons, i had just hoped that to be a > > temporary solution. > > > Consid

Re: Python, mysql, floating point values question

2005-07-02 Thread Christopher Kang
Thanx all for responding. I've been doing the epsilon comparisons, i had just hoped that to be a temporary solution. anyway, thanx for the responses -- http://mail.python.org/mailman/listinfo/python-list

Re: Python, mysql, floating point values question

2005-07-02 Thread Terry Hancock
On Friday 01 July 2005 11:13 pm, John Machin wrote: > x BETWEEN y AND z Ah, even better, thank you. >The python equivalent would be to write it out as: > > > > if a > b-epsilon and a < b+epsilon: > > print "a~=b" > > Try this: > > if b-epsilon < a < b+epsilon: This I knew, but I

Re: Python, mysql, floating point values question

2005-07-02 Thread qwweeeit
Hi Christopher, if you have to make calculations or comparing operations, the only "safe" method is to save and use only integer values. Of course there must be a preventive agreement on the precision you want to have (2, 3 4 ... decimals). The sw part is straigthforward: - to save in the database

Re: Python, mysql, floating point values question

2005-07-01 Thread John Machin
Terry Hancock wrote: > On Friday 01 July 2005 05:40 pm, Christopher Kang wrote: > >>Anyway, I have a problem where I am pulling floating point values out >>of mysql and into python using the MYSQLdb module. >> >>However, the values seem to be altered a little when I store them in python. > > > I

Re: Python, mysql, floating point values question

2005-07-01 Thread Terry Hancock
On Friday 01 July 2005 05:40 pm, Christopher Kang wrote: > Anyway, I have a problem where I am pulling floating point values out > of mysql and into python using the MYSQLdb module. > > However, the values seem to be altered a little when I store them in python. I'm not even going to start to exp

Re: Python, mysql, floating point values question

2005-07-01 Thread [EMAIL PROTECTED]
Christopher Kang wrote: > I had a question about python and mysql, but I want to first thank > those who taught me about the factory method, it was exactly what I > needed. > > Anyway, I have a problem where I am pulling floating point values out > of mysql and into python using the MYSQLdb modul

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: Python & MySQL

2005-04-05 Thread [EMAIL PROTECTED]
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! There ya go. Works like a champ. I swear I was pulling my hair out yesterday over this. -- http

Re: Python & MySQL

2005-04-05 Thread Steve Holden
[EMAIL PROTECTED] wrote: Hi all, I've got a weird problem. I was running Python 2.3 and MySQLdb and had everything running fine. Cutting to the chase: After upgrading to 2.4 (and latest modules) the MySQLdb functions in Python can connect to the database, do queries and do inserts. Or rather, it s

Re: Python & MySQL

2005-04-05 Thread Steve Holden
[EMAIL PROTECTED] wrote: Hi all, I've got a weird problem. I was running Python 2.3 and MySQLdb and had everything running fine. Cutting to the chase: After upgrading to 2.4 (and latest modules) the MySQLdb functions in Python can connect to the database, do queries and do inserts. Or rather, it s