{ "info": { "author": "Emre Yilmaz", "author_email": "mail@emreyilmaz.me", "bugtrack_url": null, "classifiers": [], "description": "Lurker\n======\nLurker is a tiny mysql wrapper built on the top of python-mySQLdb.\n\nInstallation\n======\n```\ngit clone git://github.com/emre/lurker.git\npython setup.py install\n```\n\nQuick Tutorial\n======\n\nConnecting to the database\n--------\n\n* with Configuration objects. (This could be preferrable for seperating environments like DevConfig, ProdConfig, TestConfig)\n\n\n``` python\nclass DatabaseConfig(BaseLurkerConfig):\n host = 'localhost'\n user = 'root'\n passwd = ''\n db = ''\n\nconnection = Connection(DbConfig)\n\n```\n\n* without Configuration objects\n\n```python\n\nconnection = Connection().quick_connect(\"mysql_user\", \"mysql_passwd\", \"db_name\", \"host\")\n\n```\n\nSending Queries\n--------\n``` python\n# returns last_id\nconnection.execute(\"INSERT INTO table_name (name) VALUES (%s)\", ['Selami Sahin', ])\n\n# returns row count\nconnection.execute(\"UPDATE table_name SET name = %s\", [\"Muhittin Bosat\", ])\n\n# returns a result set\nall_people = connection.get_results(\"SELECT * FROM people\")\n\n# returns a row\none_people = connection.get_row(\"SELECT * FROM people WHERE id = 1\")\n\n# server-side cursor\nfor person in connection.iterate(\"SELECT * FROM people\"):\n print person\n```\n\nQuery Caching Support with Redis\n--------\n* In order to activate caching support, you need to set cache and cache_information variables in your config class.\n\n``` python\nfrom lurker.configuration import BaseLurkerConfig\nfrom lurker.connection import Connection\nfrom lurker.cache.backends.redis_backend import RedisBackend\n\nclass DbConfig(BaseLurkerConfig):\n host = 'localhost'\n user = 'root'\n passwd = 'passwd'\n db = 'db_name'\n cache = True\n cache_information = {\n 'backend': RedisBackend,\n 'args': (),\n 'kwargs': {'host': 'localhost', 'port': 6379, 'db': 0},\n }\n```\n\n* Usage in get_results and get_row\n\n``` python\n\nprint connection.get_row(\"SELECT * FROM people WHERE id = %s\", parameters=(1,), cache=30)\nprint connection.get_row(\"SELECT * FROM people WHERE id = %s\", parameters=(1,), cache=30)\n\n# output\n# DEBUG:root:cache miss: SELECT * FROM people WHERE id = %s\n# {'id': 1L, 'name': u'Emre Yilmaz'}\n# DEBUG:root:cache hit: SELECT * FROM people WHERE id = %s\n# {u'id': 1, u'name': u'Emre Yilmaz'}\n\n```\n\nMaintainer\n======\nEmre Y\u0131lmaz - [@emre_yilmaz](http://twitter.com/emre_yilmaz)\n\nContributors\n=============\nMirat Can Bayrak - [@mirat](http://twitter.com/mirat)\n\nProjects/Scripts powered by lurker\n====================================\n - Database Copy: https://gist.github.com/4686232#file-db_copy-py\n\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://www.github.com/emre/lurker", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "lurker", "package_url": "https://pypi.org/project/lurker/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/lurker/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://www.github.com/emre/lurker" }, "release_url": "https://pypi.org/project/lurker/0.1/", "requires_dist": null, "requires_python": null, "summary": "a tiny wrapper for mysqldb", "version": "0.1" }, "last_serial": 794400, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "942803d29a7e6125ed0e59b14abd0f27", "sha256": "bc0bf8bb65c813902667100fca3faacff4eb1a7b361c5ca5dc3f8007178f84ee" }, "downloads": -1, "filename": "lurker-0.1.tar.gz", "has_sig": false, "md5_digest": "942803d29a7e6125ed0e59b14abd0f27", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4436, "upload_time": "2013-02-12T10:49:30", "url": "https://files.pythonhosted.org/packages/39/14/49075f6de11f3208ab504ecc9b6c49ea4105ba696f44994f17ffce66d7c6/lurker-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "942803d29a7e6125ed0e59b14abd0f27", "sha256": "bc0bf8bb65c813902667100fca3faacff4eb1a7b361c5ca5dc3f8007178f84ee" }, "downloads": -1, "filename": "lurker-0.1.tar.gz", "has_sig": false, "md5_digest": "942803d29a7e6125ed0e59b14abd0f27", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4436, "upload_time": "2013-02-12T10:49:30", "url": "https://files.pythonhosted.org/packages/39/14/49075f6de11f3208ab504ecc9b6c49ea4105ba696f44994f17ffce66d7c6/lurker-0.1.tar.gz" } ] }