mysql-connector-python

Not enough parameters for the SQL statement error

Not enough parameters for the SQL statement error Question: i’m trying to import csv file into SQL table but i received this error "Not enough parameters for the SQL statement" i think that it’s something in the SQL query … import mysql.connector as msql import csv conn = msql.connect(host=’localhost’, user=’root’, password=”, database=’test_database’) my_cursor = conn.cursor() …

Total answers: 2

Lost connection between Python program and MySQL

Lost connection between Python program and MySQL Question: Why do I get this error? Mysql.connector.errors.DatabaseError: 2003 (HY000): Can’t connect to MySQL server n ‘3.XX.XXX.89’ (110) I am collecting data from MQTT broker and storing it in a MySQL database. For subscribing to the topics on MQTT broker, I am using Paho MQTT client and for …

Total answers: 1

Python does cursor execute load all data

Python does cursor execute load all data Question: I am trying to query a large data (10 million rows) and try to prevent out of memory, but not familiar with Python and confused with different opinions regarding the execute(), cursor iterator and fetchone() Am I right to assume that cursor.execute() does not load all data …

Total answers: 2

Failed to insert user input into MySQL database

Failed to insert user input into MySQL database Question: I have created a database and inserted some value using python manual code but when i tried to taking input from user then inserting that input to my database table,i failed as i tried many ways. Here is my code import mysql.connector mydb = mysql.connector.connect( host=”localhost”, …

Total answers: 1

How to connect to mysql in pycharm community edition?

How to connect to mysql in pycharm community edition? Question: I have a fresh install of pycharm community edition 2019.2 on mac 10.13.1 I want to connect to the mysql database I have locally. I wrote a python file that starts import mysql.connector The ‘mysql’ part is underlined red, so I hover over it and …

Total answers: 2

MySQL Connector could not process parameters

MySQL Connector could not process parameters Question: 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) print(“Connection established”) except mysql.connector.Error as err: if err.errno == errorcode.ER_ACCESS_DENIED_ERROR: …

Total answers: 3

python MySQL Connector

python MySQL Connector Question: I’m playing with big data in Python and MySQL. I’ve a got a huge table, I need to insert new rows while I’m fetching query’s results. I’ve got this error: Traceback (most recent call last): File “recsys.py”, line 53, in <module> write_cursor.executemany(add_sim, data_sims) File “/Library/Python/2.7/site-packages/mysql/connector/cursor.py”, line 603, in executemany self._connection.handle_unread_result() File …

Total answers: 4

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

What are the differences between mysql-connector-python, mysql-connector-python-rf and mysql-connector-repackaged? Question: 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, when I do $ …

Total answers: 4

python mysql.connector DictCursor?

python mysql.connector DictCursor? Question: 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 iterator city = row[“city”] state = row[“state”] Is it possible …

Total answers: 5

Python mySQL Update, Working but not updating table

Python mySQL Update, Working but not updating table Question: 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 RadioGroups SET CurrentState=1 WHERE RadioID=11”) print “Row(s) were updated :” + str(curb.rowcount) curb.close() except MySQLdb.Error, e: print “query …

Total answers: 4