Skip to main content

A simple database system

Project description

#sunlite

Sunlite Simple Database System

simple, fast, local, userfriendly

what is sunlite ?

Ans: Sunlite is a module for simple data management.

  • How to use
    • Connect to memory.
    • connect to a database.
    • Create a new header . >> * add data , or pull data
      • enjoy ^~^

Connecting

Sunlite lets you connect as you want.

from sunlite.db import connect

db = connect() #for memory
db = connect("my_db") #for connecting with "my_db" , it will be auto generated if doesnt exists.
db = connect("my_db",logs=False)  # for connecting to "my_db" but say no to logs

Generating new header

headers are like boxes which contains your datas , don't forget to make one before pushing or pulling data

db = connect("my_db")

db.new("websites")  #here , we made a header named websites.

Pushing data to headers

by pushing , we add data in headers to contain . you can push any data .

db = connect("my_db")

db.new("websites")

name = "google"
data = "http://google.com"

db.push(name,data) #here , we are pushing http://google.com with the name google in websites header

Pullling data from headers

you can pull all data of header or an invidual data

db = connect("my_db",logs=False)

db.new("websites")

name = "google"
data = "http://google.com"

db.push(name,data)

a = db.pull("websites")  #it will pull all data in website header as a dictionary.

a = db.pull("google")  #it will only pull the data of google no matter where it is in which header .

don't use same names for two datas as it will remove 2nd one .

Get a header as you want. This time duplicate names are accepted.

unlike pull function , this function doesn't update duplicate datas as sends as they are .

this is useful in maintaining a large set of same data.

example

db.connect("students",logs=False)

db.new("Allan")

db.push("maths",50)
db.push("english",70)
db.push("science",40)


#now for akmal
db.new("Akmal")

db.push("maths",45)
db.push("english",60)
db.push("science",70)

db.get("Akmal")  #for getting akmal marks
db.get("allan") #for getting allan's marks

Beauty print .

You can beauty print all data's in all headers .

db = connect("my_db",logs=False)

db.new("websites")

name = "google"
data = "http://google.com"

db.push(name,data)

db.beauty()  #this prints all data nicely

Get all headers

db = connect("my_db",logs=False)

db.headers()

Example with a user info system with sunlite

db = connect("my_db",logs=False)

db.new("users")

name = "Axel"
data = ["age":13 , "nation": "USA"]

db.push(name,data)

name = "Jack"
data = ["age":15, "nation": "England"]
db.push(name,data)

db.beauty()

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

sunlite-0.2.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

sunlite-0.2.0-py2.py3-none-any.whl (3.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sunlite-0.2.0.tar.gz.

File metadata

  • Download URL: sunlite-0.2.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.6

File hashes

Hashes for sunlite-0.2.0.tar.gz
Algorithm Hash digest
SHA256 bb68d62ad6debc30f45532944a3b23b667e0f47b1aa9cdafe45c8288169426cd
MD5 b895bee6f7227551c7da47eec6f7fdf4
BLAKE2b-256 71d4af66a38e2ab9e348d9e5be7a03932423e84727346243401126af2dc6ff59

See more details on using hashes here.

File details

Details for the file sunlite-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: sunlite-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.6

File hashes

Hashes for sunlite-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8a760900ebda7b533ac7b1084b8ec3df73b03ac1c698a1ffdc37d5f1487e526c
MD5 b570e1d11adb4410b4bb0c597249d348
BLAKE2b-256 f74569e50657ddb7513900af3d8c8f0402d0a80e990eb9af86969823428e28b3

See more details on using hashes here.

Supported by

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