A thread-compatible interface to the popular MySQL database server that provides the Python database API.
0
votes
1answer
28 views
Multiple arguments for Python MySQLdb clause
Below is a small subset of the data I'm working with. I can format the data any way I please. The data within the variable 'dc' is made up of the values 'id1' and 'id2'. What I want to do is be able ...
0
votes
2answers
29 views
MySQL sql as column
I've got the following table
db.queries
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| name | varchar(256) | NO | | | |
| sql | ...
0
votes
1answer
25 views
Python Tkinter listbox with MySQLdb
It's my first program in python and I'm trying to create a program that will interface a MySql address book with a asterisk server and make a call.
The "asterisk code part" is ok, I will add later, ...
0
votes
1answer
19 views
MySQL Python update rows
I am trying to update the data in a row of MySQL which this line of code is throwing this error.
for k in range(city_count):
cur.execute("UPDATE hqstock SET citylastprice = '%s' WHERE id = ...
0
votes
2answers
24 views
Python MysqlDb-How to store results of fetchone() in a list?
I need to store the result of fetchone() as separate elements in a list in python. To be in detail, soppose if fetchone() retrieves ('1L','chuvi','21L','student'), how can i store the retrieved result ...
0
votes
0answers
14 views
Python MySQLdb get connection details
Is there a way to access information like the host, username, and password from a MySQLdb connection object after MySQLdb.connect() has already been called?
0
votes
1answer
26 views
Python, MySQL Deletiong of row not working
Hello I'm trying to delete a row with this code:
sql = "DELETE FROM produto WHERE prod_nu = %s"
data = input("""
Type Data.
""")
cursor.execute(sql,(data))
The table produto does contain ...
0
votes
1answer
22 views
difference between SELECT queries embedded in for loop vs WHERE id IN syntax
Do one of these approaches perform better? Is there a better approach? Why? Does it matter that I'm doing this in python or not? (You can correctly assume there is an index on the id column of ...
0
votes
1answer
22 views
MySQLdb installation on Windows 7
I am running python 2.7 in windows 7. I'd like to link up to mysql and found MySQLdb. I have tried easy_install mysql-python and found the /Z1 error. Although I downloaded the source, I'd like to ...
0
votes
1answer
20 views
Python Syntax for Update SQL query
I want to update a table with the following query. I am getting multiple errors on the following. What is the correct syntax for writing the query below
cursor.execute("""UPDATE `%s` SET ...
-1
votes
1answer
65 views
Python 3.3.2 on Windows - MysqlDB & pymysql
I'm on Windows 8 using Python 3.3.2 , trying to connect to mysql online via ssh(putty) already running
I tried installing mysqldb using
pip install MySQL-python
but i get this LOG
...
0
votes
1answer
25 views
Read sql queries in python
I am a little lost in something I am trying to do. Learning how to run sql within Python.
I have a db in in Python sqlite with three tables 1, 2, 3.
I then have a series of several queries I have ...
0
votes
1answer
52 views
Can't connect to MySQL from django website with Python 2.7, but is ok with Python 2.5
When I use Python 2.7 to connect to MySQL I get:
Traceback (most recent call last):
File "C:\Programs\Python27\lib\site-packages\django\core\management\commands\runserver.py", line 48, in ...
0
votes
2answers
55 views
best way to run python generator cleanup code
I'm trying to write a generator function that gets rows out of a database and returns them one at a time. However, I'm not sure if the cleanup code marked ** below executes as I think it does. If it ...
0
votes
0answers
205 views
EnvironmentError: mysql_config not found
EnvironmentError: mysql_config not found, while installing MySQL-python
Could someone advice me on what to do? I did the following from my-side:
Error I got while installing with pip:
...
0
votes
1answer
35 views
Passing variables (table name,data) into python mysqld query
I am trying to pass the name of the table and information to be inserted into the table as parameters. The query I have come up with is below:
sql = """INSERT INTO `%s` (title,link,description) ...
0
votes
0answers
32 views
Python MySQLDB : 2014, Commands out of sync; you can't run this command now
I have following code that runs in a remote server, I have look into every single option to avoid this error but some how I am unable to figure it out:
I am using SSDictcursor, yet the problem is ...
1
vote
1answer
38 views
django with mysql what does 'maximum number of connections'?
I am writting simple application which django that can be used internally inside my office. probably 1000 people i say. I dont have any session handling, user handling. It is just a store/view process ...
0
votes
0answers
21 views
ResourceClosedError with mysql, sqlalchemy and celery
I am using sqlalchemy in an app where celery tasks use a scoped session to interact with mysql.
db.py
engine = create_engine(
'mysql://root:pass@localhost/testdb?charset=utf8&use_unicode=0',
...
0
votes
0answers
42 views
Python MySQLdb handle multiple cursors: Command out of sync
I have a database connection method that creates the connection and sets the cursor as a part of init process.
Then I have following method that uses the cursor:
def calculatePercentile(self):
...
1
vote
2answers
24 views
Python Mysqldb returning '\x01' for bit values
Im using Mysqldb with Python(2.7) to return a bunch of values form a Mysql database with a charset latin1.
The mysql database has values of type bit(1) when these are returned they look like this ...
0
votes
2answers
34 views
How to pass a list of *columns* to MySQLDb execute
It's possible to pass a tuple to MySQLdb for use in an IN clause, but is it possible to pass a tuple for use as a column list? This doesn't work:
cursor.execute("SELECT %s FROM users", ...
0
votes
0answers
24 views
install from sources on pythonbrew
I have installed python 2.7.5, 3.0.1 with pythonbrew but every times I try to run pip install , I've got : No module named ssl_match_hostname error.
So I decided to installed from sources (mysqldb ...
5
votes
2answers
118 views
Using mysqldb and sqlite3 in the same Python 2.7 script: Should I throw in the towel?
I'm writing a Python script that is meant to pull from, process, and update to a MySQL database.
I originally started attacking this problem with comma-separated value dumps of the MySQL databases, ...
0
votes
0answers
98 views
pip install mysql-python not working on OSX
I'm running into the following problem and am unable to find a solution after tinkering and searching on google.
Basically, running this command from a python 2.7 virtualenv
pip install mysql-python
...
-2
votes
1answer
40 views
Python MySQL won't work
I installed python mysqldb with command: apt-get install python-mysqldb, everything was fine but I cannot open any python script with:
import mysqldb
I still get information:
ImportError: No ...
1
vote
1answer
26 views
Python, MySQLdb, unable to update row
I know SO is not a "debug my code service" but after checking and retrying for hours either I'm missing something very stupid or maybe there's a bug (or bad compilation) in my MySQLdb module...
Also ...
0
votes
1answer
40 views
change CLIENT_FOUND_ROWS flag in django for mysql-python (MySQLdb)?
I have a problem with MySQL 5.5 INSERT ... ON DUPLICATE KEY UPDATE rows effected mismatch cursor.rowcount in a normal Django project
According to doc:
For INSERT ... ON DUPLICATE KEY UPDATE ...
2
votes
1answer
44 views
Mysql database connection with Jython
Hello i'm trying to get a mysql database connection with jython.
I'm using Python 3.3.2 and Jython 2.5.3
My code looks like this:
import sys
from java.sql import *
...
0
votes
0answers
32 views
Failed to save a record in django: invalid literal for int () With base 10: 'Auto'
I have a problem saving my record in the database, my model is:
class people(model.Models):
full_name = models.CharField(max_length=240)
born_date = models.DateField()
country = ...
0
votes
0answers
34 views
how to enable mysqldb auto reconnect mysql
Mysqldb is a third-party module used by python to connect mysql.How to enable autoreconnect in Mysqldb so that we can use conn.ping(true) to reconnect a idle connection.
0
votes
1answer
194 views
First: “Unable to find vcvarsall.bat” and Now: “TypeError: unorderable types: NonType() >= str()”
I am currently in the process of setting up django on a windows machine. So far I have done the following:
Installed Python 3.3 -> SUCCESS!
Installed Django -> SUCCESS!
Installed MySql Database -> ...
0
votes
0answers
33 views
Sending unicode characters to mysql database with Python
I 've been having a lot of trouble with sending unicode characters to a database for the last couple of hours. I am using the MySQLdb Python library. I had to first declare the enconding, so that I ...
0
votes
1answer
75 views
Unable to install MySQL-python “ invalid command 'egg_info' ”
I'm getting a weird error after running
$ pip install mysql-python
Has anyone seen an error like this with "egg_info" being invalid?
I'm running OSX mountain lion
Downloading/unpacking ...
0
votes
1answer
64 views
MySQLdb - fetchone()'s value does not change
THis is what I do in Python:
>>> import MySQLdb
>>> connect = MySQLdb.connect(...)
>>> cur = connect.cursor()
>>> cur.execute('select max(Logid) from Log;')
1L
...
1
vote
1answer
44 views
MySQLdb on MAC OS 10.6.8
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ...
0
votes
0answers
51 views
How to pass text to MySQL
How can insert text to MySQL after I extract it from website?
Here is what I extracted.
Company
September 15
Administration
Manager
Car
Driver
This is my beatifulsoup code:
import urllib
from ...
0
votes
1answer
163 views
Unable to do pip install mysql-python on virtualenv
I use macports and I have successfully install mysql5 using macports, and my python also managed by macports. Currently I am trying to do pip install mysql-python on my virtualenv but I am getting an ...
-4
votes
1answer
54 views
Removing whitespace from MySQL columns using Python
I have an application connected to a MySQL database from Python.
I would like to remove all new lines, tab characters, and extra space from each entry in every table.
Can I do this, for example ...
0
votes
0answers
86 views
How to setup numpy+scipy+matplotlib+MySQL with virtualenv in Eclipse or Scipy?
I need the following:
an IDE with an integrated console, code-completion and preferably a "help"-window for functions I am about to use, similarly to Matlab
the ability to access the mySQL-database ...
0
votes
0answers
8 views
getting rid of empty inno databases
Some time ago I created a database and tables doing a tutorial. After I deleted the tables(don't remember why) and now all I have is a database with no tables.
Trying to clean up my db I wanted to ...
0
votes
1answer
57 views
MySQL and python-mysql (mysqldb) crashing under heavy load
I was just putting the finishing touches to a site built using web.py, MySQL and python-mysql (mysqldb module) feeling good about having projected from sql injections and the like when I leant on the ...
0
votes
0answers
49 views
Python test hangs when mysql truncate or drop is called
Using Windows 7, XAMPP, Mysql, the MySQLdb python connector and python 2.7.
I'm developing tests for my first "real" application using the unittest module. In this test enviroment I first truncate ...
1
vote
1answer
177 views
django settings.py syncdb (“Can't connect to MySQL server on (111)”)
I have some sipmlest settings with two servers. On first(192.168.250.199) I have django, and on another(192.168.250.200) i have a mysql server
192.168.250.200:/etc/my.cnf
[mysqld]
#Base settings for ...
0
votes
1answer
124 views
SSH Tunnel for Python MySQLdb connection with public key
I am trying to use MySQLdb but I didn't find anywhere how to make connection throught a SSH Tunel using a public key. Anybody can please guide me throught this ?
Thank you very much.
0
votes
1answer
47 views
Updating a SQL table with Python 2.7?
I am using Python 2.7 to extract information from webpages (with BeautifulSoup), sort that information and insert it into a SQL table (with MySQLdb). That is quite simple, and I was able to find great ...
0
votes
0answers
38 views
please help me i got error #1064 in mysql file
Hope You are all fine,
i have little problem in my SQL file, when i try to import it it,s show following error,
1064 - You have an error in your SQL syntax; check the manual that corresponds to ...
0
votes
1answer
37 views
Error when inserting row to table with MySQLdb
What is wrong below?
import MySQLdb as mysql
import datetime
db = mysql.connect("localhost","root","passworld","employees" )
cursor = db.cursor()
sql = "INSERT INTO employee(id, firstname, surname, ...
0
votes
1answer
20 views
MySQLdb - Overwrite a databse
I have an online database and connect to it by using MySQLdb.
db = MySQLdb.connect(......)
cur = db.cursor()
cur.execute("SELECT * FROM YOUR_TABLE_NAME")
data = cur.fetchall()
Now, I want to write ...
1
vote
1answer
19 views
MySQLdb initial connection timeout
I'm using MySQLdb in python to connect to a remote database and execute a query. So far so good. However, it's possible that, for any number of reasons, there simply isn't a MySQL server (or indeed ...