{"id":15111566,"url":"https://github.com/sunshine-database/sunshine","last_synced_at":"2026-02-04T14:07:19.494Z","repository":{"id":171322249,"uuid":"633022448","full_name":"Sunshine-Database/Sunshine","owner":"Sunshine-Database","description":"Lightweight json-database library for Python","archived":false,"fork":false,"pushed_at":"2023-10-15T20:22:47.000Z","size":163,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-12T06:47:06.700Z","etag":null,"topics":["database","db","json","json-database","python","python3","sunshine"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/SunshineDB/","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/Sunshine-Database.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-26T16:00:14.000Z","updated_at":"2024-09-21T14:23:34.000Z","dependencies_parsed_at":"2024-09-26T00:21:28.920Z","dependency_job_id":null,"html_url":"https://github.com/Sunshine-Database/Sunshine","commit_stats":null,"previous_names":["sunshine-database/sunshine"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sunshine-Database%2FSunshine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sunshine-Database%2FSunshine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sunshine-Database%2FSunshine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sunshine-Database%2FSunshine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sunshine-Database","download_url":"https://codeload.github.com/Sunshine-Database/Sunshine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378091,"owners_count":20929293,"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","db","json","json-database","python","python3","sunshine"],"created_at":"2024-09-26T00:21:19.197Z","updated_at":"2026-02-04T14:07:19.423Z","avatar_url":"https://github.com/Sunshine-Database.png","language":"Python","readme":"# Sunshine\n\n![Sunshine Logo](./sources/sunshine.png)\n\n\u003ch2\u003eLightweight json-database library for Python\u003c/h2\u003e\n\n\u003cbr\u003e\n\n## Installing database library\n```bash\npip install SunshineDB\n```\n\n## Class\n\u003ch3\u003eSunshine - database management class. \u003c/h3\u003e\n\n\u003ch3\u003eHas the following set of methods: \u003c/h3\u003e\n\n```Python\n0. push()\n1. all()\n2. get()\n3. update()\n4. contains()\n5. delete()\n6. drop()\n7. backup()\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## Creating database\nYou just need to create an instance of the Sunshine-class, passing the path to the json-file as an argument.\n\nFor example,\n```Python\nfrom SunshineDB import Sunshine\n\ndatabase: Sunshine = Sunshine('../databases/database.json')\n```\n\n\u003cbr\u003e\n\n## Methods\n\u003ch3\u003eMethod examples will be given using the database variable we set. \u003c/h3\u003e\n\n## Quick Methods\n* ### [0. Sunshine.push](https://github.com/Sunshine-Database/Sunshine#push)\n* ### [1. Sunshine.all](https://github.com/Sunshine-Database/Sunshine#all)\n* ### [2. Sunshine.get](https://github.com/Sunshine-Database/Sunshine#get)\n* ### [3. Sunshine.update](https://github.com/Sunshine-Database/Sunshine#update)\n* ### [4. Sunshine.contains](https://github.com/Sunshine-Database/Sunshine#contains)\n* ### [5. Sunshine.delete](https://github.com/Sunshine-Database/Sunshine#delete)\n* ### [6. Sunshine.drop](https://github.com/Sunshine-Database/Sunshine#drop)\n* ### [7. Sunshine.backup](https://github.com/Sunshine-Database/Sunshine#backup)\n\n### push()\nAdds an object with the given fields to the database. \u003cbr\u003e\nRequires one argument:\n* data_to_push (__dictionary[string, any]__) - the key-value dictionary to be added to the database.\n\nReturns ID.\n\u003cbr\u003e\n\n```Python\nidentifier: int = database.push(\n    {\n        'name'       : 'Bertram Gilfoyle',\n        'job'        : 'Pied Piper Inc.',\n        'occupation' : 'Vice President Of Architecture'\n    }\n)\n\nprint(identifier) \n# output \u003e\u003e 22104564398807 \n#           ^^^^^^^^^^^^^^\n# ID is 14-digit integer\n```\n\n### all()\nReturns all database objects. \u003cbr\u003e\n\u003cbr\u003e\n\n```Python\ndata: list[dict[str, any]] = database.all()\n\nprint(data)\n# output \u003e\u003e \n# [\n#   {\n#       'id': 22104564398807, \n#       'name': 'Bertram Gilfoyle', \n#       'job': 'Pied Piper Inc.', \n#       'occupation': 'Vice President Of Architecture'\n#   }\n# ]\n```\n\n### get()\nReturns a database object using a query, or returns the number of given elements in the first one up to the number specified in the __count__ argument. \u003cbr\u003e\nRequires two arguments:\n* query (__dictionary[string, any]__) - a key-value dictionary that will be used to select elements,\n* count (__integer__)                 - the number of requested elements.\n\nYou cannot use both arguments together.\n\u003cbr\u003e\n\n```Python\ndata: list[dict[str, any]] = database.get(\n    query = {\n        'job' : 'Pied Piper Inc.'\n    }\n)\n\nprint(data)\n# output \u003e\u003e \n# [\n#   {\n#       'id': 22104564398807, \n#       'name': 'Bertram Gilfoyle', \n#       'job': 'Pied Piper Inc.', \n#       'occupation': 'Vice President Of Architecture'\n#   }\n# ]\n\n# And the same will be displayed if you call the get-method like this\ndata: list[dict[str, any]] = database.get(count = 1)\n```\n\n### update()\nUpdates a database object with an __ID__. \u003cbr\u003e\nRequires two arguments:\n* id             (__14-digit integer__)        - numeric identifier,\n* data_to_update (__dictionary[string, any]__) - the key-value dictionary that will be updated in the database object.\n\n\u003cbr\u003e\n\n```Python\ndatabase.update(\n    22104564398807, \n    {\n        'occupation' : 'Network engineer'\n    }\n)\n# changed to \u003e\u003e \n# [\n#   {\n#       'id': 22104564398807, \n#       'name': 'Bertram Gilfoyle', \n#       'job': 'Pied Piper Inc.', \n#       'occupation': 'Network engineer'\n#   }\n# ]\n```\n\n### contains()\nChecks by query, if an element is contained in the database. \u003cbr\u003e\nRequires two arguments:\n* key   (__string__),\n* value (__any__).\n\nThese arguments will be searched in the database.\n    \nReturns boolean.\n\u003cbr\u003e\n\n```Python\ndata: bool = database.contains('name', 'Bertram Gilfoyle')\nprint(data)\n# output \u003e\u003e True\n#           ^^^^\n# contains-method returns boolean\n\ndata: bool = database.contains('name', 'Dinesh Chugtai')\nprint(data)\n# output \u003e\u003e False\n```\n\n### delete()\nRemoves the object with the given __ID__ from the database. \u003cbr\u003e\nRequires one argument:\n* id (__14-digit integer__) - numeric identifier,\n\n\u003cbr\u003e\n\n```Python\ndatabase.delete(22104564398807)\n\n# database-file \u003e\u003e\n# {\n#   \"data\": []\n# }\n```\n\n### drop()\nRemoves all objects from the database. \n\n\u003cbr\u003e\n\n```Python\ndatabase.drop()\n\n# database-file \u003e\u003e\n# {\n#   \"data\": []\n# }\n```\n\n### backup()\nCreates a database backup at the given __path__. \u003cbr\u003e\nRequires one argument:\n* path (__string__) - path to the folder where the backup-file will be saved.\n\n\u003cbr\u003e\n\n```Python\ndatabase.backup('../databases/backups/')\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\n## Author\n```\n     _      _  _               _ _   \n  __| | ___| || |   ___  _   _| | |_ \n / _` |/ _ \\ || |_ / _ \\| | | | | __|\n| (_| |  __/__   _| (_) | |_| | | |_ \n \\__,_|\\___|  |_|  \\___/ \\__,_|_|\\__|\n```\n\n## __Thank you a lot!__\n\n\u003cbr\u003e\n\n## How to reach me\n\u003ca href=\"https://t.me/de4oult\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/-Telegram-informational?style=for-the-badge\u0026logo=telegram\" alt=\"Telegram Badge\" height=\"30\" /\u003e\n\u003c/a\u003e\n\u003cimg src=\"https://img.shields.io/badge/-kayra.dist@gmail.com-informational?style=for-the-badge\u0026logo=gmail\" alt=\"Gmail Badge\" height=\"30\" /\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunshine-database%2Fsunshine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunshine-database%2Fsunshine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunshine-database%2Fsunshine/lists"}