{ "info": { "author": "Tobias Ammann", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Topic :: Database :: Front-Ends" ], "description": "sqlfunc\n=======\n\nClever stuff with SQL in __doc__\n\nFeatures\n--------\n\n- In-memory or file-backed database (Sqlite)\n- Post-process returned data\n- User definded functions\n\nExample\n-------\n\nGiven this:\n\n.. code:: python\n\n ''' CREATE TABLE IF NOT EXISTS users (\n userid INTEGER PRIMARY KEY,\n username TEXT UNIQUE NOT NULL,\n bcrypt BLOB NOT NULL\n );\n '''\n from sqlfunc import sqlinit, sqludf, sqlfunc\n \n __database__ = ':memory:' # default\n \n @sqludf\n def bcrypt_hash(password):\n # call to library here\n return b'$2b$12$.OjbRwRejxw92C89sA6JkOVrhmQzGsjoyCf1ofIN9hUNdHFufb3ty'\n \n @sqludf\n def bcrypt_verify(password, bcrypthash):\n # call to library here\n return True\n \n @sqlfunc\n def add_user(username, password):\n ''' INSERT OR IGNORE INTO $$$ (username, bcrypthash)\n VALUES (:username, bcrypt_hash(:password));\n '''\n \n @sqlfunc(post=lambda x: bool(list(x)))\n def login(username, password):\n ''' SELECT 1 FROM users\n WHERE username=:username\n AND bcrypt_verify(:password, bcrypt);\n '''\n \n sqlinit()\n\nYou can now do this:\n\n.. code:: python\n\n >>> import example_users\n >>> example_users.add_user('root', 'password123')\n >>> example_users.login('root', 'secret')\n False\n >>> example_users.login('root', 'password123')\n True\n >>> example_users.list_users()\n ['root']\n >>> 'bcrypt_verify' in dir(example_users) # helper functions are NOT exported\n False\n\nThis library is MIT licensed.", "description_content_type": null, "docs_url": null, "download_url": "https://pypi.python.org/pypi/sqlitent", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/digitalmensch/sqlfunc", "keywords": "sqlite,function", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "sqlfunc", "package_url": "https://pypi.org/project/sqlfunc/", "platform": "any", "project_url": "https://pypi.org/project/sqlfunc/", "project_urls": { "Download": "https://pypi.python.org/pypi/sqlitent", "Homepage": "https://github.com/digitalmensch/sqlfunc" }, "release_url": "https://pypi.org/project/sqlfunc/0.1/", "requires_dist": null, "requires_python": "", "summary": "Clever stuff with SQL in __doc__", "version": "0.1" }, "last_serial": 3473024, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "36f202ac7e35b73d9331d297d7a63a41", "sha256": "35784a5b7831644a1f05b3a99bb839904bd133f9a2c0bc4b98ce8bfc00b7a476" }, "downloads": -1, "filename": "sqlfunc-0.1.tar.gz", "has_sig": false, "md5_digest": "36f202ac7e35b73d9331d297d7a63a41", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2704, "upload_time": "2018-01-09T04:44:59", "url": "https://files.pythonhosted.org/packages/3e/86/4272004a6e3de0cdaab8560baafa71cfffcc8922c3925e9d72e707334e81/sqlfunc-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "36f202ac7e35b73d9331d297d7a63a41", "sha256": "35784a5b7831644a1f05b3a99bb839904bd133f9a2c0bc4b98ce8bfc00b7a476" }, "downloads": -1, "filename": "sqlfunc-0.1.tar.gz", "has_sig": false, "md5_digest": "36f202ac7e35b73d9331d297d7a63a41", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2704, "upload_time": "2018-01-09T04:44:59", "url": "https://files.pythonhosted.org/packages/3e/86/4272004a6e3de0cdaab8560baafa71cfffcc8922c3925e9d72e707334e81/sqlfunc-0.1.tar.gz" } ] }