Questions tagged [pymsql]
23 questions
1
vote
1 answer
How can I insert the rows I received from the API into mysql
how i can insert my table mysql result this code?
response = requests.request("GET", url, headers=headers, data=payload, verify=False)
user_json = json.loads(response.text)
for i in user_json:
db_ins =…
![](../../users/profiles/15197027.webp)
user405396
- 11
- 2
1
vote
0 answers
SQLAlchemy keeps the DB connection open
I have an issue with in my Flask app concerning SQLAlchemy and MySQL.
In one of my file: connection.py I have a function that creates a DB connection and set it as a global variable:
db = None
def db_connect(force=False):
global db
db =…
![](../../users/profiles/5488750.webp)
Jérémy Octeau
- 490
- 3
- 18
1
vote
0 answers
data lost when I import mutile csv file to mysql with python
i have so many csv to import to mysql, so i try to use python/pandas/pymysql to import them into mysql
here r my code
import os
import pandas as pd
from sqlalchemy import create_engine
import datetime
if __name__ == '__main__':
MYSQL_USER =…
![](../../users/profiles/12495495.webp)
JJJeff
- 11
- 2
1
vote
3 answers
How insert the dataframe output to mysql
import pymysql
import pandas as pd
db = pymysql.connect('localhost', 'testuser', 'test123', 'world')
df1 = pd.read_sql('select * from country limit 5', db)
df1
I need to create a table name with country2 and update the df1 out to country2
![](../../users/profiles/11908379.webp)
sre
- 247
- 1
- 9
1
vote
1 answer
InternalError: (pymysql.err.InternalError) (1193, "Unknown system variable 'transaction_isolation'")
Trying to output a dataframe into a MySQL database table from Python (version 3.6.5) using PyMySQL version 0.8.0. SQLAlchemy version 1.2.17 and the database server is 8.0.1.
The same code used to run fine until now. Any suggestion on how to resolve,…
![](../../users/profiles/10738280.webp)
r_me
- 53
- 1
- 7
1
vote
1 answer
csvkit mysql import fails with VARCHAR requires a length on dialect mysql
After installing csvkit with the following command
$ sudo -HE pip install --upgrade -e git+git://github.com/wireservice/csvkit.git@master#egg=csvkit
and trying to import a .csv as follows:
csvsql --db mysql://root:root@127.0.0.1:3306/jira_test…
![](../../users/profiles/2409793.webp)
pkaramol
- 9,548
- 14
- 80
- 167
0
votes
0 answers
Unresolved pymysql import in python
I think I've installed pymysql and psycopg2 with pip but, whenever I tried to import them in vs code text editor I got an error "unresolved import module".
So I tried to import them in the cmd and this was successfully imported.
Please guys I need…
![](../../users/profiles/15354488.webp)
Rufai Ilyas
- 1
- 1
0
votes
0 answers
Python , MySQLdb._exceptions.ProgrammingError: execute() first
This is my source code
from lib.Database import Database
from lib.Mail import Mail
from flask import session, request
import bcrypt
class Users:
def init(self):
self.db = Database()
self.mail = Mail()
self.rounds = 10
def loginUser(self, form):
…
![](../../users/profiles/12284475.webp)
masete
- 13
- 3
0
votes
1 answer
MSQL Missing comma before start of a new alter operation. (near "ADD" at position 255)
I have a problem
my code
_________
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- --------------------------------------------------------
CREATE TABLE IF NOT EXISTS `country` (
`id` smallint(5) unsigned NOT NULL…
![](../../users/profiles/12232026.webp)
AndrewO
- 9
- 1
0
votes
0 answers
Percentage DESC count Until 80%
I have been trying to solve this problem and I cannot get to the root of it. As you can see on the excel example, I have a table that contains ID, Cost, and Percentage columns. I want to be able to create a view/query where I am able to change the…
![](../../users/profiles/14985402.webp)
Yekalo23
- 1
0
votes
0 answers
ERROR Pyqt5:'QDate' object has no attribute 'translate'
I don't know why I get this error. AttributeError: 'QDate' object has no attribute 'translate'
def add(self):
with conn.cursor() as cur:
fec=self.dateEdit.date()
mat=self.comboBox.currentData()
…
![](../../users/profiles/14482787.webp)
johnnypk
- 11
- 1
0
votes
1 answer
AWS Lambda function returning same values unless redeployed
I have a simple AWS Lambda function connected to a mysql rds. When I update a field in my apps UI it updates it in the database when viewed from the MySQL workbench but when using the Lambda function it returns the same value until I redeploy the…
![](../../users/profiles/14362343.webp)
Conor
- 13
- 2
0
votes
2 answers
How to connect to mariadb on a docker container using pymsql
I am using a Docker container to connect to mysql but I am getting this following error.
error:
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 99] Cannot assign requested address)")
I am not sure about…
![](../../users/profiles/2581266.webp)
Papouche Guinslyzinho
- 4,477
- 8
- 43
- 82
0
votes
1 answer
TypeError: 'int' object is not iterable when executin SQL with SET in python3
I am creating set, to prevent duplicates while I am deleting old folders on server depending on status in column of table. But when I try to run this script
cursor = connection.cursor()
sql="SELECT id, name, state FROM domain WHERE…
![](../../users/profiles/5184622.webp)
Delirium
- 753
- 3
- 10
- 22
0
votes
0 answers
PyMySQL and deadlock
For some reason I'm getting randomly an error message
pymysql.err.OperationalError: (1213, 'Deadlock found when trying to get lock; try restarting transaction')
on a simple update query which looks like
updateQuery = "UPDATE %s SET valid = 1 WHERE…
![](../../users/profiles/1090360.webp)
JackTheKnife
- 2,698
- 4
- 38
- 82