{"id":13605204,"url":"https://github.com/dvrhax/uPyMySQL","last_synced_at":"2025-04-12T02:32:57.758Z","repository":{"id":78056632,"uuid":"172830284","full_name":"dvrhax/uPyMySQL","owner":"dvrhax","description":"Pure uPython MySQL Client","archived":false,"fork":false,"pushed_at":"2020-05-07T12:41:15.000Z","size":483,"stargazers_count":22,"open_issues_count":3,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-22T13:31:31.005Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dvrhax.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-02-27T02:46:34.000Z","updated_at":"2023-09-27T09:44:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"a9c535ec-80ef-42f7-8338-1922d51cd264","html_url":"https://github.com/dvrhax/uPyMySQL","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvrhax%2FuPyMySQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvrhax%2FuPyMySQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvrhax%2FuPyMySQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvrhax%2FuPyMySQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dvrhax","download_url":"https://codeload.github.com/dvrhax/uPyMySQL/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248506933,"owners_count":21115510,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T19:00:55.765Z","updated_at":"2025-04-12T02:32:57.448Z","avatar_url":"https://github.com/dvrhax.png","language":"Python","readme":".. image:: https://img.shields.io/badge/license-MIT-blue.svg\n    :target: https://github.com/dvrhax/uPyMySQL/blob/master/LICENSE\n\n\nuPyMySQL\n=======\n\n.. contents:: Table of Contents\n   :local:\n\nThis package contains a pretty rough hack of the pure-Python MySQL client library. The goal of uPyMySQL\nis to be a drop-in replacement for MySQLdb and work on uPython.\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.  Ditto for uPyMySQL\n\n.. _`PEP 249`: https://www.python.org/dev/peps/pep-0249/\n\nRequirements\n-------------\n\n* uPython_\n\n* MySQL Server -- one of the following:\n\n  - MySQL_ \u003e= 4.1  (tested with only 5.5~)\n  - MariaDB_ \u003e= 5.1\n\n.. _uPython: https://micropython.org/\n.. _MySQL: http://www.mysql.com/\n.. _MariaDB: https://mariadb.org/\n\n\nInstallation\n------------\n\n    Clone from Git and copy the upymysql folder onto your microcontroller\n    Most likely directly copying onto your microcontroller will fail.  \n    You will likely need to re-compile micropython including upymysql into the firmware\n\n\nDocumentation\n-------------\n\n    You're pretty much looking at it\n\nExample\n-------\n\nNo Guarantees that these work yet:\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=utf8 COLLATE=utf8_bin\n   AUTO_INCREMENT=1 ;\n\n\n.. code:: python\n\n    import upymysql\n    import upymysql.cursors\n\n    # Connect to the database\n    connection = upymysql.connect(host='localhost',\n                                 user='user',\n                                 password='passwd',\n                                 db='db',\n                                 charset='utf8mb4',\n                                 cursorclass=upymysql.cursors.DictCursor)\n\n    try:\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    finally:\n        connection.close()\n\nThis example will print:\n\n.. code:: python\n\n    {'password': 'very-secret', 'id': 1}\n\n\nResources\n---------\n\nDB-API 2.0: http://www.python.org/dev/peps/pep-0249\n\nMySQL Reference Manuals: http://dev.mysql.com/doc/\n\nMySQL client/server protocol:\nhttp://dev.mysql.com/doc/internals/en/client-server-protocol.html\n\nPyMySQL mailing list: https://groups.google.com/forum/#!forum/pymysql-users\n\nPyMySQL Github site: https://github.com/PyMySQL/PyMySQL\n\nuPython: https://micropython.org/\n\nLicense\n-------\n\nPyMySQL is released under the MIT License. See LICENSE for more information.\n","funding_links":[],"categories":["Database","Libraries"],"sub_categories":["Storage"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvrhax%2FuPyMySQL","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdvrhax%2FuPyMySQL","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvrhax%2FuPyMySQL/lists"}