Skip to main content

A performant and lightweight NOSQL Database

Project description


A fast and portable python NoSQL database. Sucessor to KoDB.

Using the DB

To initalize or open a database, it's as straightforward as calling or

>>> import tasho
>>> database ="AnimeDatabase")  # Creates a new database.
>>> database ="AnimeDatabase") # Opens a database.

Tables can be called through tasho.Database.get_table(table_name) or through tasho.Database.table.table_name

>>> tbl_anime = database.table.Anime 			# These all return 
>>> tbl_anime = database.get_table("Anime")		# the same Table
>>> tbl_anime = database.table['Anime']			# object.
>>> tbl_anime
<TashoDBTable>: Anime | Chunks: 1

Note: Tables are set to auto commit by default. When doing bulk inserts, make sure to set Table.auto_commit to False and running Table.commit() manually afterwards.

Data Storage

>>> tbl_anime.insert('001', {'title': 'Nichijou', 'episodes': 24, 'rating': 99})

This stores the data with 001 as the Document ID. Document IDs can either be String or Int. Since Table.auto_commit has been set to true, running Table.commit() is no longer needed.


There are multiple ways of accessing data.

# The document can be accessed through a regular get method
>>> show = tbl_shows.get('001')
>>> show
<TashoDBDocument:001> Origin: Shows
>>> show.dict
{'title': 'Nichijou', 'episodes': 24, 'rating': 99, '_id': '001'}
# Table.query allows you to pass a callable to filter the data.
>>> tbl_shows.query(lambda id, data: data['rating'] > 50)
[<TashoDBDocument:001> Origin: Shows]
# Table.query_one works the same as Table.query but stops at the first match.
>>> tbl_shows.query_one(lambda id, data: data['rating'] > 50)
<TashoDBDocument:001> Origin: Shows

Table.get(id) returns a Document object that contains the data.

Manipulating Data

Manipulating data is as easy as changing the values in the Document object.

>>> show
<TashoDBDocument:001> Origin: Shows
>>> show.dict
{'title': 'Nichijou', 'episodes': 24, 'rating': 99, '_id': '001'}
>>> show.rating = 98
>>> show['title'] = 'Nichibros'
>>> show.dict
{'title': 'Nichibros', 'episodes': 24, 'rating': 98, '_id': '001'}

Document deletion can also be done with Document.delete().

>>> list(tbl_shows.items())
[('001', {'title': 'Nichijou', 'episodes': 24, 'rating': 98})]
>>> show.delete()
>>> list(tbl_shows.items())

Note: Document objects behaves almost the same way as dictionaries. Document.pop, Document.update and Document.get works the same way.

See: for more use cases.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tasho-0.0.3.tar.gz (8.7 kB view hashes)

Uploaded source

Built Distribution

tasho-0.0.3-py3-none-any.whl (10.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page