{"id":19432806,"url":"https://github.com/truethari/reallysimpledb","last_synced_at":"2025-04-24T20:31:11.789Z","repository":{"id":43479629,"uuid":"437428521","full_name":"truethari/ReallySimpleDB","owner":"truethari","description":"A tool for easily manage databases with Python","archived":false,"fork":false,"pushed_at":"2022-02-28T17:36:16.000Z","size":98,"stargazers_count":16,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-08T12:24:27.613Z","etag":null,"topics":["database","database-connector","database-management","python","python-database","python-database-api","python-sqlite","sqlite"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/reallysimpledb/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/truethari.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-12T01:41:00.000Z","updated_at":"2024-08-20T17:51:15.000Z","dependencies_parsed_at":"2022-08-23T07:50:37.208Z","dependency_job_id":null,"html_url":"https://github.com/truethari/ReallySimpleDB","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truethari%2FReallySimpleDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truethari%2FReallySimpleDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truethari%2FReallySimpleDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truethari%2FReallySimpleDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/truethari","download_url":"https://codeload.github.com/truethari/ReallySimpleDB/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223967295,"owners_count":17233361,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","database-connector","database-management","python","python-database","python-database-api","python-sqlite","sqlite"],"created_at":"2024-11-10T14:37:13.975Z","updated_at":"2024-11-10T14:37:14.699Z","avatar_url":"https://github.com/truethari.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003e\nReallySimpleDB 🧩\n\u003c/h1\u003e\n\n\u003cimg src=\"https://raw.githubusercontent.com/truethari/ReallySimpleDB/master/assets/images/ReallySimpleDB.png\" alt=\"Icon\" width=\"465\"\u003e \u003c/img\u003e\n\n[![tests](https://github.com/truethari/ReallySimpleDB/actions/workflows/tests.yml/badge.svg?branch=alpha)](https://github.com/truethari/ReallySimpleDB/actions/workflows/tests.yml) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/befe3049923e4e788f5a1d6d958f6015)](https://www.codacy.com/gh/truethari/ReallySimpleDB/dashboard?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=truethari/ReallySimpleDB\u0026utm_campaign=Badge_Grade) [![PyPI version](https://img.shields.io/pypi/v/ReallySimpleDB.svg?logo=pypi\u0026logoColor=FFE873)](https://pypi.org/project/ReallySimpleDB/) [![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) [![Downloads](https://pepy.tech/badge/reallysimpledb)](https://pepy.tech/project/reallysimpledb)\n\n## What is This\n\n---\n\nThis is a Python application that can be used to manage **sqlite** databases without using any sql command.\n\n## 🚀 Installation\n\nYou can use pip:\n\n```console\n~$ pip3 install ReallySimpleDB\n```\n\nor\n\n```console\n~$ python setup.py install\n```\n\n## 📗 Usage\n\n```console\n\u003e\u003e from ReallySimpleDB import dbmanager\n\n\u003e\u003e _dbmanager = dbmanager()\n```\n\n### Create database\n\n```console\n\u003e\u003e _dbmanager.create_db(dbpath=\"test.db\", replace=True)\n```\n\n### Close connection\n\n```console\n\u003e\u003e _dbmanager.close_connection()\n```\n\n### Create table\n\nHere 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.\n\n**Important:** You have to close connection here. If not, code returns error. Because it tries to add column to existing table.\n\n```console\n\u003e\u003e _dbmanager.close_connection()\n```\n\n```console\n\u003e\u003e _dbmanager.add_columns(column_name=\"student_id\", primary_key=True)\n\u003e\u003e _dbmanager.add_columns(column_name=\"name\", not_null=True)\n\u003e\u003e _dbmanager.add_columns(column_name=\"mark\", datatype=\"INT\")\n\n\u003e\u003e _dbmanager.create_table(database=\"test.db\", table_name=\"STUDENTS\")\n```\n\nIf you want to add columns to an existing table, read the **Add column to table** section.\n\n### Get all tables\n\n```console\n\u003e\u003e all_tables = _dbmanager.all_tables()\n\n[\"STUDENT\", \"EXAM\"]\n```\n\n### Check table if exists\n\n```console\n\u003e\u003e _dbmanager.is_table(database=\"test.db\", table_name=\"STUDENTS\")\n\nTrue\n```\n\n### Delete table from database\n\n```console\n\u003e\u003e _dbmanager.delete_table(table=\"STUDENTS\")\n```\n\n### Add column to table\n\n```console\n\u003e\u003e _dbmanager.add_columns(column_name=\"year\", database=\"test.db\", table=\"STUDENTS\")\n```\n\n### Get all columns\n\n```console\n\u003e\u003e _dbmanager.get_columns(table=\"STUDENTS\")\n\n[\"student_id\", \"name\", \"mark\"]\n```\n\n### Get all columns with types\n\n```console\n\u003e\u003e all_columns = _dbmanager.get_all_column_types(table=\"STUDENTS\")\n\n{\"student_id\": \"TEXT\", \"name\": \"TEXT\", \"mark\": \"INT\"}\n```\n\n### Get columns type\n\n```console\n\u003e\u003e _dbmanager.get_column_type(table=\"STUDENTS\", column=\"student_id\")\n\n\"TEXT\"\n```\n\n### Get primary key of a table\n\n```console\n\u003e\u003e _dbmanager.get_primary_key(table=\"STUDENTS\")\n\n\"student_id\"\n```\n\n### Add record to table\n\n```console\n\u003e\u003e _dbmanager.add_record(table=\"STUDENTS\", record={\"student_id\": \"1010\", \"name\":\"ABC\", \"mark\":10, \"year\":\"2022\"})\n```\n\n### Get all records from a table\n\n```console\n\u003e\u003e _dbmanager.get_all_records(table=\"STUDENTS\", primary_key=\"1010\")\n\n[{'student_id': '1010', 'name': 'ABC', 'mark': 10, 'year': '2022'}, {'student_id': '1011', 'name': 'DEF', 'mark': 100, 'year': '2022'}]\n```\n\n### Get record from a table\n\n```console\n\u003e\u003e _dbmanager.get_record(table=\"STUDENTS\", primary_key=\"1010\")\n\n{'student_id': '1010', 'name': 'ABC', 'mark': 10, 'year': '2022'}\n```\n\n### Delete record from a table\n\n```console\n\u003e\u003e _dbmanager.delete_record(table=\"STUDENTS\", primary_key=\"1010\")\n```\n\n### Filter record/s from a table\n\nIf you want to filter **equal values**, add value without any operator.\n\nExamples:\n\n- `{\"year\":2022}` ✔️\n- `{\"year\":\" == 2022\"}` ❌\n\n🖇 Comparison operators\n\n| Comparison Operator |      Description      |\n| :-----------------: | :-------------------: |\n|         !=          |       Not Equal       |\n|          \u003e          |     Greater Than      |\n|         \u003e=          | Greater Than or Equal |\n|          \u003c          |       Less Than       |\n|         \u003c=          |  Less Than or Equal   |\n\nExamples:\n\n- `{\"marks\":\"\u003c= 10\"}` ✔️\n- `{\"marks\":\"== 10\"}` ❌\n- `{\"name\":\"\u003c ABC\"}` ❌ 'Greater Than' and 'Less than' comparisons are not supported with Strings\n\n**Important:** If you are trying to compare strings, please use string between Inch Marks.\n\n- `{\"grade\":\"!= 'A'\"}` ✔️\n- `{\"grade\":\"!= A\"}` ❌\n\n```console\n\u003e\u003e _dbmanager.filter_records(table=\"STUDENTS\", values={\"year\":\"2022\"})\n\n[{'student_id': '1010', 'name': 'ABC', 'mark': 10, 'year': '2022'}, {'student_id': '1011', 'name': 'DEF', 'mark': 100, 'year': '2022'}]\n```\n\n---\n\n## 🌱 Contributing Guide\n\n- Fork the project from the `alpha` branch and submit a Pull Request (PR)\n\n  - Explain what the PR fixes or improves.\n\n  - If your PR aims to add a new feature, provide test functions as well.\n\n- Use sensible commit messages\n\n  - If your PR fixes a separate issue number, include it in the commit message.\n\n- Use a sensible number of commit messages as well\n\n  - e.g. Your PR should not have 1000s of commits.\n\n### Run pytest without installing package\n\nIf you are adding **new functions** as described above, please add test functions to `tests/test_manager.py`.\n\n```console\n~$ python -m pytest -s tests\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruethari%2Freallysimpledb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftruethari%2Freallysimpledb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruethari%2Freallysimpledb/lists"}