Skip to main content

TextDb - RASSD(Read, Add, Save, Search, Delete)

License: MIT Build codecov

This package allows you to create simple text storage by using python.

  • Main functionality is Read, Add, Save, Search, Delete,
  • TextDb can not update existing data !!!⚠️ONLY ADD OR DELETE⚠️!!!. Of course if you would like to update you can use a combination of Add and Delete. TextDb has built-in functionality for this but it does not come out of the package.
  • TextDb was created with the idea of storing large data which is not supposed to be updated.
  • TextDb can be corrupted if a user tries to update change data directly in a text file and makes a mistake during the process.(!!!⚠️Do not try to update large files directly⚠️!!!)

Installation

pip install TextDB-lunfman

API REF

  • Notes if a db file does not exist it will be created automatically.
  • To initialized database just provide a path to the file
from text_db import TextDb
db = TextDb(path)

API methods

db.get_data() - method return a full hash_table of the db class

db.add(row) - method for adding new entries to db

  • takes dictionary as an argument with key and value
  • key will be used as label in formatted data when save db

db.save() - method which saves data to the file.

db.delete_by_index(index) - method for deleting entries from db by using index

db.sort_by(category, is_float_base = False, is_reverse = True)

  • method which sorts db data by using category name as a flag/indicator
  • by default sorted higher first lower last
  • if category do not present in some objects they will be passed
  • return sorted hash-table with required category
  • by default is_float_base = False it means it is sorting content as a string it can be used with pairs of numbers which can be converted from string to the float NB!! if number has ',' inside is_float_base will through an error cause it can not convert to the number. Good - '131.2312' Bad - '12312,122'
  • is_reverse by default is true. if change to false it will sort in opposite way.

db.find_by_index(index) - method allows finding object/row from db by its index

  • return full object/row

db.find_objects(category_name) - method which returns a hash with indexes and categories values

db.get_position(pattern) - method which uses pattern to find first match in db

  • return first found match object index, if not found return 0

db.get_obj_by_pattern(pattern) - method return first object with found pattern as an object {}

db.get_all_cat_values(category) - method return all values of the match category as a list

db.find_objs_where_value_match(category, value) - method which returns a list with objects which matches with required value in category

db.find_all_objs_by_pattern(pattern) - method which returns all rows witch match with pattern. if not found return {}

db.check_if_exists(pattern) - method return boolean True if pattern present otherwise False

db.filter_all_queries(patterns_arr - method return a hash with all results of passed queries -patterns_arr - an array with valid queries

db.get_filtered_object() - this method return TextDb object where data equals to the latest results of filter_all_queries(patterns_arr) method Why does this method exist? After a while I found out that I want to sort the filtered data but to achieve this goal I had to write the same code again somewhere else. Of course, it was a bad solution. So I came up with the idea of this method. This allows me to use all methods from this class if needed.

db.filter_by_almost_equal(category_name, arr_of_values) - this method returns a hash where category values almost equal to the arr_of_values. Nb! use this method if the category has comma separated values. '1,2' or 's,x,m' Basically it checks if values of one array present in the second arr if so add to filtered_object.

Metadata

Release files for TextDB-lunfman 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for TextDB-lunfman 0.0.7
File Size Uploaded Provenance Actions
TextDB-lunfman-0.0.7.tar.gz 7.3 kB Without provenance Details for TextDB-lunfman-0.0.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for TextDB-lunfman 0.0.7
File Interpreter ABI Platform Actions
TextDB_lunfman-0.0.7-py3-none-any.whl Python 3 none any Details for TextDB_lunfman-0.0.7-py3-none-any.whl

Total release size: 15.6 kB

Release files / TextDB-lunfman-0.0.7.tar.gz

Download URL TextDB-lunfman-0.0.7.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b6413e2f263fc9baf403994ee48651249d4e3d3fa9bc5503bcd33865667182e0
BLAKE2b-256 checksum
How to use checksums
09cdde241ee6fdbb9e8e7bc3415ed8b6ee07ef953bb36c77de270be211aa32f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / TextDB_lunfman-0.0.7-py3-none-any.whl

Download URL TextDB_lunfman-0.0.7-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b657e035f13c976cdad7966fb3a5011569cf3cd81c8ce32802afd81eac37adb1
BLAKE2b-256 checksum
How to use checksums
a8360fac62609756252673bb4effcdaf15acd3d64f18832d44809d8c91934c96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Security for TextDB-lunfman 0.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page