METADATA 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. Metadata-Version: 2.0
  2. Name: tinydb
  3. Version: 3.9.0.post1
  4. Summary: TinyDB is a tiny, document oriented database optimized for your happiness :)
  5. Home-page: https://github.com/msiemens/tinydb
  6. Author: Markus Siemens
  7. Author-email: markus@m-siemens.de
  8. License: MIT
  9. Project-URL: Documentation, http://tinydb.readthedocs.org/
  10. Project-URL: Changelog, https://tinydb.readthedocs.io/en/latest/changelog.html
  11. Project-URL: Extensions, https://tinydb.readthedocs.io/en/latest/extensions.html
  12. Project-URL: Issues, https://github.com/msiemens/tinydb/issues
  13. Keywords: database nosql
  14. Platform: UNKNOWN
  15. Classifier: Development Status :: 5 - Production/Stable
  16. Classifier: Intended Audience :: Developers
  17. Classifier: Intended Audience :: System Administrators
  18. Classifier: License :: OSI Approved :: MIT License
  19. Classifier: Topic :: Database
  20. Classifier: Topic :: Database :: Database Engines/Servers
  21. Classifier: Topic :: Utilities
  22. Classifier: Programming Language :: Python :: 2
  23. Classifier: Programming Language :: Python :: 2.7
  24. Classifier: Programming Language :: Python :: 3
  25. Classifier: Programming Language :: Python :: 3.3
  26. Classifier: Programming Language :: Python :: 3.4
  27. Classifier: Programming Language :: Python :: 3.5
  28. Classifier: Programming Language :: Python :: 3.6
  29. Classifier: Programming Language :: Python :: Implementation :: CPython
  30. Classifier: Programming Language :: Python :: Implementation :: PyPy
  31. Classifier: Operating System :: OS Independent
  32. .. image:: https://raw.githubusercontent.com/msiemens/tinydb/master/artwork/logo.png
  33. :scale: 100%
  34. :height: 150px
  35. |Build Status| |Coverage| |Version|
  36. Quick Links
  37. ***********
  38. - `Example Code`_
  39. - `Supported Python Versions`_
  40. - `Documentation <http://tinydb.readthedocs.org/>`_
  41. - `Changelog <https://tinydb.readthedocs.io/en/latest/changelog.html>`_
  42. - `Extensions <https://tinydb.readthedocs.io/en/latest/extensions.html>`_
  43. - `Contributing`_
  44. Introduction
  45. ************
  46. TinyDB is a lightweight document oriented database optimized for your happiness :)
  47. It's written in pure Python and has no external dependencies. The target are
  48. small apps that would be blown away by a SQL-DB or an external database server.
  49. TinyDB is:
  50. - **tiny:** The current source code has 1200 lines of code (with about 40%
  51. documentation) and 1000 lines tests. For comparison: Buzhug_ has about 2500
  52. lines of code (w/o tests), CodernityDB_ has about 7000 lines of code
  53. (w/o tests).
  54. - **document oriented:** Like MongoDB_, you can store any document
  55. (represented as ``dict``) in TinyDB.
  56. - **optimized for your happiness:** TinyDB is designed to be simple and
  57. fun to use by providing a simple and clean API.
  58. - **written in pure Python:** TinyDB neither needs an external server (as
  59. e.g. `PyMongo <http://api.mongodb.org/python/current/>`_) nor any dependencies
  60. from PyPI.
  61. - **works on Python 2.7 and 3.3 – 3.6 and PyPy:** TinyDB works on all modern
  62. versions of Python and PyPy.
  63. - **powerfully extensible:** You can easily extend TinyDB by writing new
  64. storages or modify the behaviour of storages with Middlewares.
  65. - **100% test coverage:** No explanation needed.
  66. To dive straight into all the details, head over to the `TinyDB docs
  67. <https://tinydb.readthedocs.io/>`_. You can also discuss everything related
  68. to TinyDB like general development, extensions or showcase your TinyDB-based
  69. projects on the `discussion forum <http://forum.m-siemens.de/.>`_.
  70. Supported Python Versions
  71. *************************
  72. TinyDB has been tested with Python 2.7, 3.3 - 3.6 and PyPy.
  73. Example Code
  74. ************
  75. .. code-block:: python
  76. >>> from tinydb import TinyDB, Query
  77. >>> db = TinyDB('/path/to/db.json')
  78. >>> db.insert({'int': 1, 'char': 'a'})
  79. >>> db.insert({'int': 1, 'char': 'b'})
  80. Query Language
  81. ==============
  82. .. code-block:: python
  83. >>> User = Query()
  84. >>> # Search for a field value
  85. >>> db.search(User.name == 'John')
  86. [{'name': 'John', 'age': 22}, {'name': 'John', 'age': 37}]
  87. >>> # Combine two queries with logical and
  88. >>> db.search((User.name == 'John') & (User.age <= 30))
  89. [{'name': 'John', 'age': 22}]
  90. >>> # Combine two queries with logical or
  91. >>> db.search((User.name == 'John') | (User.name == 'Bob'))
  92. [{'name': 'John', 'age': 22}, {'name': 'John', 'age': 37}, {'name': 'Bob', 'age': 42}]
  93. >>> # More possible comparisons: != < > <= >=
  94. >>> # More possible checks: where(...).matches(regex), where(...).test(your_test_func)
  95. Tables
  96. ======
  97. .. code-block:: python
  98. >>> table = db.table('name')
  99. >>> table.insert({'value': True})
  100. >>> table.all()
  101. [{'value': True}]
  102. Using Middlewares
  103. =================
  104. .. code-block:: python
  105. >>> from tinydb.storages import JSONStorage
  106. >>> from tinydb.middlewares import CachingMiddleware
  107. >>> db = TinyDB('/path/to/db.json', storage=CachingMiddleware(JSONStorage))
  108. Contributing
  109. ************
  110. Whether reporting bugs, discussing improvements and new ideas or writing
  111. extensions: Contributions to TinyDB are welcome! Here's how to get started:
  112. 1. Check for open issues or open a fresh issue to start a discussion around
  113. a feature idea or a bug
  114. 2. Fork `the repository <https://github.com/msiemens/tinydb/>`_ on Github,
  115. create a new branch off the `master` branch and start making your changes
  116. (known as `GitHub Flow <https://guides.github.com/introduction/flow/index.html>`_)
  117. 3. Write a test which shows that the bug was fixed or that the feature works
  118. as expected
  119. 4. Send a pull request and bug the maintainer until it gets merged and
  120. published ☺
  121. .. |Build Status| image:: http://img.shields.io/travis/msiemens/tinydb.svg?style=flat-square
  122. :target: https://travis-ci.org/msiemens/tinydb
  123. .. |Coverage| image:: http://img.shields.io/coveralls/msiemens/tinydb.svg?style=flat-square
  124. :target: https://coveralls.io/r/msiemens/tinydb
  125. .. |Version| image:: http://img.shields.io/pypi/v/tinydb.svg?style=flat-square
  126. :target: https://pypi.python.org/pypi/tinydb/
  127. .. _Buzhug: http://buzhug.sourceforge.net/
  128. .. _CodernityDB: http://labs.codernity.com/codernitydb/
  129. .. _MongoDB: http://mongodb.org/