Questions tagged [mysql-connector-python]

MySQL Connector/Python is a pure-Python database adapter which enables Python programs to access to MySQL databases.

MySQL Connector/Python is a pure-Python database adapter which enables Python programs to access to MySQL databases.

539 questions
42
votes
3 answers

Python mySQL Update, Working but not updating table

I have a python script which needs to update a mysql database, I have so far: dbb = MySQLdb.connect(host="localhost", user="user", passwd="pass", db="database") try: curb = dbb.cursor() curb.execute ("UPDATE…
user2144306
  • 423
  • 1
  • 4
  • 4
39
votes
8 answers

Unable to find Protobuf include directory during install mysql-connector over pip

I pulled mysql-connector-python code and when I run python ./setup.py build I get the following error: Unable to find Protobuf include directory. pip install Protobuf was useless How can I solve this problem?
wei.lu
  • 401
  • 1
  • 4
  • 5
32
votes
4 answers

What are the differences between mysql-connector-python, mysql-connector-python-rf and mysql-connector-repackaged?

I'd like to use the mysql-connector library for python 3. I could use pymysql instead, but mysql-connector already has a connection pool implementation, while pymysql doesn't seem to have one. So this would be less code for me to write. However,…
John Smith Optional
  • 22,259
  • 12
  • 43
  • 61
32
votes
5 answers

python mysql.connector DictCursor?

In Python mysqldb I could declare a cursor as a dictionary cursor like this: cursor = db.cursor(MySQLdb.cursors.DictCursor) This would enable me to reference columns in the cursor loop by name like this: for row in cursor: # Using the cursor as…
panofish
  • 7,578
  • 13
  • 55
  • 96
31
votes
7 answers

I cannot install mysql-connector-python using pip

I am trying to install mysql-connector-python==1.0.12 as part of my project's automated installation, and I get the following error from pip install: Collecting mysql-connector-python==1.0.12 (from -r /tmp/requirements.txt (line 20)) Could not find…
Amnon
  • 2,212
  • 1
  • 19
  • 35
19
votes
1 answer

what is a mysql buffered cursor w.r.t python mysql connector

Can someone please give an example to understand this? After executing a query, a MySQLCursorBuffered cursor fetches the entire result set from the server and buffers the rows. For queries executed using a buffered cursor, row-fetching methods…
gpk27
  • 809
  • 2
  • 8
  • 19
16
votes
6 answers

Character set 'utf8' unsupported in python mysql connector

I'm trying to connect my database to a python project using the MySQL connector. However, when using the code below, import mysql.connector mydb = mysql.connector.MySQLConnection( host="localhost", user="veensew", …
Veen
  • 163
  • 1
  • 1
  • 5
13
votes
3 answers

MySQL Connector could not process parameters

I'm trying to loop through an array and insert each element into a table. As far as I can see my syntax is correct and I took this code straight from Microsoft Azure's documentation. try: conn = mysql.connector.connect(**config) …
ajjohnson190
  • 494
  • 2
  • 7
  • 21
13
votes
6 answers

cursor() raise errors.OperationalError("MySQL Connection not available.") OperationalError: MySQL Connection not available

import requests import time import csv import ast import sys import mysql.connector config = { 'user': 'root', 'password': 'password', 'host': '127.0.0.1', 'port': '3306', 'database': 'dbname', 'raise_on_warnings': True,} cnx =…
dyingduck
  • 163
  • 1
  • 1
  • 7
12
votes
1 answer

Python - MySQL Connector error in Mac OSX 10.10

import mysql.connector config = { 'user' : 'root', 'passwd' : ' ', 'host' : 'localhost', 'raise_on_warnings' : True, 'use_pure' : False, } cnx = mysql.connector.connect(**config) cnx.close() I used this code to check my…
12
votes
1 answer

MySql cursors.execute() with only one parameter: Why is a string sliced into a list?

Status Quo: I have a working database with tables and can query, insert, update, etc. Also the cursor is connected to the right database. The table: Problem: When it comes to querying data from a table I run into trouble: query = 'SELECT…
Rappel
  • 696
  • 2
  • 6
  • 14
12
votes
8 answers

mysql for python 2. 7 says Python v2.7 not found

I have downloaded mysql-connector-python-1.0.7-py2.7.msi from MySQL site and try to install but it gives error that Python v2.7 not found. We only support Microsoft Windows Installer(MSI) from python.org. I am using Official Python v 2.7.3 on…
Mayur Patil
  • 952
  • 1
  • 10
  • 18
11
votes
1 answer

MySQL connection pool in python?

I'm trying to process large amount of data using Python and maintaining processing status in MySQL. However, I'm surprised there is no standard connection pool for python-mysql (like HikariCP in Java). I initially started with PyMySQL, things were…
10
votes
1 answer

Python loses connection to MySQL database after about a day

I am developing a web-based application using Python, Flask, MySQL, and uWSGI. However, I am not using SQL Alchemy or any other ORM. I am working with a preexisting database from an old PHP application that wouldn't play well with an ORM anyway, so…
DMJ
  • 722
  • 4
  • 20
10
votes
1 answer

Unable to use None (NULL) values in python mysql.connector in prepared INSERT statement

When trying to use prepared cursor and insert NULL values the mysql.connector reports an error: mysql.Error: 1210 (HY000): Incorrect arguments to mysqld_stmt_execute Here is a code that shows this exactly. from __future__ import…
heidar.rafn
  • 101
  • 1
  • 4
1
2 3
35 36