{"id":21327386,"url":"https://github.com/aiscenblue/datastore-mapper","last_synced_at":"2025-03-16T00:13:37.003Z","repository":{"id":62566834,"uuid":"113940554","full_name":"aiscenblue/datastore-mapper","owner":"aiscenblue","description":"Object Mapper for google datastore withour using appengine","archived":false,"fork":false,"pushed_at":"2017-12-12T04:03:34.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-23T11:36:06.358Z","etag":null,"topics":["google","google-datastore","google-datastore-orm","orm"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aiscenblue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-12T03:51:55.000Z","updated_at":"2018-06-08T08:31:54.000Z","dependencies_parsed_at":"2022-11-03T16:16:03.312Z","dependency_job_id":null,"html_url":"https://github.com/aiscenblue/datastore-mapper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiscenblue%2Fdatastore-mapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiscenblue%2Fdatastore-mapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiscenblue%2Fdatastore-mapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiscenblue%2Fdatastore-mapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aiscenblue","download_url":"https://codeload.github.com/aiscenblue/datastore-mapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243806072,"owners_count":20350775,"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":["google","google-datastore","google-datastore-orm","orm"],"created_at":"2024-11-21T21:17:00.767Z","updated_at":"2025-03-16T00:13:36.987Z","avatar_url":"https://github.com/aiscenblue.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"**Requirements:**\n```\n  Python 3.5 or higher\n```\n\n**Install requirements**  \n`pip3 install datastore_mapper`\n\n\n# Set google application credentials\n```\nos.environ[\"GOOGLE_APPLICATION_CREDENTIALS\"] = \"path/to/gcp-service-key.json\"\n```\n\n# Create Model\n```\nfrom datastore_mapper import Model, StringProperty, EmailProperty, UidProperty\n\n\nclass Users(Model):\n    uid = UidProperty()\n    first_name = StringProperty()\n    last_name = StringProperty()\n    email = EmailProperty()\n\n    __excluded_indexes__ = ['first_name', 'last_name', 'email']\n\n```\n\u003e excluded_indexes is to unset properties that it not needed to be indexed. \ndatastore set all properties indexed as a default\n\n# Create\n\n```\nusers = Users(first_name=\"John\", last_name=\"Doe\", email=\"john_doe@email.com\")\nusers.save()\n```\n\n*** Save using ancestor ***\n```\nusers = Users()\nusers.set_key(ancestor=\"generatedUID\")\nusers.save()\n\nusers_posts = UsersPosts()\nusers_posts.set_key(ancestor=users.key)\nusers_posts.save()\n```\n\n# Update\n\n```\nusers = Users(uid=\"exampleGeneratedUID\", first_name=\"John\", last_name=\"Doe\", email=\"john_doe@email.com\")\nusers.update()\n```\n\n# Delete\n\n```\nusers = Users(uid=\"exampleGeneratedUID\")\nusers.delete()\n```\n\u003e delete is a logical deletion where the data \nwill be updated the deleted_at property which is a default property model to the current date\n\n# Search query\n\n```\nfrom datastore_mapper import ModelCollection\n\nModelCollection(Users(), **kwargs).to_json()\n```\n\n\u003e **kwargs can be any query that you like example\nuid=\"generatedUID\" -\u003e for finding the specific User Model in the datastore\n\n\u003e order=\"-created_at\" for descending order or order=\"created_at\" for ascending order\n\n\u003e limit=\"15\" to set limit per list. DEFAULT is 15\n\n\u003e filters=[('first_name', '=', \"john\"\")]\n\n\u003e Users().find_by_iud(\"generatedUID\")\n\n# errors\n\n```\nusers = Users(first_name=\"John\", last_name=\"Doe\", email=\"john_doe@email.com\")\nusers.errors\nusers.save() or update() or delete()\nusers.data\n```\n\u003e errors are list or errors from the library. This implementation is to prevent try catch repetition\n\u003e data are lists of results from the query.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faiscenblue%2Fdatastore-mapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faiscenblue%2Fdatastore-mapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faiscenblue%2Fdatastore-mapper/lists"}