pymysql

pymsql (1054, "Unknown column 'None' in 'call statement'")

pymsql (1054, "Unknown column 'None' in 'call statement'") Question: I am trying to call stored procedure with pymsql but it looks like I am getting an error when one of the param is passed in as None. My stored proc is able to handle cases of Null but ofcourse not None. I was under the …

Total answers: 1

Connect to cloudSQL db using service account with pymysql or mysql.connector

Connect to cloudSQL db using service account with pymysql or mysql.connector Question: I have a running CloudSQL instance running in another VPC and a nginx proxy to allow cross-vpc access. I can access the db using a built-in user. But how can I access the DB using a Google Service Account? import google.auth import google.auth.transport.requests …

Total answers: 3

PyMySQL database, Issues with filling table

PyMySQL database, Issues with filling table Question: This is my Python main.py program: from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait as wait import time from bs4 import BeautifulSoup import requests import mysql.connector db = mysql.connector.connect( host="localhost", …

Total answers: 1

Error initializing SQLAlchemy models with MySQL database

Error initializing SQLAlchemy models with MySQL database Question: My problem seems to be common, but I had checked these similar StackOverflow issues and still had no idea how to solve my problem… That’s why I came here as last resort… I created a MySQL database. If I didn’t do any of the SQLAlchemy stuff and …

Total answers: 1

How can I correct pymysql statement?

How can I correct pymysql statement? Question: I have a pymysql update query that I want to work. It keeps throwing me an error. mydb = mysql.connector.connect( host="*****", user="****", password="****", database="database", port="****" ) mycursor = mydb.cursor() mycursor.execute (""" UPDATE table1 SET BUGS=%s, CODE_SMELLS=%s, VULNERABILITIES=%s WHERE username = %s AND time_created = (SELECT MAX(time_created) FROM table1 …

Total answers: 1

pd.read_sql – Unsupported format character error (0x27)

pd.read_sql – Unsupported format character error (0x27) Question: As above, I’m trying to use pd.read_sql to query our mysql database, and getting an error for double/single quotes. When I remove the % operators from the LIKE clause (lines 84-87) the query runs, but these are needed. I know I need to format the strings but …

Total answers: 2

PyMySQL: Connection was aborted by the software in your host machine

PyMySQL: Connection was aborted by the software in your host machine Question: I executed the below code and it shows this error. Here is the code snippet. import pymysql mydb = pymysql.connect( database = “q11”, user = “111”, password = “11111”, host = “localhost” ) The error I am getting is: pymysql.err.OperationalError: (2006, “MySQL server …

Total answers: 1

Pandas read_sql() – AttributeError: 'Engine' object has no attribute 'cursor'

Pandas read_sql() – AttributeError: 'Engine' object has no attribute 'cursor' Question: I am trying to read data from MySQL query using pandas read_sql() method with python3+sqlalchemy+pymysql I tried to follow the following tutorials – https://pythondata.com/quick-tip-sqlalchemy-for-mysql-and-pandas/ https://www.youtube.com/watch?v=M-4EpNdlSuY https://www.programcreek.com/python/example/101381/pandas.read_sql Everything just looks good with the code import pandas import sqlalchemy engine = sqlalchemy.create_engine(‘mysql+pymysql://root:[email protected]:3306/mydatabase’) df = pandas.read_sql(“SELECT * …

Total answers: 4

Inserting data into a table in MySQL with PyMySQL

Inserting data into a table in MySQL with PyMySQL Question: I tried to insert some data into a table like this as below, but it doesn’t work for me. import pymysql conn = pymysql.connect(host=’localhost’, user=’root’, password=’1234′, charset=’utf8′, db=’kobis’) cur = conn.cursor() sql = “””insert into ‘boxoffice’ (targetDt, rank, rankOldAndNew, movieCd, movieNm, salesAmt, audiCnt) values (%d, …

Total answers: 2