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 =…
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 =…
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 =…
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
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,…
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…
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…
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): …
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…
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…
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() …
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…
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…
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…
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…
JackTheKnife
  • 2,698
  • 4
  • 38
  • 82
1
2