Questions tagged [pymysql]

PyMySQL is a database connector for Python like MySQLdb.

PyMySQL is a database connector for Python, that means it is a library to enable Python programs to talk to a MySQL server.

It is written in pure Python and works with Python 2.7+ and Python 3.X.

pymysql is a drop-in replacement for mysqldb.

Documentation can be found at https://pymysql.readthedocs.io/

1369 questions
4
votes
0 answers

Cloud SQL Proxy doesn't create Unix Socket on Mac OSX Catalina

I try to open a connection with my MySql DB from my python script. The DB is a MySql 8 instance running on Google Cloud. For that, I use the Cloud SQL Proxy from Google Cloud. I correctly created my service account and everything is working…
4
votes
2 answers

1054, unknown column 'index' in field list

df_row.head() identifier link likes_count company 0 2292512316069378197 https://www.instagram.com/p/B_Qo84ihfiV 9608 Ralph Lauren 1 2292462538514040606 https://www.instagram.com/p/B_QdohlBQce 9462 Ralph Lauren 2 …
Tony Flager
  • 95
  • 1
  • 8
4
votes
1 answer

sqlalchemy error inserting with bind parameter missing, but works in Workbench

I keep having a strange issue with my program doing SQL inserts. I'm periodically (once a day) sending a lot of data using pymysql in a single INSERT statement and every few days I get the following error: (sqlalchemy.exc.InvalidRequestError) A…
VagrantC
  • 687
  • 2
  • 13
  • 31
4
votes
1 answer

How to query a JSON MySQL column into a dict?

My database looks like this: CREATE TABLE my_table( irrelevant_column TEXT, json_stuff JSON ); mysql> SELECT * FROM my_table; +------------------------+-----------------------------------------------+ | irrelevant_column | json_stuff …
Stefan
  • 698
  • 7
  • 9
4
votes
4 answers

Migrations error in django 2; AttributeError: 'str' object has no attribute 'decode'

I am running migrations on my newly built app called 'core'. When I run migrations on it, I get an error that tells me this; query = query.decode(errors='replace') AttributeError: 'str' object has no attribute 'decode' I am posting the Traceback…
obadul024
  • 163
  • 1
  • 1
  • 13
4
votes
1 answer

Problem connecting MariaDB using PyMysql in Python

I have a Flask Python API that connects with a MariaDB database in a Docker container and I'm connecting to the database with PyMysql. The problem is that my server or application closes the connection after 10 minutes. I've already tried to…
rmmariano
  • 896
  • 1
  • 18
  • 32
4
votes
3 answers

Show HTML table with Flask and render_template

I would like to show a table on a website using Google Cloud SQL and Google App Engine. I am using Flask and pymysql. To show the result of my query I use the render_template of Flask. I already found other similar topics here (like Topic: Listing…
Mari
  • 43
  • 1
  • 3
4
votes
1 answer

django.db.utils.InterfaceError: (0, '')

I've recently implemented django in a tool I'm developing. While doing some tests I have been getting an django.db.utils.InterfaceError: (0, '') error. I have read that it might be a global cursor issue, however I am only doing queries through…
Pedro Queirós
  • 131
  • 1
  • 12
4
votes
1 answer

How do PyMySQL prevent user from sql injection attack?

Sorry for ask here but I cannot found much reference about pymysql's security guide about how do we prevent sql injection, When I do PHP develope I know use mysql preparedstatement(or called Parameterized Query or stmt),but I cannot found reference…
Jason117
  • 107
  • 2
  • 7
4
votes
1 answer

Insert list of dictionaries and variable into table

lst = [{'Fruit':'Apple','HadToday':2},{'Fruit':'Banana','HadToday':8}] I have a long list of dictionaries of the form above. I have two fixed variables. person = 'Sam' date = datetime.datetime.now() I wish to insert this information into a mysql…
4
votes
0 answers

(0, ''): InterfaceError in pymysql

I'm trying to read from a certain row in an MySQL data base. I'm getting an InterfaceError on line 17. The full error: (0, ''): InterfaceError Traceback (most recent call last): File "/var/task/handler.py", line 17, in main cur.execute(sql) I…
Caleb Bird
  • 65
  • 2
  • 7
4
votes
1 answer

import from a folder with dots in name - Python

I have a python package which looks like the following: package/ ├── __init__.py ├── PyMySQL-0.7.6-py2.7.egg ├── pymysql ├── PyMySQL-0.7.x.pth └── tests.py The folder structure cannot be changed because it is from a third party library. The…
vineet sinha
  • 317
  • 1
  • 4
  • 12
4
votes
2 answers

Does PyMySQL support Prepared Statements?

Does PyMySQL support prepared statements? I am trying to connect to MySQL from a python module. I have checked documentation at http://pymysql.readthedocs.io and didn't find anything useful. No luck on skimming the source code either.
Brindha
  • 349
  • 1
  • 5
  • 16
4
votes
1 answer

GAE Python - OperationalError: (2013, 'Lost connection to MySQL server during query')

I've been trying to connect to ClouSQL using Flexible Environments (vm:true) but when I upload my app using: gcloud preview app deploy --version MYVERSION An error is thrown: OperationalError: (2013, 'Lost connection to MySQL server during…
SupimpaAllTheWay
  • 1,308
  • 3
  • 16
  • 22
4
votes
1 answer

MySQL doesn't start: [ERROR] Failed to create a socket for IPv4 '127.0.0.1': errno: 13

I'm about to set up a low traffic web server onto an old Android phone in a chrooted environment. A Debian is installed onto the phone and works properly for some months (so this is a kind of special Linux environment). Apache2 and Python are up and…
Gyula Sámuel Karli
  • 3,118
  • 2
  • 15
  • 18