{"id":17339898,"url":"https://github.com/tg123/bottle-mysql","last_synced_at":"2025-07-15T05:40:26.135Z","repository":{"id":10527652,"uuid":"12719446","full_name":"tg123/bottle-mysql","owner":"tg123","description":"MySQL integration for Bottle.","archived":false,"fork":false,"pushed_at":"2024-07-17T15:49:05.000Z","size":23,"stargazers_count":21,"open_issues_count":2,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-07T18:16:50.654Z","etag":null,"topics":["bottle","database","mysql"],"latest_commit_sha":null,"homepage":"https://pypi.python.org/pypi/bottle-mysql/ ","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/tg123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-09-10T03:30:09.000Z","updated_at":"2023-11-20T11:40:12.000Z","dependencies_parsed_at":"2024-10-31T16:03:33.754Z","dependency_job_id":"913dfce0-dad9-4b56-8635-14c269c67f01","html_url":"https://github.com/tg123/bottle-mysql","commit_stats":{"total_commits":29,"total_committers":8,"mean_commits":3.625,"dds":0.4137931034482759,"last_synced_commit":"6e7a7ae034f7735334c664bb0af6e7c72e15cbd9"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tg123%2Fbottle-mysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tg123%2Fbottle-mysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tg123%2Fbottle-mysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tg123%2Fbottle-mysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tg123","download_url":"https://codeload.github.com/tg123/bottle-mysql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233960035,"owners_count":18757410,"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":["bottle","database","mysql"],"created_at":"2024-10-15T15:43:25.042Z","updated_at":"2025-01-14T21:14:13.747Z","avatar_url":"https://github.com/tg123.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Bottle-MySQL\n============\n[![Build Status](https://travis-ci.org/tg123/bottle-mysql.svg?branch=master)](https://travis-ci.org/tg123/bottle-mysql)\n[![Latest Version](https://img.shields.io/pypi/v/bottle-mysql.svg)](https://pypi.python.org/pypi/bottle-mysql/)\n[![Downloads](https://img.shields.io/pypi/dm/bottle-mysql.svg)](https://pypi.python.org/pypi/bottle-mysql/)\n\nMySQL is the world's most used relational database management system (RDBMS) that runs\nas a server providing multi-user access to a number of databases.\n\nThis plugin simplifies the use of mysql databases in your Bottle applications. \nOnce installed, all you have to do is to add an ``db`` keyword argument \n(configurable) to route callbacks that need a database connection.\n\n\n`Bottle-MySQL` is written by Michael Lustfield [MTecknology](https://github.com/MTecknology)\nand now is maintained by Boshi Lian (tgic).\n\n\nInstallation\n------------\n\nInstall using pip:\n\n    $ pip install bottle-mysql\n\nor download the latest version from github:\n\n    $ git clone git://github.com/tg123/bottle-mysql.git\n    $ cd bottle-mysql\n    $ python setup.py install\n\nUsage\n-----\n\nOnce installed to an application, the plugin passes an open \n:class:`MySQLdb.connect().cursor()` instance to all routes that requires an ``db`` keyword \nargument:\n\n    import bottle\n    import bottle_mysql\n\n    app = bottle.Bottle()\n    # dbhost is optional, default is localhost\n    plugin = bottle_mysql.Plugin(dbuser='user', dbpass='pass', dbname='some_db')\n    app.install(plugin)\n\n    @app.route('/show/\u003citem\u003e')\n    def show(item, db):\n        db.execute('SELECT * from items where name=\"%s\"', (item,))\n        row = db.fetchone()\n        if row:\n            return template('showitem', page=row)\n        return HTTPError(404, \"Page not found\")\n\nRoutes that do not expect an ``db`` keyword argument are not affected.\n\nThe connection handle is configurable so that rows can be returned as either an\nindex (like tuples) or as dictionaries. At the end of the request cycle, outstanding\ntransactions are committed and the connection is closed automatically. If an error\noccurs, any changes to the database since the last commit are rolled back to keep\nthe database in a consistent state.\n\nConfiguration\n-------------\n\nThe following configuration options exist for the plugin class:\n\n* **dbuser**: Username that will be used to connect to the database (default: None).\n* **dbpass**: Password that will be used to connect to the database (default: None).\n* **dbname**: Database name that will be connected to (default: None).\n* **dbhost**: Databse server host (default: 'localhost').\n* **dbport**: Databse server port (default: 3306).\n* **dbunixsocket**: Optionally, you can use a unix socket rather than TCP/IP.\n* **keyword**: The keyword argument name that triggers the plugin (default: 'db').\n* **autocommit**: Whether or not to commit outstanding transactions at the end of the request cycle (default: True).\n* **dictrows**: Whether or not to support dict-like access to row objects (default: True).\n* **charset**: Database connection charset (default: 'utf8')\n* **timezone**: Database connection time zone (default: None).\n* **conv**: Database output conversion using MySQLdb.converters.\n\nYou can override each of these values on a per-route basis: \n\n    @app.route('/cache/\u003citem\u003e', mysql={'dbname': 'xyz_db'})\n    def cache(item, db):\n        ...\n   \nor install two plugins with different ``keyword`` settings to the same application:\n\n    app = bottle.Bottle()\n    local_db = bottle_mysql.Plugin(dbuser='user', dbpass='pass', dbname='local_db')\n    prod_db = bottle_mysql.Plugin(dbuser='user', dbpass='pass', dbname='some_db', dbhost='sql.domain.tld', keyword='remote_db')\n    app.install(local_db)\n    app.install(prod_db)\n\n    @app.route('/show/\u003citem\u003e')\n    def show(item, db):\n        ...\n\n    @app.route('/cache/\u003citem\u003e')\n    def cache(item, remote_db):\n        ...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftg123%2Fbottle-mysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftg123%2Fbottle-mysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftg123%2Fbottle-mysql/lists"}