mysql-connector-python Questions

10

Solved

I'm encountering a problem when building a Docker image using a Python-based Dockerfile. I'm trying to use the mysqlclient library (version 2.2.0) and Django (version 4.2.2). Here is my Dockerfile:...
Species asked 22/6, 2023 at 15:18

3

I am trying to access some records using MySQL Connector/Python but I am unable to understand how start_transaction() is used. I would be great if someone could shed some light on uses cases where...
An asked 9/10, 2018 at 14:18

6

Solved

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="loca...
Woermer asked 5/8, 2022 at 2:25

6

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', 'r...
Tong asked 18/12, 2014 at 1:39

3

Solved

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 =...
Shrunken asked 4/2, 2019 at 14:52

4

Solved

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 t...
Antonyantonym asked 9/12, 2015 at 0:21

3

Solved

Having recently upgraded a Django project from 2.x to 3.x, I noticed that the mysql.connector.django backend (from mysql-connector-python) no longer works. The last version of Django that it works ...
Rakish asked 30/3, 2020 at 9:4

5

Solved

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 ...
David asked 31/3, 2014 at 18:55

7

Solved

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 (fro...
Gonick asked 28/12, 2015 at 7:21

2

Can't find an answer for this even after hours and hours of googling & searching stack overflow. I assure you I've seen all answers that could be deemed relevant and none of those have solved t...
Patency asked 16/6, 2016 at 0:37

2

Solved

This is the docker-compose file version: '3.3' services: mysql: image: mysql:latest restart: always environment: MYSQL_DATABASE: 'bot' MYSQL_USER: 'user' MYSQL_PASSWORD: '123' MYSQL_ROOT_PA...
Brazilein asked 21/7, 2020 at 16:13

1

I am using python3.8 and mysql.connector. Can I parameterize a query that contains a LIKE clause and pass in active % wildcard(s)? To tame the incoming pattern I have tried: pattern = re.sub(r'%+',...
Linkboy asked 20/7, 2020 at 21:36

5

Solved

How can I tell the Python MySQL connector which SSL/TLS protocol to use? Either specific (e.g. TLS1.2) or minimum. How can I check which protocol is used on an established connection? I've got a...
Yurik asked 12/12, 2019 at 8:7

2

I want to read part of result from cursor and then close it without reading all result. cursor.close() raises InternalError: Unread result found. Is it possible to close cursor without iterating th...
Huygens asked 13/7, 2016 at 11:44

1

Solved

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 applica...
Inger asked 18/2, 2020 at 17:40

3

I am using python3 and pandas to connect to some sql database: import pandas as pd import mysql.connector cnx = mysql.connector.connect(user='me', password='***', host='***', database='***') df...
Aldine asked 22/1, 2016 at 10:53

2

As part of our build process, we use the mysqldiff utility (invoked from maven) to validate our database migration scripts by comparing a freshly-built copy of the schema to a version of the schema...
Limpkin asked 31/10, 2018 at 23:10

8

Solved

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 py...
Antipodes asked 3/10, 2012 at 4:57

1

Solved

I'm working with pandas and sqlalchemy, and would like to load a DataFrame into a MySQL database. I'm currently using this code snippet: db_connection = sqlalchemy.create_engine('mysql+mysqlconnec...
Samsara asked 10/8, 2018 at 9:28

1

Solved

I use PyMysql to connect to my MySQL DB. cursor.execute(query) data = cursor.fetchall() for (id,clientid,timestamp) in cursor: print id,clientid,timestamp I want to sort the data based on times...
Monophony asked 30/5, 2018 at 3:43

1

Solved

I want to use prepared statements to insert data into a MySQL DB (version 5.7) using python, but I keep getting a NotImplementedError. I'm following the documentation here: https://dev.mysql.com/do...
Macnamara asked 25/5, 2018 at 18:45

1

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 Ja...

3

Solved

I'm trying to insert a python variable into a MySQL table within a python script but it is not working. Here is my code add_results=("INSERT INTO account_cancel_predictions" "(account_id,21_day_p...
Mathew asked 11/6, 2013 at 20:42

8

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 solv...
Prenomen asked 26/3, 2017 at 13:58

3

Solved

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() c...
Guanabara asked 7/3, 2013 at 13:0

© 2022 - 2024 — McMap. All rights reserved.