Stack Overflow for Teams is moving to its own domain! When the migration is complete, you will access your Teams at stackoverflowteams.com, and they will no longer appear in the left sidebar on stackoverflow.com.
Check your email for updates.
Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
I'm trying to use PyMySQL on Ubuntu.
I've installed pymysql using both pip and pip3 but every time I use import pymysql, it returns ImportError: No module named 'pymysql'
I'm using Ubuntu 15.10 64-...
I'm running this from PyDev in Eclipse...
import pymysql
conn = pymysql.connect(host='localhost', port=3306, user='userid', passwd='password', db='fan')
cur = conn.cursor()
print "writing to db"
cur....
I have the following:
import MySQLdb as dbapi
import sys
import csv
dbServer='localhost'
dbPass='supersecretpassword'
dbSchema='dbTest'
dbUser='root'
dbQuery='SELECT * FROM pbTest.Orders;'
db=...
I just solved some problems in my Django 1.3 app by using PyMySQL instead of MySQLdb. I followed this tutorial on how to make the switch: http://web-eng-help.blogspot.com/2010/09/install-mysql-5-for-...
How can I insert data to my django database from a function in the views,py file? Is python manage.py shell the only way to insert?
For more explanations I'm using:
python 3.4
django 1.8.2
PyMySQL
...
I discovered (the hard way) that MySQL's UTF8 character set is only 3 bytes. A bit of research shows I can fix this by changing the tables to utilize the utf8mb4 collation and get the full 4 bytes UTF ...
I'm using aiohttp and sqlalchemy, and I've created a Singleton that helps me to connect when I'm needed a instance of SQLAlchemy (code follows).
Unfortunately, every once in awhile I get the following ...
I'm new to Django. It wasted me whole afternoon to config the MySQL engine. I am very confused about the database engine and the database driver. Is the engine also the driver? All the tutorial said ...
I'm developing a fairly straightforward web app using Flask and MySQL.
I'm struggling with unicode. Users sometimes paste stuff that they copied from Word and it's falling over with the old smart ...
Im still very much learning python and all the different ways to use 3rd party modules. I have installed https://pypi.python.org/pypi/mysqlclient which was recommended here Python 3 and MySQL
I ...
I use Python 3.4 from the Anaconda distribution. Within this distribution, I found the pymysql library to connect to an existing MySQL database, which is located on another computer.
import pymysql
...
I've been trying using PyMysql and so far everything i did worked (Select/insert) but when i try to update it just doesn't work, no errors no nothing, just doesn't do anything.
import pymysql
...
I'm not sure if this is possible, but I'm looking for a way to reconnect to mysql database when the connection is lost. All the connections are held in a gevent queue but that shouldn't matter I think....
I'm using pymysql.cursors and a simplified code example that loads a row from a table and prints it every second is:
#!/usr/bin/env python3
import pymysql.cursors
import time
conn = pymysql.connect(...
When executing the following:
import pymysql
db = pymysql.connect(host='localhost', port=3306, user='root')
cur = db.cursor()
print(cur.execute("SELECT ParentGuardianID FROM ...
The following is listed as example in pymysql:
conn = pymysql.connect(...)
with conn.cursor() as cursor:
cursor.execute(...)
...
conn.close()
Can I use the following instead, or will this ...
I'm trying to store a mySQL query result in a pandas DataFrame using pymysql and am running into errors building the dataframe. Found a similar question here and here, but it looks like there are ...
I need to update some rows on the MySQL database by PyMYSQL and I want to know how many rows had been changed.
import pymysql
db = pymysql.connect(xxxx)
cur = db.cursor()
sql = "update TABLE set ...
I tried to insert a field (title) with PyMySQL that can be NULL or a string. But it doesn't work.
query = """
INSERT INTO `chapter` (title, chapter, volume)
VALUES ("%s", "%s", %d)
"""
cur....
How can I escape the input to a MySQL db in Python3?
I'm using PyMySQL and works fine, but when I try to do something like:
cursor.execute("SELECT * FROM `Codes` WHERE `ShortCode` = '{}'".format(...
I am doing a lot of inserts to a mysql table in a short period of time from python code (using pymysql) that uses a lot of different threads.
Each thread, of which there are many, may or may not end ...
I have a user-defined function that uses pymysql to connect to a mysql database and then it interrogates the database and reads the results into a Pandas dataframe.
import pandas as pd
import pymysql
...
I have a Django project which is deployed to Elastic Beanstalk Amazon Linux 2 AMI. I installed PyMySQL for connecting to the db and i added these lines to settings.py such as below;
import pymysql
...
I'm trying to connect my database using SSL with PyMySQL, but I can't find good documentation on what the syntax is.
These credentials work in Workbench and with the CLI, but I get this error when ...
So I have a python script that goes through roughly 350,000 data objects, and depending on some tests, it needs to update a row which represents each one of those objects in a MySQl db. I'm also using ...
I'm doing a Python application with MySQL and PyMySQL and I'd like to be able to know the number of the MySQL error when I get one so that I can do something different depending on it.
Is there a way ...
I am getting the error InterfaceError (0, ''). Is there way in Pymysql library I can check whether connection or cursor is closed. For cursor I am already using context manager like that:
with ...
I want to use run below mysql script using with pymysql.
START TRANSACTION;
BEGIN;
insert into ~~~
COMMIT;
my python source code is
connection = pymysql.connect(~~~~~~~)
with connection....
This is the Python code where I am establishing a database connection. But I am getting a type error in my code. Please tell me what is the issue.
import pymysql
connnection = pymysql.connect("...
I've been using PyMySQL for a while now and created my own wrapper that I'm used to to shorthand writing queries. Nonetheless I've been creating CSV files with OrderedDict because I need to keep the ...
Is it a valid PyMySQL operation to cursor.execute(…) multiple times before executing connection.commit(), or does connection.commit() need to occur after each execute statement for the results to be ...
I have written a script to help me work with a database. Specifically, I am trying to work with files on disk and add the result of this work to my database. I have copied the code below, but removed ...
We are having an intermittent issue with connections to our mysql server timing out.
The error we are receiving is as following.
(2003, 'Can\'t connect to MySQL server on \'<connection>\' ((...
I am opening mysql connection in the main function and use that connection in multiple functions called by the main function.
Is there anything wrong with passing cursor from main function instead of ...
I'm trying to process large amount of data using Python and maintaining processing status in MySQL. However, I'm surprised there is no standard connection pool for python-mysql (like HikariCP in Java)....
I'm trying to connect to a local mysql DB on my windows machine using sqlalchemy. It works using pymysql, but not with sqlalchemy.
Code sqlalchemy:
engine = create_engine('mysql+mysqldb://root:...
I'm attempting to import data (tweets and other twitter text information) into a database using Pandas and MySQL. I received the following error:
166: Warning: (1366, "Incorrect string value: '\xF0\...
I'm trying to load a pandas dataframe to a mysql table using Sqlalchemy.
I connect using; engine = create_engine("mysql+pymysql://user:password@ip:port/db")
I am then simply running;
df.to_sql(con=...
I'm trying to connect to Cloud SQL from a Python application (using PyMySQL 0.7.9) running on top of Google App Engine.
My connection string looks like this (credentials are fake of course):
pymysql....
I am using pymysql client to connect to mysql in my flask API,
everything works fine for some days(around 1-2 days) after that suddenly it starts to throw this error
Traceback (most recent call last)...
Using the latest version of PyMySQL(0.9.3) I am unable to execute a query string which has multiple SQL statements in it separated by a semicolon(;)
My python version is: Python 3.6.5
import pymysql ...
It seems like a really simple task but I'm having difficulties doing it proper.
My SQL Query look like this:
self.link = self.db.cursor(pymysql.cursors.DictCursor);
self.link.execute("SELECT * FROM ...
I am using pymysql in Python to connect to database. It was working fine but now I am getting following error :
Traceback (most recent call last) :
File "/Users/njethani/Desktop/venv/lib/python3....
using pymysql connect to mysql, leave the program running for a long time,for example, leave the office at night and come back next morning.during this period,no any operation on this application.now ...
I am currently using flask-login in my application for user login session management. I am using flask-sqlalchemy, so all working ok.
Because of my previous sql experience, I am not fan of ORM. I like ...
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-...
I have a database holding names, and I have to create a new list which will hold such values as ID, name, and gender and insert it in the current database. I have to create a list of the names which ...
I'm trying to connect to Google Cloud MYSQL server using SSL certificates and the python module PyMySQL with the following line:
connection = pymysql.connect(host=os.environ['SQL_HOST_IP'], user=os....
I am using pymysql to connect to a database. I am new to database operations. Is there a status code that I can use to check if the database is open/alive, something like db.status.
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.