ReallySimpleDB 🧩
What is This
This is a Python application that can be used to manage sqlite databases without using any sql command.
🚀 Installation
You can use pip:
~$ pip3 install ReallySimpleDB
or
~$ python setup.py install
📗 Usage
>> from ReallySimpleDB import dbmanager
>> _dbmanager = dbmanager()
Create database
>> _dbmanager.create_db(dbpath="test.db", replace=True)
Close connection
>> _dbmanager.close_connection()
Create table
Here you can not directly call the create_table function. Because sqlite cannot create table without columns. So you must first define the columns and create a table.
Important: You have to close connection here. If not, code returns error. Because it tries to add column to existing table.
>> _dbmanager.close_connection()
>> _dbmanager.add_columns(column_name="student_id", primary_key=True)
>> _dbmanager.add_columns(column_name="name", not_null=True)
>> _dbmanager.add_columns(column_name="mark", datatype="INT")
>> _dbmanager.create_table(database="test.db", table_name="STUDENTS")
If you want to add columns to an existing table, read the Add column to table section.
Get all tables
>> all_tables = _dbmanager.all_tables()
["STUDENT", "EXAM"]
Check table if exists
>> _dbmanager.is_table(database="test.db", table_name="STUDENTS")
True
Delete table from database
>> _dbmanager.delete_table(table="STUDENTS")
Add column to table
>> _dbmanager.add_columns(column_name="year", database="test.db", table="STUDENTS")
Get all columns
>> _dbmanager.get_columns(table="STUDENTS")
["student_id", "name", "mark"]
Get all columns with types
>> all_columns = _dbmanager.get_all_column_types(table="STUDENTS")
{"student_id": "TEXT", "name": "TEXT", "mark": "INT"}
Get columns type
>> _dbmanager.get_column_type(table="STUDENTS", column="student_id")
"TEXT"
Get primary key of a table
>> _dbmanager.get_primary_key(table="STUDENTS")
"student_id"
Add record to table
>> _dbmanager.add_record(table="STUDENTS", record={"student_id": "1010", "name":"ABC", "mark":10, "year":"2022"})
Get all records from a table
>> _dbmanager.get_all_records(table="STUDENTS", primary_key="1010")
[{'student_id': '1010', 'name': 'ABC', 'mark': 10, 'year': '2022'}, {'student_id': '1011', 'name': 'DEF', 'mark': 100, 'year': '2022'}]
Get record from a table
>> _dbmanager.get_record(table="STUDENTS", primary_key="1010")
{'student_id': '1010', 'name': 'ABC', 'mark': 10, 'year': '2022'}
Delete record from a table
>> _dbmanager.delete_record(table="STUDENTS", primary_key="1010")
Filter record/s from a table
If you want to filter equal values, add value without any operator.
Examples:
{"year":2022}✔️{"year":" == 2022"}❌
🖇 Comparison operators
| Comparison Operator | Description |
|---|---|
| != | Not Equal |
| > | Greater Than |
| >= | Greater Than or Equal |
| < | Less Than |
| <= | Less Than or Equal |
Examples:
{"marks":"<= 10"}✔️{"marks":"== 10"}❌{"name":"< ABC"}❌ 'Greater Than' and 'Less than' comparisons are not supported with Strings
Important: If you are trying to compare strings, please use string between Inch Marks.
{"grade":"!= 'A'"}✔️{"grade":"!= A"}❌
>> _dbmanager.filter_records(table="STUDENTS", values={"year":"2022"})
[{'student_id': '1010', 'name': 'ABC', 'mark': 10, 'year': '2022'}, {'student_id': '1011', 'name': 'DEF', 'mark': 100, 'year': '2022'}]
🌱 Contributing Guide
-
Fork the project from the
alphabranch and submit a Pull Request (PR)-
Explain what the PR fixes or improves.
-
If your PR aims to add a new feature, provide test functions as well.
-
-
Use sensible commit messages
- If your PR fixes a separate issue number, include it in the commit message.
-
Use a sensible number of commit messages as well
- e.g. Your PR should not have 1000s of commits.
Run pytest without installing package
If you are adding new functions as described above, please add test functions to tests/test_manager.py.
~$ python -m pytest -s tests
Metadata
Release files for ReallySimpleDB 1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ReallySimpleDB-1.2.tar.gz | 8.5 kB | Without provenance | Details for ReallySimpleDB-1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ReallySimpleDB-1.2-py3-none-any.whl | Python 3 | none | any | Details for ReallySimpleDB-1.2-py3-none-any.whl |
Total release size: 15.6 kB
Release files / ReallySimpleDB-1.2.tar.gz
| Download URL | ReallySimpleDB-1.2.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8d70da45af7618511aee03989833e7327bbec984c7567f6633e2d74111d5b5a1
|
|
BLAKE2b-256 checksum How to use checksums |
ad6efb568a347ecb2f16537eef758ab0618f290a168d98f9c9eb735cf12c501e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
|
Release files / ReallySimpleDB-1.2-py3-none-any.whl
| Download URL | ReallySimpleDB-1.2-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7cb9b832575ac127f42474fd8d27391bdbd580a0ea209e86240bc65392f0caab
|
|
BLAKE2b-256 checksum How to use checksums |
331e2a39e49c4bab2fab6784601607f369df5de094ac7ab800c5642ed59f4b20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
|
Security for ReallySimpleDB 1.2
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.