1,382 questions
-1
votes
0
answers
89
views
pymysql connect results in 'struct.error: unpack requires a buffer of 4 bytes' [duplicate]
Some time ago I had tried to install MySQL workbench correctly on my system, and it was a tremendous headache. This is because I use Kubuntu with a very new version of Ubuntu Release, and I had a lot ...
0
votes
0
answers
19
views
sqlalchemy.exc.OperationalError: (2003, "Can't connect to MySQL server on '123@localhost' ([Errno -2] Name or service not known)") [duplicate]
I am using python to Connect with DB.
from sqlalchemy import create_engine
import pymysql
db_password = "abc@123"
db_user = "test_user"
db_name = "xyz"
db_host = "...
1
vote
0
answers
77
views
Connecting Lambda to Aurora MySQL DB using IAM Authentication (FIXED)
Found solution If you are trying to do this too I'll leave this up so you can try to follow my steps and copy my code
I am trying to connect a Lambda Function to an Aurora MySQL DB through a proxy ...
1
vote
0
answers
56
views
OceanBase (MySQL Mode) fails to execute stored procedure with dynamic SQL in python
Environmen
OceanBase Community Edition 4.2.1 (MySQL mode)
I'm trying to call an OceanBase stored procedure that contains dynamic SQL (PREPARE ... EXECUTE) from Python, but it fails with a vague error.
...
2
votes
1
answer
67
views
Add Column Names to retrieved data from pymysql
I have a simple SQL command via pymsql to retrieve data
db = pymysql.connect(
db=DATABASE,
passwd=DB_PASSWORD,
host=DB_HOST,
user=DB_USER,
)
cursor = db.cursor()
cursor.execute("&...
1
vote
1
answer
62
views
is there a bug in pymysql.cursor.executemany()
I met an error when I run
import datetime
import json
import pymysql
config={
'host':...,
'user':...,
'password':...,
'database':...,
'charset':'utf8mb4',
'cursorclass':...
0
votes
1
answer
134
views
PyMySQL mogrify not taking list of dicts as argument
I'm trying to simply log my queries and their parameters using the pymysql.cursor.mogrify() function as detailed in the documentation.
python-1 | INFO:__main__:Creating records.
python-1 | INFO:trex....
0
votes
2
answers
58
views
NameError: name '_mysql' is not defined Mac Django
I was trying to run python manage.py run server while working with Django after changing my settings.py from this:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
...
0
votes
1
answer
109
views
Mysql rowcount always returns 1 on INSERT IGNORE statement
I am using pymysql connector to do some inserts into my database. I am trying to return whether or not a record was added or updated.
My code is
import pymysql
db = pymysql.connect(host='127.0.0.1',...
0
votes
1
answer
67
views
Python code not connecting to MySQL when using another account
I'm working on a python windows app. I have two accounts for my database built with MySQL workbench: host and user. The user account would be used on other computers while the host account has the ...
0
votes
1
answer
70
views
Pymysql badly formats parameters
I just moved to a new venv with pymysql version upgraded from v1.1.0 to v1.1.1 and I now have SQL errors when parameters are formatted by the Cursor.execute function
Here is an example
client_id = ...
0
votes
0
answers
177
views
Error when connecting to Amazon RDS using pymysql: Database connection failed Cannot set verify_mode to CERT_NONE when check_hostname is enabled
I am trying to connect to Amazon RDS using mySQL but I am getting an error message for pymysql connect. The code I have used is:
conn = pymysql.connect(auth_plugin_map={'mysql_clear_password': None}, ...
0
votes
1
answer
80
views
Same code runs on Windows but fails on Linux: pymysql.err.ProgrammingError: nan can not be used with MySQL
I'm facing an issue where the same code works fine on Windows but fails on Linux with the error:
pymysql.err.ProgrammingError: nan can not be used with MySQL
In my project, I compute results, store ...
0
votes
0
answers
60
views
pymysql use commit still can't insert [duplicate]
Even using the commit() with pymysql, insert statement has no effect.
Hi, this is my first time posting here, and I hope someone can solve my problem.
I am using VS2022 to compile the following code ...
0
votes
0
answers
71
views
Using PyMySql to connect to RDS from lambda - getting (1045, Access Denied) error
I'm trying to connect to MySQL RDS from lambda using pymysql library but keep getting error:
(1045, "Access denied for user 'user'@'10.224.13.51' (using password: YES)")
I'm using AWS CDK to ...
0
votes
1
answer
42
views
Using pymysql INSERT a date using STR_TO_DATE()
This INSERT command in phpmyadmin works fine:
INSERT INTO babydb.sales_agro_products (customer_id, product_name, product_class, product_price_kG, amount_ordered, sales_value, Date) VALUES ('Big John', ...
-1
votes
1
answer
72
views
How to create the same sha1 hash in Python3 as Maraidb sha1 hash?
I'm trying to create the same sha1 hash as the sha1 hash generated in Mariadb for equality look ups.
I've tried this:
Python file
import hashlib
columns = ["one", "two", "...
0
votes
0
answers
39
views
MySQL Error 1452 but parent table exists and data types are the same
Here's the total error:
pymysql.err.IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`ncbi`.`chromosomes`, CONSTRAINT `chromosomes_ibfk_1` FOREIGN KEY (`...
3
votes
1
answer
184
views
Using CREATE TEMPORARY TABLE with pandas
I am trying to create a temporary table or drop a table in MySQL using SQLAlchemy in Jupyter notebook. The SQL function does create table or drops the table but it results in an error
...
1
vote
1
answer
98
views
How to get MySQL result values as string or number?
I'm currently using PyMySQL to make queries to my MySQL DB. I wanted the results to be a dictionary, where the columns are the keys and with their associated values, and I've got that. But I've ...
0
votes
0
answers
278
views
Random MySql client error "got an error writing communication packets"
I have several different Linux servers running MySQL 8.0.x instances (ranging from 8.0.23 to 8.0.33).
I occasionally get "error writing communication packets" from clients when connecting to ...
0
votes
0
answers
72
views
How to download pymysql
my mac cannot update anymore, it is 2017air , and now it stop at macOS Monterey 12.7.4. Everytime I pip install the dominal shows could not find a version. I already download mysql 8.0.28 by dmg ...
2
votes
0
answers
1k
views
sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2003, "Can
I'm trying to make a connection with MySQL DB using Python but I'm getting this error no matter what I do. I allready changed my localhost to 127.0.0.1.
from sqlalchemy import create_engine
from ...
0
votes
1
answer
53
views
Python MySQL: Unexpected response on split query
I'm getting different responses depending on wether I run the query in an "all in one" query or if I run them separately.
I can't for the life of me figure out what I'm doing wrong.
Code:
...
-1
votes
1
answer
102
views
python mysql connector gives incorrect result
This python code:
import mysql.connector
try:
conn = mysql.connector.connect(
host="localhost", user="fanw", password="secret", database="fanw"
...
0
votes
0
answers
31
views
mysql + pymysql. Delete data before insert question
First of all, I come from China. So please forget my poor and wrong English!
What I want:
I use mysql to store my data. The data will change everday untill a month pass. So evey day I need to delete ...
0
votes
1
answer
170
views
Mysql execute many wont work when add on duplicate
I have mysql table and I want to run the executemany for that table. I want to make sure, if there is duplicate entry, then it should be updated. I wrote query as below with data.
a = 'INSERT INTO ...
-1
votes
1
answer
152
views
AWS Lambda - Database writes not reflected by subsequent read
I have two lambda functions, one that inserts data into a database (create_user), and another (get_users) that reads it from a MySQL database hosted on AWS RDS.
The database code for the create_user ...
0
votes
2
answers
50
views
How do i join functions within Python MySql program?
So i want to have it so that i have 6 columns. But the 6th is for orders.
The way i see it is VNr is connected to vare and ordrelinje. And thats where OrdreNr comes in which is number of orders, which ...
0
votes
2
answers
418
views
I am struggling with "Update" function in Python MySql, PyMySql
Here is how the code looks like. "vare" is the section i want to update
def update():
sqlCon = pymysql.connect(host = "localhost", user = "root", password ...
0
votes
1
answer
95
views
Writing a query in a simpler way to enable better substitution by pymysql
I have the following query in which I want to substitute values for level and content from a list.
SELECT count(DISTINCT(USERS)) AS TOTAL_USERS FROM db.CCN
JOIN UCR ON CCN.COLLECTIVE = UCR.COLLECTIVE ...
0
votes
1
answer
160
views
how to solve this syntax error in jupyter notebook
I am trying to connect jupyter to mysql database using this syntax:
%sql mysql+pymysql://root:mother@123@localhost:3306/united_nations
but i am getting the below syntax error:
MetaData.__init__() ...
0
votes
2
answers
252
views
PyMySQL Data types
I'm new in Python and trying to learn MySQL
as we import pymysql
import pymysql
from datetime import datetime
conn = pymysql.connect(
host = 'localhost',
user = 'root',
password = '',
...
0
votes
0
answers
422
views
Python MySQL (import pymysql)
If I use IDLE editor there is no any error occurs. but when I use sublime or VS code and for output I run my file (python test.py) in terminal or CMD it generate this error I try many commands to ...
0
votes
0
answers
127
views
MySQL Insert query does not insert, but does not throw exception
I have an issue where a python implemented sql query executes without raising any error but does not actually insert into db. I've tried reviewing other similar errors reported on SO but without any ...
0
votes
1
answer
108
views
MySQL v9.0 on AWS RDS + PyMSQL 0.10.1 on python 2.7
I have a python 2.7 app (Edgewall Trac) that connects to a MySQL v5.7 db deployed on AWS RDS. That same db is also accessed by multiple PHP applications. AWS recently notified me that support for ...
0
votes
1
answer
93
views
PyMySQL TypeError when connecting
I'm working with the following (very simple) MariaDB connection:
>>> from dbconfig import db_host, db_user, db_pass, db_name, system_number
>>> import pymysql as mdb
>>> ...
0
votes
1
answer
37
views
python project - required packages won't install in pych
currently im bulinding resume analyzer application which is based on python,streamlit, xampp,and nlp
I'm getting the error in the terminal -
OSError: [E050] Can't find model 'en_core_web_sm'. It ...
0
votes
0
answers
264
views
Connecting Python to MySQL without using a connector
I have a weird case on my hands. I have a machine that is completely locked. Its a Debian 9 machine and I need to run a Python script that needs to connect to MySQL. The problem is I cant install ...
0
votes
1
answer
174
views
How to prevent pymysql (or mysql.connector) resolving localhost to IPv6?
I am trying to connect to MySQL from Python on my hosting provider's server. I have my database created, I can connect to it through SSH and with PHP. When I try to connect using Python I get an error ...
0
votes
1
answer
64
views
How to search results of PyMySQL query with IN operator when it returns a tuple of tuples?
I have a MySQL database table of ipv4 addresses I want to search against, I pull it in to a Python using an SQL query (PyMySQL library) with a single column in the SELECT and cursor.fetchall() but ...
0
votes
0
answers
41
views
Optimizing Partial CSV Data Upload to MySQL (pymysql): Seeking Best Practices for Selective Column Insertion
I'm facing efficiency issues while uploading data to an AWS RDS database. Daily, I process a CSV file with about 6,000 lines using Python's 'pymysql' package. The process involves reading each line ...
0
votes
2
answers
377
views
I can't connect my database on Jupyter Notebooks
This is the code I need to use to connect the database but it gives me the error shown below.
The code:
%sql mysql+pymysql://root:botsebontle22@localhost:3306/united_nations
The Error:
MetaData.init() ...
0
votes
1
answer
111
views
Why the pymysql cursor increase the memory?
When I use python 3.9 and pymysql 1.1.0, I find the memory will increase after I get data from cursor. I need run a model in cycle way. The input datas need download from mysql database.I use dbutils ...
0
votes
1
answer
467
views
Can anyone help me with this problem on pymysql
I was trying to use pymysql to connect to mysql server, but when I was importing it, it throws an error.
It prints
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/...
-1
votes
1
answer
726
views
How to create an sql table in pymysql correctly? [duplicate]
import pymysql.cursors
from config import host, user, password, db_name
try:
connection = pymysql.connect(
host=host,
port=3306,
user=user,
password=password,
...
0
votes
0
answers
295
views
Python39 and pymysql
I've just tried upgrading up to python3.9.5 from 3.7 and I'm encountering a strange behavior that I can't quite nail down. It involves pandas1.3 and pymysql1.1.0. The strange part is that the ...
1
vote
0
answers
136
views
Python Flask- How to access lohalhost using database server?
file .evn
DB_HOST=127.0.0.1:3307
DB_DATABASE=bookinghotel_db
DB_USERNAME=root
DB_PASSWORD=
file config.py
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
...
0
votes
2
answers
226
views
Flask SQLAlchemy and multiprocessing
I have a weird issue which i think i managed to narrow down to using sqlalchemy and multiprocessing.
I am using flask, flask-sqlalchemy, pymysql with a mysql db.
I have a flask app (models.py):
from ...
0
votes
1
answer
938
views
Python Error checking using pymysql get errors
I have put together an example python scripts for myself to understand how to connect to a MySQL database using pymysql. It works but in Thonny-Assistant it is showing a few errors and I am asking for ...