__init__.py 899 B

12345678910111213141516171819202122232425262728293031
  1. """
  2. TinyDB is a tiny, document oriented database optimized for your happiness :)
  3. TinyDB stores differrent types of python data types using a configurable
  4. backend. It has support for handy querying and tables.
  5. .. codeauthor:: Markus Siemens <markus@m-siemens.de>
  6. Usage example:
  7. >>> from tinydb. import TinyDB, where
  8. >>> from tinydb.storages import MemoryStorage
  9. >>> db = TinyDB(storage=MemoryStorage)
  10. >>> db.insert({'data': 5}) # Insert into '_default' table
  11. >>> db.search(where('data') == 5)
  12. [{'data': 5, '_id': 1}]
  13. >>> # Now let's create a new table
  14. >>> tbl = db.table('our_table')
  15. >>> for i in range(10):
  16. ... tbl.insert({'data': i})
  17. ...
  18. >>> len(tbl.search(where('data') < 5))
  19. 5
  20. """
  21. from .queries import Query, where
  22. from .storages import Storage, JSONStorage
  23. from .database import TinyDB
  24. from .version import __version__
  25. __all__ = ('TinyDB', 'Storage', 'JSONStorage', 'Query', 'where')