A package which helps you manage local databases
Project description
RouteDB
RouteDB is a package built for managing databases locally. Its path hierarchy is simple and easy to use
To install run:
pip install RouteDB
How to use
If you're not sure, check out this neat demonstration to learn the basics.
Creating a Database
To create a Database, you'll need to provide 2 parameters: path and types to the Database() constructor.
Types is necessary to manage the data that flows into a route and makes sure that the type stays consistent.
Make it into a dictionary which looks something like this:
types = {
"string": str
}
Put the key as the name you want to use to refer to the type, and then as the value put the type, so something like str, or float. Do not try to convert it to anything, just put it into the dictionary.
Adding a route
Adding a route is simple, you pass the name and the type (the name of a type that you put earlier) to the addRoute() method. Don't worry about whether the route's path exists or not, as we make it for you.
Example:
db.addRoute("my awesome route", "string")
Writting data to a route
Finally, we'll write some data to the route, it's simple as long as you make the type of the data match the type of the route. Pass the data, the route, and the name of the data
Example:
db.write(f"hello world! from {datetime.datetime.now().strftime("%d/%m/%Y, %H:%M:%S")} :D", "my awesome route", f"user1")
Demos
Here we have a simple demo which demonstrates how you can add a route (which makes a new folder if it exists), and how you can write data to one:
import RouteDB
import datetime
import os
types = {
"string": str
}
db = RouteDB.Database("db", types)
route = "my amazing route aaaaaaaaaaaaaa"
print(db.addRoute(route, "string"))
thisIdx = len(os.listdir(db.routeDir(route))) + 1
db.write(f"hello world! from {datetime.datetime.now().strftime("%d/%m/%Y, %H:%M:%S")} :D", route, f"user{thisIdx}")
print(db.getData(route, f"user{thisIdx}"))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file RouteDB-0.0.3.tar.gz.
File metadata
- Download URL: RouteDB-0.0.3.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37ee0ff772e40ed8689d16f9171f96d67076c67dcfe26393c6218387be89bfe5
|
|
| MD5 |
9b2a0ab0eef7657e6704579c7f833c60
|
|
| BLAKE2b-256 |
f9c2f1c228477745f6a12696d13207634cad53814bcea974b4b8342d9c9d6db6
|
File details
Details for the file RouteDB-0.0.3-py3-none-any.whl.
File metadata
- Download URL: RouteDB-0.0.3-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e8e90dd71ae19e85e430ac425e4eb6febba9e880ee22204326dce55ebcc5a02
|
|
| MD5 |
5f26b8d303d7e83841e9375483d12a37
|
|
| BLAKE2b-256 |
2d37bad306c08ceb3cf3f461c4b7b87a4c742217ddbd78f8c3dc95f8a4e71377
|