{ "info": { "author": "Young King", "author_email": "yanckin@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "License :: OSI Approved :: BSD License", "Programming Language :: Python" ], "description": "mydb\n================\nmydb is a simple db wrapper for mysql.\n\n.. contents::\n\nInstall\n=================\n::\n\n pip install mydb\n\nUsage\n================\n\nSingle Connection\n--------------------\n\n::\n\n\n from mydb.connection import Connection\n\n db = Connection(\"mysql://youngking@localhost:13306/mydatabase\")\n for article in db.query(\"SELECT * FROM articles\"):\n print article.title\n\n\nMultiple Connection Like Master/Slave\n-----------------------------------------\n\n::\n\n from mydb.router import ConnectionRouter\n from mydb.proxy import DBProxy\n router = ConnectionRouter([\"myapp.somewhere.MasterSlaveRouter\"])\n db = DBProxy(router)\n\n for article in db.query(\"SELECT * FROM articles\"):\n print article.title\n\n\nDatabase routers\n~~~~~~~~~~~~~~~~~~~\n\nA database Router is a class that provides up to two methods:\n\ndb_for_read(statement, \\**hints)\n\n::\n\n Suggest the database that should be used for read operations for ``SELECT`` statement.\n\n If a database operation is able to provide any additional information that might assist in selecting a database, it will be provided in the hints dictionary. Details on valid hints are provided below.\n\n Returns None if there is no suggestion.\n\ndb_for_write(model, \\**hints)\n\n::\n\n Suggest the database that should be used for writes of statements except ``SELECT``.\n\n If a database operation is able to provide any additional information that might assist in selecting a database, it will be provided in the hints dictionary. Details on valid hints are provided below.\n\n\nThere is an example in ``tests/test_router.py``.\n\nA router doesn\u2019t have to provide all these methods \u2013 it may omit one or more of them. If one of the methods is omitted, \nmydb will skip that router when performing the relevant check.\n\n\nIn ``mydb.router`` there are some default routers, where you can inherit from and overwriten them.\n\n\nLinks\n===============================\n\n* `documentation `_\n\n* `SouceCode at github `_", "description_content_type": null, "docs_url": "https://pythonhosted.org/mydb/", "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/youngking/mydb", "keywords": "orm mysql", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "mydb", "package_url": "https://pypi.org/project/mydb/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/mydb/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/youngking/mydb" }, "release_url": "https://pypi.org/project/mydb/0.1.2/", "requires_dist": null, "requires_python": null, "summary": "db wrapper for mysql", "version": "0.1.2" }, "last_serial": 906023, "releases": { "0.1.0": [], "0.1.2": [ { "comment_text": "", "digests": { "md5": "1d21a46b16496fc41ce81c357802eb8d", "sha256": "73b8d0ba5460f626990519db99846419f200925c2f178af873c81f156a591fa5" }, "downloads": -1, "filename": "mydb-0.1.2.tar.gz", "has_sig": false, "md5_digest": "1d21a46b16496fc41ce81c357802eb8d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17568, "upload_time": "2013-10-29T05:32:31", "url": "https://files.pythonhosted.org/packages/2b/37/dde5ab43c033222c86c78676437c948c2330b148cf719bfc8850d9ab180d/mydb-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1d21a46b16496fc41ce81c357802eb8d", "sha256": "73b8d0ba5460f626990519db99846419f200925c2f178af873c81f156a591fa5" }, "downloads": -1, "filename": "mydb-0.1.2.tar.gz", "has_sig": false, "md5_digest": "1d21a46b16496fc41ce81c357802eb8d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17568, "upload_time": "2013-10-29T05:32:31", "url": "https://files.pythonhosted.org/packages/2b/37/dde5ab43c033222c86c78676437c948c2330b148cf719bfc8850d9ab180d/mydb-0.1.2.tar.gz" } ] }