mysql-python

Sleeping Processes in MySQL

[亡魂溺海] 提交于 2019-12-24 15:20:06
问题 I have a series of python scripts that are designed to be long running. When I look at the MySQL process monitor, I see that three of them will always have a time of 0, then 2 of them that I use to actually insert data into the database will have values that are always counting up, and never get reset to 0 meaning that eventually they encounter the dreaded 'MySQL has gone away'. I am using MySQLdb. Can someone please explain why this happens? Is there a way to make sure that they reset this

Failed pip install mysql-python

孤街浪徒 提交于 2019-12-24 09:59:56
问题 I am running this in Windows environment using python version 2.7, while running below will give error, running pip install mysql-python for the testproject will give similiar error too. I tried download and run installer from http://www.codegood.com/archives/4, but it says python version 2.6 required but not found in registry. Some resources say mysql_config file is missing, is this the case? C:\django\testproject\build\MySQL-python>setup.py build Traceback (most recent call last): File "C:

Easier setup for writing to MySQL on OSX with Python

拈花ヽ惹草 提交于 2019-12-24 09:59:53
问题 I have a Python script that writes to a MySQL database using mysql-python. This is fine for Linux and Windows but on OSX this library is too difficult for my clients to install. Requires editing configuration files, directory symlinks, installing gcc, xcode, ... An overwhelming process for non-technical users. So, is there a more practical way to support writing to MySQL on OSX? Some potential alternatives: https://github.com/petehunt/PyMySQL http://www.egenix.com/products/python/mxODBC/ http

How do I get pylint to recognize MySQLdb members?

南楼画角 提交于 2019-12-24 02:25:37
问题 import MySQLdb try: dbcon = MySQLdb.connect(host=host_name, user=user_name, passwd=password, db=db_name) except MySQLdb.Error: pass getting this pylint warning Module 'MySQLdb' has no 'Error' member (no-member) 回答1: The Best: Using extension-pkg-whitelist option: A comma-separated list of package or module names from where C extensions may be loaded. Extensions are loading into the active Python interpreter and may run arbitrary code --extension-pkg-whitelist=_mysql PyLint parses (by default)

Installing MySQLdb specifically in python 2.7 on centos

北战南征 提交于 2019-12-24 00:53:31
问题 I'm using CentOS release 6.5 (Final). I 'm currently using python 2.4, in which I can use MySQL without problems. root@dedicado [/home/digicelc/public_html/gestion/python/cater]# python >>> import MySQLdb >>> But, when I try it from python2.7 root@dedicado [/home/digicelc/public_html/gestion/python/cater]# python2.7 >>> import MySQLdb Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named MySQLdb >>> I don't want to change the python version in the

Issues installing MySQLdb with Python 3.6.5: Can't open 'mysql.h' - and Can't open : 'config-win.h': No such file or directory

廉价感情. 提交于 2019-12-23 20:02:18
问题 I am trying to use mysql with python SQLAlchemy however python fails to install MySQL or even recognize it is installed. Below are the details: I'm running this on Windows 10 64 bit and Anaconda Python 3.6.5 I downloaded MySQL through MAMP: Mac-Apace-MySQL-PHP https://www.mamp.info/en/ I have tried running my code on VSC and Jupyter. If I try running the code pip install mysqlclient _mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory error: command

Installing python-mysql with wamp's mysql

≯℡__Kan透↙ 提交于 2019-12-23 18:06:53
问题 (I'm not sure if this should be asked here or SU.. but seeing this question on SO, I am asking it here...) I have wamp (mysql-5.1.33) server setup on my vista machine, and I am trying to install python-mysql 1.2.3c1 to use the mysql version provided by wamp. At first, when I ran python setup.py install , I got an error saying it couldn't find the location of the mysql's bin folder. Looking into setup_windows.py , I noticed it was looking for a registry key and so I added that registry entry

MySQLdb executemany using a list as input?

帅比萌擦擦* 提交于 2019-12-23 14:01:52
问题 I am wanting to use an executemany within my program to store 20 records at once, heres what it says in the documentation... c.executemany( """INSERT INTO breakfast (name, spam, eggs, sausage, price) VALUES (%s, %s, %s, %s, %s)""", [ ("Spam and Sausage Lover's Plate", 5, 1, 8, 7.95 ), ("Not So Much Spam Plate", 3, 2, 0, 3.95 ), ("Don't Wany ANY SPAM! Plate", 0, 4, 3, 5.95 ) ] ) However, I have my values in a list, and would rather not do 18 versions of the above, using an index on my list.

MySQLdb executemany using a list as input?

寵の児 提交于 2019-12-23 14:01:44
问题 I am wanting to use an executemany within my program to store 20 records at once, heres what it says in the documentation... c.executemany( """INSERT INTO breakfast (name, spam, eggs, sausage, price) VALUES (%s, %s, %s, %s, %s)""", [ ("Spam and Sausage Lover's Plate", 5, 1, 8, 7.95 ), ("Not So Much Spam Plate", 3, 2, 0, 3.95 ), ("Don't Wany ANY SPAM! Plate", 0, 4, 3, 5.95 ) ] ) However, I have my values in a list, and would rather not do 18 versions of the above, using an index on my list.

MySQL select and update in one query

余生颓废 提交于 2019-12-23 09:37:23
问题 I'm trying to select a value from MySQL (total_points) then add to a local variable (new_points) and update total_points in the SAME query, does anyone know if this is possible... I currently have., cursor = database.cursor() cursor.execute("""SELECT total_points FROM g_ent WHERE e_id =%s AND user =%s; UPDATE total_points = (total_points + %s)""" ,(e_id, user_name, new_points)) database.commit() 回答1: The issue is that your SQL syntax is not correct. The query should be: UPDATE g_ent SET total