An Interest In:
Web News this Week
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
- March 15, 2024
- March 14, 2024
- March 13, 2024
July 19, 2021 09:37 am GMT
Original Link: https://dev.to/adwaithrajesh/onstro-db-a-fast-db-5bn8
Onstro-DB a fast DB
Installation
pip install onstro-db
Let's see how fast it is.
In this example, we can make a DB with 4 columns and in which 2 columns have a default value. Which are added during Runtime.
We will be adding 10,000 values to the DB and check how fast it is.
The test code
from onstrodb import OnstroDbimport timetest_schema = { "name": {"type": "str", "required": True}, "age": {"type": "int", "required": True}, "place": {"type": "str", "default": "canada"}, "alive": {"type": "bool", "default": True}}db = OnstroDb(db_name="test", in_memory=True, schema=test_schema)# generate the data to insertdata = []for i in range(10_000): print(i, end="\r", flush=True) d = {"name": f"ad{i}", "age": i} data.append(d)# insert the data into the DBstart = time.time()db.add(data)stop = time.time()print("Elapsed Time: ", stop - start)
Here we first create all the data we want to insert and we time the insertion process.
Here are the results.
Elapsed Time: 1.077016830444336
Onstro-Db supports full CRUD operation, comes with a simple CLI, has a strict schema, and also prevents data duplication by default.
As you can see this thing is fast. To know more visit the Github repo here.
Star and follow the repo for future updates.
Original Link: https://dev.to/adwaithrajesh/onstro-db-a-fast-db-5bn8
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To