{"id":18937440,"url":"https://github.com/bottlepy/bottle-sqlite","last_synced_at":"2025-04-13T08:02:27.057Z","repository":{"id":14912543,"uuid":"17636607","full_name":"bottlepy/bottle-sqlite","owner":"bottlepy","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-17T02:03:13.000Z","size":22,"stargazers_count":24,"open_issues_count":11,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-10T00:28:33.535Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/bottlepy.png","metadata":{"files":{"readme":"README.rst","changelog":null,"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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-03-11T15:57:34.000Z","updated_at":"2024-12-26T13:38:04.000Z","dependencies_parsed_at":"2024-06-20T19:01:16.214Z","dependency_job_id":"18a423fb-4af6-457c-a22d-ef2aa81c6b13","html_url":"https://github.com/bottlepy/bottle-sqlite","commit_stats":{"total_commits":31,"total_committers":9,"mean_commits":"3.4444444444444446","dds":0.5806451612903225,"last_synced_commit":"fce1bb95e724076cc3ca57eea8b70abfbe0c7e14"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bottlepy%2Fbottle-sqlite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bottlepy%2Fbottle-sqlite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bottlepy%2Fbottle-sqlite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bottlepy%2Fbottle-sqlite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bottlepy","download_url":"https://codeload.github.com/bottlepy/bottle-sqlite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248681480,"owners_count":21144700,"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-11-08T12:11:11.310Z","updated_at":"2025-04-13T08:02:26.974Z","avatar_url":"https://github.com/bottlepy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"=====================\nBottle-SQLite\n=====================\n\n.. image:: https://travis-ci.org/bottlepy/bottle-sqlite.png?branch=master\n    :target: https://travis-ci.org/bottlepy/bottle-sqlite\n    :alt: Build Status - Travis CI\n\nSQLite is a self-contained SQL database engine that runs locally and does not \nrequire any additional server software or setup. The sqlite3 module is part of the \nPython standard library and already installed on most systems. It it very useful \nfor prototyping database-driven applications that are later ported to larger \ndatabases such as PostgreSQL or MySQL. \n\nThis plugin simplifies the use of sqlite databases in your Bottle applications. \nOnce installed, all you have to do is to add a ``db`` keyword argument \n(configurable) to route callbacks that need a database connection.\n\nInstallation\n===============\n\nInstall with one of the following commands::\n\n    $ pip install bottle-sqlite\n    $ easy_install bottle-sqlite\n\nor download the latest version from github::\n\n    $ git clone git://github.com/bottlepy/bottle-sqlite.git\n    $ cd bottle-sqlite\n    $ python setup.py install\n\nUsage\n===============\n\nOnce installed to an application, the plugin passes an open \n:class:`sqlite3.Connection` instance to all routes that require a ``db`` keyword \nargument::\n\n    import bottle\n\n    app = bottle.Bottle()\n    plugin = bottle.ext.sqlite.Plugin(dbfile='/tmp/test.db')\n    app.install(plugin)\n\n    @app.route('/show/:item')\n    def show(item, db):\n        row = db.execute('SELECT * from items where name=?', item).fetchone()\n        if row:\n            return template('showitem', page=row)\n        return HTTPError(404, \"Page not found\")\n\nRoutes that do not expect a ``db`` keyword argument are not affected.\n\nThe connection handle is configured so that :class:`sqlite3.Row` objects can be \naccessed both by index (like tuples) and case-insensitively by name. At the end of \nthe request cycle, outstanding transactions are committed and the connection is \nclosed automatically. If an error occurs, any changes to the database since the \nlast commit are rolled back to keep the database in a consistent state.\n\nConfiguration\n=============\n\nThe following configuration options exist for the plugin class:\n\n* **dbfile**: Database filename (default: in-memory database).\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* **text_factory**: The text_factory for the connection (default: unicode).\n* **functions**: Add user-defined functions for use in SQL, should be a dict like ``{'name': (num_params, func)}`` (default: None).\n* **aggregates**: Add user-defined aggregate functions, should be a dict like ``{'name': (num_params, aggregate_class)}`` (default: None).\n* **collations**: Add user-defined collations, should be a dict like ``{'name': callable}`` (default: None).\n* **extensions**: Load extensions on connect. Should be a list of extension names. (default: None).\n\nYou can override each of these values on a per-route basis:: \n\n    @app.route('/cache/:item', sqlite={'dbfile': ':memory:'})\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    test_db = bottle.ext.sqlite.Plugin(dbfile='/tmp/test.db')\n    cache_db = bottle.ext.sqlite.Plugin(dbfile=':memory:', keyword='cache')\n    app.install(test_db)\n    app.install(cache_db)\n\n    @app.route('/show/:item')\n    def show(item, db):\n        ...\n\n    @app.route('/cache/:item')\n    def cache(item, cache):\n        ...\n\n\nChangelog\n=========\n\n* **0.2** 2020-10-03\n    * Fixed ``text_factory`` parameter.\n    * Added ``functions``, ``aggregates``, ``collations`` and ``extensions`` parameters.\n    * Stopped testing for dead Python versions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbottlepy%2Fbottle-sqlite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbottlepy%2Fbottle-sqlite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbottlepy%2Fbottle-sqlite/lists"}