Skip to main content

TashoDB

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 tasho.Database.new or tasho.Database.open.

>>> import tasho
>>> database = tasho.Database.new("AnimeDatabase")  # Creates a new database.
>>> database = tasho.Database.open("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})
'Shows-d545998bc3485346'

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.

Retrieval

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.save()
'Shows-d545998bc3485346'
>>> 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()
True
>>> 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: test.py for more use cases.

Release files for tasho 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tasho 0.0.3
File Size Uploaded
tasho-0.0.3.tar.gz 8.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tasho 0.0.3
File Interpreter ABI Platform
tasho-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 19.4 kB

Release files / tasho-0.0.3.tar.gz

Download URL tasho-0.0.3.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
372cc718ff108cb57fb7f362635ddae9f9e5f7e39f2ee290fb19d0a803c717b8
BLAKE2b-256 checksum
How to use checksums
987ad17f6566661c0874a5d413f3ca8da39e6f88d160b1968ef4e65f4853bb14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / tasho-0.0.3-py3-none-any.whl

Download URL tasho-0.0.3-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c49611148cf0892fbe7ae3fc8ddfb2fba69a7f9add90a1a09e21382d3ff09df6
BLAKE2b-256 checksum
How to use checksums
f544b50ec09998d2b3cf71c90b6dc8dda4a3b1f4f83d6c121eb21943099d19e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page