PyMySQL


NamePyMySQL JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/PyMySQL/PyMySQL/
SummaryPure Python MySQL Driver
upload_time2021-01-09 11:33:41
maintainerInada Naoki
docs_urlNone
authoryutaka.matsubara
requires_python>=3.6
license"MIT"
keywords mysql
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            .. image:: https://readthedocs.org/projects/pymysql/badge/?version=latest
    :target: https://pymysql.readthedocs.io/
    :alt: Documentation Status

.. image:: https://coveralls.io/repos/PyMySQL/PyMySQL/badge.svg?branch=master&service=github
    :target: https://coveralls.io/github/PyMySQL/PyMySQL?branch=master

.. image:: https://img.shields.io/lgtm/grade/python/g/PyMySQL/PyMySQL.svg?logo=lgtm&logoWidth=18
    :target: https://lgtm.com/projects/g/PyMySQL/PyMySQL/context:python


PyMySQL
=======

.. contents:: Table of Contents
   :local:

This package contains a pure-Python MySQL client library, based on `PEP 249`_.

Most public APIs are compatible with mysqlclient and MySQLdb.

NOTE: PyMySQL doesn't support low level APIs `_mysql` provides like `data_seek`,
`store_result`, and `use_result`. You should use high level APIs defined in `PEP 249`_.
But some APIs like `autocommit` and `ping` are supported because `PEP 249`_ doesn't cover
their usecase.

.. _`PEP 249`: https://www.python.org/dev/peps/pep-0249/


Requirements
-------------

* Python -- one of the following:

  - CPython_ : 3.6 and newer
  - PyPy_ : Latest 3.x version

* MySQL Server -- one of the following:

  - MySQL_ >= 5.6
  - MariaDB_ >= 10.0

.. _CPython: https://www.python.org/
.. _PyPy: https://pypy.org/
.. _MySQL: https://www.mysql.com/
.. _MariaDB: https://mariadb.org/


Installation
------------

Package is uploaded on `PyPI <https://pypi.org/project/PyMySQL>`_.

You can install it with pip::

    $ python3 -m pip install PyMySQL

To use "sha256_password" or "caching_sha2_password" for authenticate,
you need to install additional dependency::

   $ python3 -m pip install PyMySQL[rsa]

To use MariaDB's "ed25519" authentication method, you need to install
additional dependency::

   $ python3 -m pip install PyMySQL[ed25519]


Documentation
-------------

Documentation is available online: https://pymysql.readthedocs.io/

For support, please refer to the `StackOverflow
<https://stackoverflow.com/questions/tagged/pymysql>`_.


Example
-------

The following examples make use of a simple table

.. code:: sql

   CREATE TABLE `users` (
       `id` int(11) NOT NULL AUTO_INCREMENT,
       `email` varchar(255) COLLATE utf8_bin NOT NULL,
       `password` varchar(255) COLLATE utf8_bin NOT NULL,
       PRIMARY KEY (`id`)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
   AUTO_INCREMENT=1 ;


.. code:: python

    import pymysql.cursors

    # Connect to the database
    connection = pymysql.connect(host='localhost',
                                 user='user',
                                 password='passwd',
                                 database='db',
                                 cursorclass=pymysql.cursors.DictCursor)

    with connection:
        with connection.cursor() as cursor:
            # Create a new record
            sql = "INSERT INTO `users` (`email`, `password`) VALUES (%s, %s)"
            cursor.execute(sql, ('webmaster@python.org', 'very-secret'))

        # connection is not autocommit by default. So you must commit to save
        # your changes.
        connection.commit()

        with connection.cursor() as cursor:
            # Read a single record
            sql = "SELECT `id`, `password` FROM `users` WHERE `email`=%s"
            cursor.execute(sql, ('webmaster@python.org',))
            result = cursor.fetchone()
            print(result)


This example will print:

.. code:: python

    {'password': 'very-secret', 'id': 1}


Resources
---------

* DB-API 2.0: https://www.python.org/dev/peps/pep-0249/

* MySQL Reference Manuals: https://dev.mysql.com/doc/

* MySQL client/server protocol:
  https://dev.mysql.com/doc/internals/en/client-server-protocol.html

* "Connector" channel in MySQL Community Slack:
  https://lefred.be/mysql-community-on-slack/

* PyMySQL mailing list: https://groups.google.com/forum/#!forum/pymysql-users

License
-------

PyMySQL is released under the MIT License. See LICENSE for more information.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/PyMySQL/PyMySQL/",
    "name": "PyMySQL",
    "maintainer": "Inada Naoki",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "songofacandy@gmail.com",
    "keywords": "MySQL",
    "author": "yutaka.matsubara",
    "author_email": "yutaka.matsubara@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/60/ea/33b8430115d9b617b713959b21dfd5db1df77425e38efea08d121e83b712/PyMySQL-1.0.2.tar.gz",
    "platform": "",
    "description": ".. image:: https://readthedocs.org/projects/pymysql/badge/?version=latest\n    :target: https://pymysql.readthedocs.io/\n    :alt: Documentation Status\n\n.. image:: https://coveralls.io/repos/PyMySQL/PyMySQL/badge.svg?branch=master&service=github\n    :target: https://coveralls.io/github/PyMySQL/PyMySQL?branch=master\n\n.. image:: https://img.shields.io/lgtm/grade/python/g/PyMySQL/PyMySQL.svg?logo=lgtm&logoWidth=18\n    :target: https://lgtm.com/projects/g/PyMySQL/PyMySQL/context:python\n\n\nPyMySQL\n=======\n\n.. contents:: Table of Contents\n   :local:\n\nThis package contains a pure-Python MySQL client library, based on `PEP 249`_.\n\nMost public APIs are compatible with mysqlclient and MySQLdb.\n\nNOTE: PyMySQL doesn't support low level APIs `_mysql` provides like `data_seek`,\n`store_result`, and `use_result`. You should use high level APIs defined in `PEP 249`_.\nBut some APIs like `autocommit` and `ping` are supported because `PEP 249`_ doesn't cover\ntheir usecase.\n\n.. _`PEP 249`: https://www.python.org/dev/peps/pep-0249/\n\n\nRequirements\n-------------\n\n* Python -- one of the following:\n\n  - CPython_ : 3.6 and newer\n  - PyPy_ : Latest 3.x version\n\n* MySQL Server -- one of the following:\n\n  - MySQL_ >= 5.6\n  - MariaDB_ >= 10.0\n\n.. _CPython: https://www.python.org/\n.. _PyPy: https://pypy.org/\n.. _MySQL: https://www.mysql.com/\n.. _MariaDB: https://mariadb.org/\n\n\nInstallation\n------------\n\nPackage is uploaded on `PyPI <https://pypi.org/project/PyMySQL>`_.\n\nYou can install it with pip::\n\n    $ python3 -m pip install PyMySQL\n\nTo use \"sha256_password\" or \"caching_sha2_password\" for authenticate,\nyou need to install additional dependency::\n\n   $ python3 -m pip install PyMySQL[rsa]\n\nTo use MariaDB's \"ed25519\" authentication method, you need to install\nadditional dependency::\n\n   $ python3 -m pip install PyMySQL[ed25519]\n\n\nDocumentation\n-------------\n\nDocumentation is available online: https://pymysql.readthedocs.io/\n\nFor support, please refer to the `StackOverflow\n<https://stackoverflow.com/questions/tagged/pymysql>`_.\n\n\nExample\n-------\n\nThe following examples make use of a simple table\n\n.. code:: sql\n\n   CREATE TABLE `users` (\n       `id` int(11) NOT NULL AUTO_INCREMENT,\n       `email` varchar(255) COLLATE utf8_bin NOT NULL,\n       `password` varchar(255) COLLATE utf8_bin NOT NULL,\n       PRIMARY KEY (`id`)\n   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin\n   AUTO_INCREMENT=1 ;\n\n\n.. code:: python\n\n    import pymysql.cursors\n\n    # Connect to the database\n    connection = pymysql.connect(host='localhost',\n                                 user='user',\n                                 password='passwd',\n                                 database='db',\n                                 cursorclass=pymysql.cursors.DictCursor)\n\n    with connection:\n        with connection.cursor() as cursor:\n            # Create a new record\n            sql = \"INSERT INTO `users` (`email`, `password`) VALUES (%s, %s)\"\n            cursor.execute(sql, ('webmaster@python.org', 'very-secret'))\n\n        # connection is not autocommit by default. So you must commit to save\n        # your changes.\n        connection.commit()\n\n        with connection.cursor() as cursor:\n            # Read a single record\n            sql = \"SELECT `id`, `password` FROM `users` WHERE `email`=%s\"\n            cursor.execute(sql, ('webmaster@python.org',))\n            result = cursor.fetchone()\n            print(result)\n\n\nThis example will print:\n\n.. code:: python\n\n    {'password': 'very-secret', 'id': 1}\n\n\nResources\n---------\n\n* DB-API 2.0: https://www.python.org/dev/peps/pep-0249/\n\n* MySQL Reference Manuals: https://dev.mysql.com/doc/\n\n* MySQL client/server protocol:\n  https://dev.mysql.com/doc/internals/en/client-server-protocol.html\n\n* \"Connector\" channel in MySQL Community Slack:\n  https://lefred.be/mysql-community-on-slack/\n\n* PyMySQL mailing list: https://groups.google.com/forum/#!forum/pymysql-users\n\nLicense\n-------\n\nPyMySQL is released under the MIT License. See LICENSE for more information.\n\n\n",
    "bugtrack_url": null,
    "license": "\"MIT\"",
    "summary": "Pure Python MySQL Driver",
    "version": "1.0.2",
    "split_keywords": [
        "mysql"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "9ae4fbf26a0d3752dc78cf8444d1bf0d",
                "sha256": "41fc3a0c5013d5f039639442321185532e3e2c8924687abe6537de157d403641"
            },
            "downloads": -1,
            "filename": "PyMySQL-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9ae4fbf26a0d3752dc78cf8444d1bf0d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 43828,
            "upload_time": "2021-01-09T11:33:39",
            "upload_time_iso_8601": "2021-01-09T11:33:39.780754Z",
            "url": "https://files.pythonhosted.org/packages/4f/52/a115fe175028b058df353c5a3d5290b71514a83f67078a6482cff24d6137/PyMySQL-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "3fe6ff2eefb58af5c54d335c6e0216de",
                "sha256": "816927a350f38d56072aeca5dfb10221fe1dc653745853d30a216637f5d7ad36"
            },
            "downloads": -1,
            "filename": "PyMySQL-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "3fe6ff2eefb58af5c54d335c6e0216de",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 45478,
            "upload_time": "2021-01-09T11:33:41",
            "upload_time_iso_8601": "2021-01-09T11:33:41.482454Z",
            "url": "https://files.pythonhosted.org/packages/60/ea/33b8430115d9b617b713959b21dfd5db1df77425e38efea08d121e83b712/PyMySQL-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-01-09 11:33:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "PyMySQL",
    "github_project": "PyMySQL",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "pymysql"
}
        
Elapsed time: 0.04876s