StackShareStackShare
Follow on
StackShare

Discover and share technology stacks from companies around the world.

Follow on

© 2025 StackShare. All rights reserved.

Product

  • Stacks
  • Tools
  • Feed

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Service
  1. Stackups
  2. Application & Data
  3. Languages
  4. Pypi Packages
  5. PyMySQL vs mysql-connector

PyMySQL vs mysql-connector

OverviewComparisonAlternatives

Overview

PyMySQL
PyMySQL
Stacks80
Followers3
Votes0
GitHub Stars7.4K
Forks1.5K
mysql-connector
mysql-connector
Stacks34
Followers1
Votes0
GitHub Stars36
Forks8

PyMySQL vs mysql-connector: What are the differences?

PyMySQL and mysql-connector are both Python libraries used for connecting to and interacting with MySQL databases. Let's explore the key differences between them.

  1. Connection and Cursor Creation: In PyMySQL, connections and cursors are created separately using Connection() and Cursor() functions. On the other hand, in mysql-connector, connections and cursors can be created using the connect() function and then accessing the cursor() method of the connection object.

  2. Parameter Placeholder Style: PyMySQL uses %s as the parameter placeholder style, similar to the %s style used in Python's C-style string formatting. On the contrary, mysql-connector uses a different style, where parameter placeholders are in the form of %(param_name)s.

  3. Casing of Field Names: PyMySQL, by default, returns the column names in lowercase format. In contrast, mysql-connector preserves the casing of column names as they are defined in the database, which includes any uppercase characters.

  4. Retrieving Auto-Incremented IDs: When inserting data into a table with an auto-incremented ID column, PyMySQL returns the last inserted ID using the lastrowid attribute of the cursor object. However, mysql-connector offers a more convenient approach by providing the lastrowid property of the connection object itself.

  5. Handling NULL Values: PyMySQL automatically converts NULL values to None when retrieving data from the database. On the other hand, mysql-connector does not perform this conversion, and NULL values are retained as they are.

  6. Required Libraries: PyMySQL requires the pure-python-mysqlclient library to be installed, whereas mysql-connector is a pure Python implementation and does not require any additional libraries.

In summary, PyMySQL is a pure Python library that offers simplicity and compatibility across different Python versions, while mysql-connector is a MySQL-specific library developed by Oracle that provides more advanced features and optimizations for working with MySQL databases.

Share your Stack

Help developers discover the tools you use. Get visibility for your team's tech choices and contribute to the community's knowledge.

View Docs
CLI (Node.js)
or
Manual

Detailed Comparison

PyMySQL
PyMySQL
mysql-connector
mysql-connector

Pure Python MySQL Driver.

MySQL driver written in Python.

Statistics
GitHub Stars
7.4K
GitHub Stars
36
GitHub Forks
1.5K
GitHub Forks
8
Stacks
80
Stacks
34
Followers
3
Followers
1
Votes
0
Votes
0

What are some alternatives to PyMySQL, mysql-connector?

google

google

Python bindings to the Google search engine.

requests

requests

Python HTTP for Humans.

pytest

pytest

Pytest: simple powerful testing with Python.

boto3

boto3

The AWS SDK for Python.

pandas

pandas

Powerful data structures for data analysis, time series, and statistics.

numpy

numpy

NumPy is the fundamental package for array computing with Python.

six

six

Python 2 and 3 compatibility utilities.

urllib3

urllib3

HTTP library with thread-safe connection pooling, file post, and more.

python-dateutil

python-dateutil

Extensions to the standard Python datetime module.

flake8

flake8

The modular source code checker: pep8, pyflakes and co.

Related Comparisons

Bootstrap
Materialize

Bootstrap vs Materialize

Laravel
Django

Django vs Laravel vs Node.js

Bootstrap
Foundation

Bootstrap vs Foundation vs Material UI

Node.js
Spring Boot

Node.js vs Spring-Boot

Liquibase
Flyway

Flyway vs Liquibase