Skip to main content

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

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


Download files

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

Source Distribution

RouteDB-0.0.2.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

RouteDB-0.0.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file RouteDB-0.0.2.tar.gz.

File metadata

  • Download URL: RouteDB-0.0.2.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for RouteDB-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5906381241c7e88f2b913a82b5473ed310ea37c2884d29ad18aab372bc1cc86d
MD5 f25cae93c79d192105f4e0eaed75fc5e
BLAKE2b-256 66657def47b2b19286c1c54f3abf458ec779a52ebf06dc9ce544ef92eaeacacb

See more details on using hashes here.

File details

Details for the file RouteDB-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: RouteDB-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for RouteDB-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f39a4051f185a4f191c6b5bc50d90d32dae91aa0e8ab0790d6b422297117acb8
MD5 33546adcd23dfca972fd24dff735720c
BLAKE2b-256 10d94ceefea390f0e5718919bd0f69e7f95c8e029e80c6f2dd0c58fca5bb3679

See more details on using hashes here.

Supported by

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