Questions tagged [pymysql]
PyMySQL is a database connector for Python like MySQLdb.
1,373
questions
0
votes
0
answers
18
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
44
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
23
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
32
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
17
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
1
answer
37
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
37
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
106
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
58
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
1
answer
62
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
1
answer
32
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
0
answers
40
views
How to connect Infinity Free database to Fast API
How to connect Infinity Free database to Fast API ?
While connecting database by using below code:
---------------------------------------------
conn = pymysql.connect(host="sql108.infinityfree....
0
votes
2
answers
45
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
104
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 ...
0
votes
1
answer
62
views
AWS Lambda Database Connection works with PyMySQL but not SQLAlchemy
I am trying to connect to a MySQL RDS Database using Lambda Functions. I have tested this locally through SAM invoke and it works. I am now testing it on the AWS Lambda Console and it does not work.
I ...
1
vote
1
answer
55
views
Why does SQLAlchemy return a new rownum but not insert my new row into MySQL?
I am debugging a strange phenomenon rising from this bit of Python code:
def insert_book(name):
with engine.connect() as connection:
insert_statement = sqlalchemy.text(
"&...
0
votes
0
answers
52
views
Python pymysql works but sqlalchemy not working
local_port=ssh_tunnel.local_bind_port
URL = f"mysql+pymysql://db_user:[email protected]:{local_port}"
engine = create_engine(URL, echo=True)
with engine.connect() as connection:
...
0
votes
0
answers
53
views
pymysql connection: read_timeout has no effect
When creating a connection to a MySQL database via sqlalchemy and pymysql connector, I want to set a timeout for queries that take too long:
from sqlalchemy import create_engine
eng = create_engine(&...
1
vote
0
answers
32
views
pythonic way of inserting many different datapoints into SQL?
I'm trying to figure out the best (i.e. not error-prone) way to insert data into SQL using pymysql.
The data is extracted iteratively from excel files, and there are multiple data types (i.e. SQL ...
0
votes
1
answer
94
views
Unclear how to include PyMySQL with RSA in requirements.txt or setup
Thanks for your work, working well..
I am able to install the rsa version with python3 -m pip install PyMySQL[rsa], but:
I don’t know how to specify rsa in a requirements.txt file
More seriously, I ...
1
vote
0
answers
48
views
I'm trying to access aurora DB through ssh tunneling in python, but I'm having a problem. Could not establish session to SSH gateway
from sshtunnel import SSHTunnelForwarder
import pymysql
try:
with SSHTunnelForwarder(
('10.100.100.10', 22),
ssh_username="ec2-user",
ssh_pkey="key.pem&...
0
votes
0
answers
48
views
Flask with PyMySQL error, fails at first request but all following requests succeed
I got an API by Flask and PyMySQL, the client is implemented via Axios in VUE. The very first request after opening the page always fails, but all the following requests will succeed. Mysteriously, if ...
0
votes
0
answers
39
views
GameServer with python(Tornado 6 + pyMySQL) SQL Connection failed 255
Im trying bring to live this code
I fixed few things but im stuck on connect to mysql.
Game server use python 3.4 and old tornado 4.
I want rebuild code for newest pytohn and tornado.
I was installed ...
0
votes
1
answer
207
views
The results of the same SQL query using sqlx and pysql are completely different
When I execute SQL statements using rust sqlx, I find that the returned results are incorrect. For the same statements, when I use pysql, I get results consistent with those obtained from the MySQL ...
-1
votes
1
answer
85
views
Insert json data from pandas to MySQL with pymysql
I have a csv file with columns which are json dumped lists or dict.
Example entry of pictures column ["https://images1.loopnet.com/i2/-zlV--gguqB1DTY1kXtod7Y11T6NjYHuEOsdziUbkIc/110/106-Caines-...
2
votes
1
answer
90
views
Python (PyMySQL) getting random 2003 error, timing out on connection to remote MySQL server
I have a weird one that I've spent a few days on without any luck. Coming here in the hopes that someone can point me in a direction or has seen something similar.
So, what is happening is that I have ...
0
votes
0
answers
32
views
getting Error pymysql.err.InternalError: Packet sequence number wrong - got 102 expected 14 while selecting table name in database
I am building web application. in front end it shows the tables list available in database for selecting data. for first table it is not throwing any error but when i select another table it is ...
0
votes
0
answers
353
views
sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on 'localhost' ([Errno 111] Connection refused)"
I am changing my Flask database from sqlite to MySQL but it's failing to connect, I am able to login to the database using Datagrip but it's not connecting in my flask app
from flask import Flask
from ...
0
votes
1
answer
248
views
(2006, "MySQL server has gone away (BrokenPipeError(32, 'Broken pipe'))")
cursor.execute("INSERT INTO email_logs (message_id,email_subject,from_address,to_address,email_html_content,email_content) VALUES (%s,%s,%s,%s,%s,%s)",
(message_id, ...
0
votes
0
answers
73
views
How can I check why I cannot connect to the database?
I have a small school project and I need to build a python web app to track expenses; I want to use Docker and Flask I already have the structure.
I have the following files;
docker-compose.yml
...
1
vote
1
answer
22
views
Why is my json built using PyMySQL returning with duplicate results?
I am running a select statement on my MySQL database using PyMySQL and then using some code to build a json output which is then being returned from the lambda function to my mobile app.
The problem ...
1
vote
1
answer
50
views
Why can't I access items in json array?
I'm building an app in React-Native and I am using some code to connect to a MySQL RDS on AWS and am returning the results as a json array from a Lambda function to my mobile app to use the data for ...
0
votes
1
answer
50
views
PyMySQL - How to use wildcards in an 'INSERT' statement?
I'm really new to SQL, MySQL, and PyMySQL so I'm sorry if this is an easy question.
I'm trying to insert a new record back into a table inside my database. I'm using the following code:
resultValues = ...
0
votes
0
answers
80
views
How do I add a foreign key constraint to an existing table in a MySQL database in python using SQLAlchemy?
I can define a function that will add the table to the database and designate the primary key if given. But I can't make the function designate any foreign key(s) if given. Here is the function:
def ...
0
votes
0
answers
17
views
TypeError: The view function for 'create_emp' did not return a valid response. The function either returned None or ended without a return statement
Whenever i run the flask API to inserting the data using postman, but valid response not return response coming,
Method : Post
Postman input : http://127.0.0.1:5000/create
**Body : **
{
"...
0
votes
1
answer
60
views
How to use PyMySQL to return a list of entry ID's and use these ID's for further SQL queries
so I have a table in a MySQL database called games. I'm trying to use a python Lambda function to run a search on the database and create a dictionary to return as a JSON file to the app that's ...
0
votes
2
answers
104
views
Is it possible to convert a large list of dictionaries into a string, and then back into a list in Python?
I'm using a MySQL database as part of a work project and I'm creating a python script for it. When extracting the data from the server (in this case, just 3 records) I use the 'pymysql' library. This ...
0
votes
0
answers
67
views
Visual Studio Code Error: 'Expected Comma json(514)"
I used the python module 'PyMySQL' to grab data from a MySQL database and convert it into a more accessible JSON format. Next to the name "Sentence" is a string of HTML code.
{
"...
1
vote
1
answer
19
views
how to update value of "last_dt" col when using"UPDATE" or "INSERT IGNORE INTO ~ ON DUPLICATE KEY UPDATE ~" statement
The last_dt column is the last date the data was changed. It is managed differently from the inserted date. Inserted date is managed by create_dt.
I want to change the update date value only when ...
0
votes
0
answers
31
views
pymysql.err.OperationalError) (2013, 'Lost connection to MySQL server during query') (Background on this error at: https://sqlalche.me/e/20/e3q8)
I have isolation_level as AUTOCOMMIT in the engine level cause without it, I was not able to run the SET query I have mentioned below.
I am very new SQLAlchemy and don't know why it uses transaction ...
0
votes
1
answer
286
views
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'master_mysql' ([Errno -2] Name does not resolve)")
Sqlalchemy connection String
connection_string = "mysql+pymysql://{user}:{password}@{host}/{database}?charset=utf8mb4".format(
user='flask',
password='AKIAUCBC7I5FNK6CMXMR',
host=...
0
votes
1
answer
58
views
('can only concatenate str (not "tuple") to str',) on mysql.connector.connect in Python
I have a problem in Python. The system says ("'tuple' object has no attribute 'strip'",) above the function cnx = mysql.connector.connect(host=self.host, database=self.database , user= self....
-1
votes
1
answer
84
views
how to append QTextBrower in real time
I inherited PyQt5 class to make mysql insert program. so i used pymsql too.
This is the part of insert class.
for index, row in input_df.iterrows():
values = tuple(np.insert(row.values, 0, index))
...
1
vote
1
answer
42
views
Access Denied when connection to mysql in Django
In my newly created django project, I configured MySQL connection instead of default sqlite3. When I ran python manage.py runserver, I receive access denied error:
The Django complains wrong user&...
1
vote
0
answers
41
views
Pymysql reset cursor like mysql.connector
I have a piece of code which I migrate driver from mysql.connector to pymysql.
On mysql.connector there have cursor.reset(free=True), is there pymysql have functionality like that?
-1
votes
1
answer
53
views
Would anyone know what the issue is with this sql query using pymysql in python?
Find_Student_ID =
"SELECT student_info.Student_ID FROM
student_info JOIN user_information ON user_information.User_ID = student_info.User_ID
WHERE user_information.User_Fname = '"+ str(...
0
votes
1
answer
76
views
Python RDS Update Script Not Actually Updating
I've built my code base primarily in PHP and am seeing what I can put together in Python. One key challenge I've wanted to tackle is to be able to read and write to my MySQL database through AWS RDS. ...
0
votes
0
answers
130
views
python mysql library not establish connection with ssh tunneling server
SSH tunnel connection is established successfully but Error connecting to RDS MySQL database via SSH tunnel: 2003 (HY000): Can't connect to MySQL server on '0.0.0.0:52678' (10049)
same is working when ...
0
votes
1
answer
214
views
SQLAlchemy Error sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (1193, "Unknown system variable 'transaction_isolation'")
I am using SQLAlchemy==2.0.9 and pymysql1.0.3 .I am using MYSQL5.7
I constantly get the error transaction_isolation as unsupported system variable.
I have no choice to upgrade MYSQL and i have to use ...
0
votes
0
answers
64
views
AWS MySql connection error - 2003 from Jupyter notebook in VS Code
I have an AWS MySQL db instance. It's open to public, I have made sure the security rules for inbound and outboud is set to fully open.
My friend is able to connect from Node JS, but it's not ...