Skip to main content

No project description provided

Project description

All rights are reserved to Name.

data

get a data
check if a data exist

get (select)

parameters : valueName(str), Category(optional(str))
if value is None value will return None

import namedb
print(f'Price : {namedb.get("price")}')

error handling
exemple :

import namedb
try:
  namedb.get('a world without taxes')
except namedb.ValueNotExist:
  print('Damn it')

Mutli-tasking select more then one thing using || to separate them
return a list of all of the arugments instanid of just the argument
exemple :

import namedb
thing = namedb.get('a life|| a world without taxes')
print(thing[0])
print(thing[1])

search (exist)

parameters : valueName(str), Category(optional(str))
if value exist it will return True (bool)
else False

import namedb
var = namedb.search('price')
if var:
  print('Give me your money!')

mutli-tasking separate differents ellement with ||
return True is all the values exist else it return False

import namedb
var = namedb.search('price||due')
if var:
  print('Give me your money!')

edit-data

add (aadd)

parameters : ValueName(str), Value(Any), Category(optional(str))
if worked it will return True else False

import namedb
namedb.add('price', 90)

error handling
exemple :

import namedb
try:
  namedb.add('taxes', 0.19)
except namedb.ValueAlreadyExist:
  print('Damn it')

edit (replace)

Big updates with edit

edit-value

parameters : valuename(str), value(any)

import namedb
namedb.edit('taxes', 'does not exist')

add to a number

parameters : valuename(str), add(int)

import namedb
namedb.edit('tomatostock', add=3)

minus to a number

parameters : valuename(str), minus(int)

import namedb
namedb.edit('tomatostock', minus=5)

append to a list

parameters : valuename(str), append(any)

import namedb
namedb.edit('product', append='tomato')

remove to a list

parameters : valuename(str), remove(any)

import namedb
namedb.edit('product', remove='tomato')

remove (delete)

parameters : ValueName(str), cache(optional(bool)), Category(optional(str))
if worked it will return True else False
stock the value in the cache if cache is true (false by default)

import namedb
namedb.remove('price')

error handling
exemple :

import namedb
try:
  namedb.remove('a world without taxes')
except namedb.ValueNotExist:
  print('Damn it')

mutli-tasking separate the values that you want to delete with ||

import namedb
namedb.remove('price||due')

json

just transfer json for now

transferjson (atransferjson)

parameters : Data(json), Category(optional(str))
if worked it will return True else False

import namedb
jsoncode = {
'price': 90,
'due': 60
}
namedb.transferjson(jsoncode)
print(f'{namedb.get("price")}')

prefix

find or edit data with a prefix

prefix (aprefix)

parameters : type(value or name), prefix(str), Category(optional(str))
return a list with all the files that starts with the prefix

import namedb
for costumer in namedb.prefix(type='value', 'costumersdue'):
  print(f'Due : {costumer}')

error handling
exemple :

import namedb
try:
  namedb.prefix('hi', 'taxes')
except ValueError:
  print('Damn it')

clearprefix (cleanprefix)

parameters : prefix(str), Category(optional(str))
delete all the values that starts with the prefix

import namedb
namedb.clearprefix('due')

cache

Restore data or remove data with a prefix or without

restore (arestore)

parameters : valuename(str), Category(optional(str))
restore a value from the cache (and return it)

import namedb
namedb.remove('taxes')
print('too good to be real')
namedb.restore('taxes')

error handling
exemple :

import namedb
try:
  namedb.restore('a world without taxes')
except namedb.ValueNotExist:
  print('Damn it')

clearcache (cleancache)

parameters : None clear the cache

import namedb
namedb.remove('money')
namedb.clearcache()

clearcacheprefix (cleancacheprefix)

parameters : prefix(str), Category(optional(str)) clear the cache with a prefix

import namedb
namedb.remove('exemple2286')
namedb.clearcacheprefix('exemple')

category

create a category or remove it
We highly recommend using category

createcat (acreatecat)

Parameters : categoryname(str)
Create a category

import namedb
namedb.createcat('example')

deletecat (adeletecat)

Parameters : categoryname(str)
Delete a category

import namedb
namedb.deletecat('example')

listcat (alistcat)

parameters : catname(str), type(str ["name", "value"])
list all values or name

import namedb
for value in namedb.listcat('stock', 'name'):
  print(value)

async

everything work the same just change the name of the fonction example :

import namedb
async def get_money(user_id: str):
  value = await namedb.select(f'money{user_id}')
  return value

setup

install setup.py and run it (answers the questions)

Directory path (example : C:/windows/desktop/my/project/) : C:/windows/Users/Me/Pycharm/project/

migrating from version 1.6

multi-tasking now exist
example:

import namedb
namedb.remove('taxes||bad things')

recommandation

Please use try: and except: if you run a constant code because this errors can make your code stop
We higly recommend using category



We aren't responsible for data lost.

bonus

This is one of the last versions of this database because I havte no ideas of what to do now except optimisation so don't expect big changes for the next versions it's probably be like backend optimisations
I will check to publish this as python package btw

Project details


Release history Release notifications | RSS feed

This version

1.7

Download files

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

Source Distribution

namedb-1.7.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

namedb-1.7-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

Supported by

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