{ "info": { "author": "Lutong Chen", "author_email": "lutong98@mail.ustc.edu.cn", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Database", "Topic :: Database :: Database Engines/Servers", "Topic :: Utilities" ], "description": "=======\nJardb\n=======\n\n.. image:: https://img.shields.io/badge/pypi-v0.0.5-green.svg\n :target: https://pypi.python.org/pypi/jardb\n\n.. image:: https://img.shields.io/badge/License-MIT-blue.svg\n :target: https://pypi.python.org/pypi/jardb\n :alt: License\n\n.. image:: https://travis-ci.org/andytt/jardb.svg?branch=master\n :target: https://travis-ci.org/andytt/jardb\n\n.. image:: https://coveralls.io/repos/github/andytt/jardb/badge.svg?branch=master\n :target: https://coveralls.io/github/andytt/jardb?branch=master\n\n**Jardb** is a small document oriented database, which is Nosql,easy to use \nand tiny.\n\nIt is suitable for local applications to save data and configurations.\n\nJardb use no more than Python Standard Library.\n\nInformation\n#############\n\n:Author: Lutong Chen\n:Vision: 0.0.5\n:License: MIT\n:mail: lutong98@mail.ustc.edu.cn\n\nFeatures\n#############\n\n1. Fast: 10 millions insert in minutes.\n#. Easy: API is easy to learn and use.\n#. Tiny: One file based database.\n#. Automatic: Auto save from memery to disk.\n#. Logs: Write log into file\n#. Test: More Than 90% unit test coverage.\n\nInstall\n#############\n\npip is available new.python 2.7 and 3.3+ is required.\n\n>>> pip install jardb\n\nor \n\n>>> pip3 install jardb\n\nUsage\n#############\n\nStorage\n+++++++++\n\nThere are three ways to Storage:Json, Binary File and Memery. \n\n+ \"json://\": A json file would be create, all information can be seen.\n+ \"file://\": A binary file created by pickle.dump\n+ \"memery://\": All data will not be saved as a file and would disappear after jardb quits.\n\nOpen a **jardb** database should be a url-like string start with \"json://\",\"file://\" or \"memery://\":\n\n>>> from jardb import jardb\n\n>>> db = jardb(\"json://database.db\")\n\nother parameters:\n-------------------\n\n:param autosave: boolean, use autosave or not.\n\n:param debug: print logs in the terminal.\n\n:param log: A log file path.If defined,logs will be written into it.\n\nRead, Initialize, Save and Close\n++++++++++++++++++++++++++++++++++\n\nCreate a new database like:\n\n>>> db.create()\n\nOpen from a existed file like:\n\n>>> db.open()\n\nSave to disk:\n\n>>> db.save()\n\n\"Save AS\" another file:\n\n>>> db.backup(\"file_path\")\n\nYou should understand that if you turn it on, it may cause performance \nloss(though a little).If you turn it off,you should save your database \nfrom time to time, because it will only write datas into file only once \nbefore it quits.\n\nClose a database like:\n\n>>> db.close()\n\njardb.close() will call jardb.save().\nAlso, before jardb exits, jardb will automatical be called.\n\nCreate Dbtable and DbConfig\n++++++++++++++++++++++++++++++++++\n\nThere are two kinds of elements that can be directly inserted into database:\nDbConfig and DbTable.\n\n+ DbConfig is like a python dictionary or a '.plist','.ini' or '.conf' file.\n+ DbTable is the common Table in Database.\n\nCreate a new DbConfig:\n-----------------------\n\n>>> db.create_config(config_name,{'AppName':'jardb','Version':'0.0.3'})\n\n:param config_name: name.\n:param config_dict: a python dictionary.\n\nconfig_name will not check uniqueness. Please be careful with it.\n\n\nCreate a new Table:\n----------------------\n\n>>> create_table('Users',{}):\n\n:param table_name: You know what it means.\n:param table_attr: properties for fields in this table.\n\nIt is expected as a dictionary.Dictionary Key should be field name,such as\n'Users','email'. Dictionary Value should be a list contains its properties,\nsuch as [\"AutoIncrease\",\"Unique\",\"NotNull\"]\n\n:\"Unique\": jardb will check the Uniqueness of certain field.\n:\"NotNull\": jardb will check before insert.\n:\"AutoIncrease\": If the field is not be specified,jardb will automatical appoint one.\n\nYou don't have to all fields.You can ignore one if it doesn't contain such \nproperties.\n \nexample: \n {'id':['AutoIncrease','Unique'],'data':['NotNull','Unique']}\n\ntable_name will not check uniqueness. Please be careful with it.\n\nRemove a DbConfig or DbTable\n------------------------------\n\n>>> db.remove('Users')\n\n\nQuery and Operations\n++++++++++++++++++++++\n\nYou need to get a query object before you operate a DbConfig or DbTable\n\n>>> q1 = db.get_config('Config')\n>>> q2 = db.get_table('Users')\n\nHere are some examples:\n\n>>> q1.add({'user':1,'secure':2}) # Insert value\n>>> q1.add({'user':5,'data':123}) # Insert and change value\n>>> q1.remove('secure') # Remove \n>>> print(q1.has('secure')) # Has key\nFalse\n>>> print(q1.has('user'))\nTrue\n>>> print(q1.get('secure')) # Get value\nNone\n>>> print(q1.get('user'))\n5\n>>> print(q1.value()) # Show raw data\n{'user': 5, 'data': 123}\n\nAnother example:\n\nGet a query object.\n\n>>> q2 = db.get_table('Users') \n\n+ *Filter* can select records using a python-like language.\n+ *Remove* can delete records.\n\n>>> q2.filter(\"$id %3 == 0 and is_admin == True\").remove() \n\n+ *Update* can change the value of selected records.\n\n>>> q2.update({'is_admin':False})\n\n+ *Find* is another way to select records.\n+ *Sort* to sort records by a certain field.\n+ *Get* can get 'top k' records.\n+ *Value* is used to show raw data\n\n>>> q2.find({'is_admin':False}).sort('id').get(5).value()\n\n+ *Map* : Given a field name, and return all values of this field.\n\n>>> print(col.filter(\"$User_id % 4 == 0\").map('id'))\n\nWith all those function you can use *jardb* easily.\n\nYou can also use jardb.compose to operate database.More details in source code\u3002\n\nlog\n++++++\n\nYou can write logs into a file like:\n\n>>> db = jardb.jardb('json://database.db',log = 'database.log')\n\nAlso let it print in the terminal:\n\n>>> db = jardb.jardb('json://database.db',debug = True)\n\nNotice that if log parameter is specified, log will be find in the file no matter 'debug' is True or False.\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/andytt/jardb", "keywords": "", "license": "Copyright (c) 2018, Chen Lutong.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.", "maintainer": "", "maintainer_email": "", "name": "jardb", "package_url": "https://pypi.org/project/jardb/", "platform": "any", "project_url": "https://pypi.org/project/jardb/", "project_urls": { "Homepage": "https://github.com/andytt/jardb" }, "release_url": "https://pypi.org/project/jardb/0.0.5/", "requires_dist": null, "requires_python": "", "summary": "A small Document Oriented Databse", "version": "0.0.5" }, "last_serial": 3511018, "releases": { "0.0.4": [ { "comment_text": "", "digests": { "md5": "aad0ba1e8565cdbd90a25142f7393f13", "sha256": "b645dc66e96c592236d7935a372265f9a00730b2c6173819c8b09ab0ed63f39c" }, "downloads": -1, "filename": "jardb-0.0.4.tar.gz", "has_sig": false, "md5_digest": "aad0ba1e8565cdbd90a25142f7393f13", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16682, "upload_time": "2018-01-21T13:53:58", "url": "https://files.pythonhosted.org/packages/50/ce/e38cd88ea2a2a4821da7a38369e05a43ba06b3c5d92aad2669b34fdc4ffa/jardb-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "56010d28ad1cee021f0badf52076cefd", "sha256": "ca0203366933acce79d39a38d38ce3a43e02d483a952046cb634084259f3ec8e" }, "downloads": -1, "filename": "jardb-0.0.5.tar.gz", "has_sig": false, "md5_digest": "56010d28ad1cee021f0badf52076cefd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17305, "upload_time": "2018-01-22T12:51:05", "url": "https://files.pythonhosted.org/packages/81/8a/a4cea748ea9ead9b820b6029f091fd77b8db10824b63354ba8d747365dad/jardb-0.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "56010d28ad1cee021f0badf52076cefd", "sha256": "ca0203366933acce79d39a38d38ce3a43e02d483a952046cb634084259f3ec8e" }, "downloads": -1, "filename": "jardb-0.0.5.tar.gz", "has_sig": false, "md5_digest": "56010d28ad1cee021f0badf52076cefd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17305, "upload_time": "2018-01-22T12:51:05", "url": "https://files.pythonhosted.org/packages/81/8a/a4cea748ea9ead9b820b6029f091fd77b8db10824b63354ba8d747365dad/jardb-0.0.5.tar.gz" } ] }