{ "info": { "author": "Vladimir Filipenko", "author_email": "zavx0z@ya.ru", "bugtrack_url": null, "classifiers": [], "description": "FirebaseORM Python\n=======================================\nDjango like models for NoSQL database Firestore.\n\n________\n\nInstallation\n============\n\n.. code-block:: shell\n\n $ pip install firebase_orm\n\nInitialize\n==========\n\nCreate settings.py in the root directory of the project:\n\n settings.py\n\n .. code-block:: python\n\n CERTIFICATE = 'path/to/serviceAccountKey.json'\n BUCKET_NAME = '.appspot.com'\n\nCERTIFICATE\n Once you have created a `Firebase console `_ project and downloaded a JSON file with your service account credentials.\n\nBUCKET_NAME\n The bucket name must not contain gs:// or any other protocol prefixes. For example, if the bucket URL displayed in the `Firebase console `_ is gs://bucket-name.appspot.com, pass the string bucket-name.appspot.com\n\nUsage\n======\n\nCreate model:\n\"\"\"\"\"\"\"\"\"\"\"\"\"\n\n.. code-block:: python\n\n from firebase_orm import models\n\n\n class Article(models.Model):\n headline = models.TextField()\n type_article = models.TextField(db_column='type')\n\n class Meta:\n db_table = 'medications'\n\n def __str__(self):\n return self.headline\n\nUse API:\n\"\"\"\"\"\"\"\"\n**Creating objects**\n\nTo represent cloud firestore data in Python objects, FirebaseORM uses an intuitive system:\nA model class represents a collection,\nand an instance of that class represents a document in collection.\n\nTo create an object, instantiate it using keyword arguments to the model class,\nthen call save() to save it to the database.\n\n.. code-block:: pycon\n\n # Import the models we created\n >>> from models import Article\n # Create a new Article.\n >>> a = Article(headline='Django is cool')\n # Save the object into the database. You have to call save() explicitly.\n >>> a.save()\n\n\n**Retrieving all objects**\n\nThe simplest way to retrieve documents from a collections is to get all of them.\nTo do this, use the all() method on a Manager:\n\n.. code-block:: pycon\n\n >>> all_Article = Article.objects.all()\n\nThe all() method returns a list instance Article of all the collection in the database.\n\n\n.. code-block:: pycon\n\n # Now it has an ID.\n >>> a.id\n 1\n\n # Fields are represented as attributes on the Python object.\n >>> a.headline\n 'Django is cool'\n\n**Saving changes to objects**\n\nTo save changes to an object that\u2019s already in the database, use save().\n\nGiven a Article instance a that has already been saved to the database,\nthis example changes its name and updates its record in the database:\n\n.. code-block:: pycon\n\n >>> a.headline = 'FirebaseORM is cool'\n >>> a.save()\n\nThis performs an document.update() method behind the scenes.\nFirebaseORM doesn\u2019t hit the database until you explicitly call save().\n\n.. code-block:: pycon\n\n # Firebase ORM provides a rich database lookup API.\n >>> Article.objects.get(id=1)\n \n >>> Article.objects.get(id=2)\n Traceback (most recent call last):\n ...\n DoesNotExist: Article matching query does not exist.\n\n\n\nField options:\n==============\n\nThe following arguments are available to all field types. All are optional.\n\n**Field.db_column**\n\n If contains characters that aren\u2019t allowed in Python variable names \u2013 use db_column.\n The name of the firestore key in document to use for this field.\n If this isn\u2019t given, FirebaseORM will use the field\u2019s name.\n\n\nField types:\n============\n\nAutoField\n\"\"\"\"\"\"\"\"\"\n**class AutoField()**\n\n By default, FirebaseORM gives each model the following field:\n\n .. code-block:: python\n\n id = models.AutoField(primary_key=True)\n\nTextField\n\"\"\"\"\"\"\"\"\"\"\n**class TextField(**options)**\n\n Text string Up to 1,048,487 bytes (1 MiB - 89 bytes).\n Only the first 1,500 bytes of the UTF-8 representation are considered by queries.\n\n TextField has not extra required argument.\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/zavx0z/firebase_orm", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "firebase-orm", "package_url": "https://pypi.org/project/firebase-orm/", "platform": "", "project_url": "https://pypi.org/project/firebase-orm/", "project_urls": { "Homepage": "https://github.com/zavx0z/firebase_orm" }, "release_url": "https://pypi.org/project/firebase-orm/0.1.29/", "requires_dist": [ "firebase-admin (>=2.9.0)", "grpcio (>=1.9.1)" ], "requires_python": "", "summary": "NoSQL object model database", "version": "0.1.29" }, "last_serial": 3649871, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "67ce203ab02367100b2d746328834ac7", "sha256": "168c1bed93af7cb7c46ea9f276dcd171854e287f2859ad9b9d4c4f150ad8be3a" }, "downloads": -1, "filename": "firebase_orm-0.1.0-py36-none-any.whl", "has_sig": false, "md5_digest": "67ce203ab02367100b2d746328834ac7", "packagetype": "bdist_wheel", "python_version": "py36", "requires_python": null, "size": 6783, "upload_time": "2018-03-02T16:09:52", "url": "https://files.pythonhosted.org/packages/75/65/99d23155e0e69aa7eaa31006344b71856158269bb570fe2788916d91ab0d/firebase_orm-0.1.0-py36-none-any.whl" } ], "0.1.29": [ { "comment_text": "", "digests": { "md5": "7235bd4dc592dd8e0ed78122e11ff4a9", "sha256": "e95302a3c85c6f14afef4876c494254ae6691facf6ba178a5ea790a49d8d838a" }, "downloads": -1, "filename": "firebase_orm-0.1.29-py36-none-any.whl", "has_sig": false, "md5_digest": "7235bd4dc592dd8e0ed78122e11ff4a9", "packagetype": "bdist_wheel", "python_version": "py36", "requires_python": null, "size": 9492, "upload_time": "2018-03-08T04:10:48", "url": "https://files.pythonhosted.org/packages/04/f0/6686c94b5b48e815b25fccded6e736a6e78f14cfbf622e0b8f7fefd61c10/firebase_orm-0.1.29-py36-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7235bd4dc592dd8e0ed78122e11ff4a9", "sha256": "e95302a3c85c6f14afef4876c494254ae6691facf6ba178a5ea790a49d8d838a" }, "downloads": -1, "filename": "firebase_orm-0.1.29-py36-none-any.whl", "has_sig": false, "md5_digest": "7235bd4dc592dd8e0ed78122e11ff4a9", "packagetype": "bdist_wheel", "python_version": "py36", "requires_python": null, "size": 9492, "upload_time": "2018-03-08T04:10:48", "url": "https://files.pythonhosted.org/packages/04/f0/6686c94b5b48e815b25fccded6e736a6e78f14cfbf622e0b8f7fefd61c10/firebase_orm-0.1.29-py36-none-any.whl" } ] }