Skip to main content

A simple db package

Project description

Pydeas

Pydeas is a Python library for dealing in an efficent way with information storage.

Installation

Use the package manager pip to install Pydeas

pip install pydeas

Get Started

This library is based on pandas and memorize the information in csv files, the database is relational but you can work with multiple folders and files, in this way you can create a dynamic and comprehensible db structure.

from pydeas import PydeasDB



def db() -> None:

    main_folder = PydeasDB.Folder('Database') # create the main folder in the current folder

    password_file = main_folder.create_file('passwords') # create a 'passwords' file in the main folder

    password_file.add_columns(['App', 'Email', 'Username', 'Password']) # add the column to the table of the file

Now we created a "passwords.csv" in the database folder, and configured the file adding columns; we can now start working with Pydeas

Output in ./Database/passwords.csv

#,App,Email,Username,Password

Add an element to the table

password_file.add_row(['Github', 'myemail@io.com', 'Foo', 'Bar']) # add a row to the table of the file

Output in ./Database/passwords.csv

#,App,Email,Username,Password

1,Github,myemail@io.com,Foo,Bar

As you can see this library is pretty easy to use and all the methods name are auto-explicative, but you can navigate further in this documentation

Query

A pydeas database can be queryied in 2 different ways:

one resembles the way of doing things in relational databases

(we recommend using this when queryies are more complex)

def get_config(app_name, email):

    print(password_file.query(f'App == "{app_name}" & Email == "{email}"'))

        

# This function will print the list of objects or None (if nothing is found)

for reference you can check the query method of pandas library which also takes a string and works in the exact same way;

While the other one resembles the non-relational databases (such as MongoDb etc.)

def get_config(app_name, email):

    print(password_file.search({

        "App": app_name,

        'Email': email

    }))

# This function will print the list of objects or None (if nothing is found)

Update

The update function takes 2 arguments: the first one is the query string, the second one the new row

def update_by_appname(app_name, new_email, new_username, new_password) -> None:

    response = password_file.update(f'App == "{app_name}"', {

        'App': app_name,

        'Email': new_email,

        'Username': new_username,

        'Password': new_password

    })

    print(response)

# This function will print true if the operation is completed succesfully

Delete

The delete function the query string as argument

def delete_by_appname(app_name) -> None:

    response = password_file.delete(f'App == "{app_name}"')

    print(response)

# This function will print true if the operation is completed succesfully

Pydeas v1.0.2

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

pydeas-1.0.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

pydeas-1.0.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file pydeas-1.0.2.tar.gz.

File metadata

  • Download URL: pydeas-1.0.2.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for pydeas-1.0.2.tar.gz
Algorithm Hash digest
SHA256 a4be466e999a55c7de475cd60b62a8fea80f768a07ab824f57ed3971d3fb74ae
MD5 1d7910a28a466f761606e5bb0990d492
BLAKE2b-256 be4b8f0c0ac9f571c8a1925d7a4d07b95a8feba9d90dba2aa83e99c4298dd5a3

See more details on using hashes here.

File details

Details for the file pydeas-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: pydeas-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for pydeas-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6de7fea7533f5bdfe4e60145a575cb961ee9523d855e72da37ed25f44ca71bef
MD5 5a18d299f5e91fdcd1ce40dc081024ca
BLAKE2b-256 407137e8b46f379c05f4136d83ff22c19568d938c86d9aef6aa66c4be82c81d5

See more details on using hashes here.

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