Using the Firebase ORM - steviep42/immport GitHub Wiki

This is an overview of what is involved in creating Firebase collections using one of the Google Firebase ORMs found at https://pypi.org/project/firebase-orm/ It appears to be fairly straightforward and should allow for creation of collections and sub collections on Firebase. There are some procedural issues that must be attended to such as creating a project within the Google console although that can also be created as you create the database. It can be a bit confusing.

This page is something of a repetition of this page here on the Wiki but I wanted to put everything in one place to avoid cross referencing things too much. Also, the more I experiment with the Google Cloud Console, I find short cuts and quicker ways to do things.

Creating a Firebase Project Database

Login to Google Cloud and proceed to the Firebase console associated with your account. The URL, at least as of right now, is https://console.firebase.google.com/ This is a fairly straightforward method of creating a new database (albeit it a NoSQL one). Just click the the "+" icon to create a new database.

So this will prompt you to select an existing project which is Google's way of encapsulating activity into an administrative entity for accounting and grouping. This is not a container like a "docker" image. It's just administrative. You can see here that I've created a project called orm-test-example under which I want to create a Firebase database. You could also create a new project here if you wanted.

Getting The Keys To Your Project

Once the process is completed you will be prompted to hit a "continue" button which will take you to the Firebase console for the newly created project. To access it programmatically, you will then need to download the .json file that will let you access it via Python from your desktop or laptop. From the console you would hit the Settings wheel, then select Users And Permissions, and then Service Accounts. Note that the bottom of the screen is a button that says Generate New Private Key which you should push.

You will be prompted once again to generate the key which will then be downloaded to your local hard drive. Keep this safe:

Once this has been downloaded you can see that it is just a .json file called, in this case:

   orm-test-example-firebase-adminsdk-hp4wr-36bd2f957f.json

Note that the file's content is redacted for security. The actual one will have a private key content field that actually works to access the project. Keep in mind that our project is currently empty and has no collections whatsoever. We could create stuff if we wanted.

   {
    "type": "service_account",
    "project_id": "orm-test-example",
    "private_key_id": "36b08b39jfi7fb81340e8be41dae5kjf98627c0f9d0",
    "private_key": "-----BEGIN PRIVATE 
    "client_email": "firebase-adminsdk-phhjtu@orm-fest-example.miam.gserviceaccount.com",
    "client_id": "114617103037052590612",
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://oauth2.googleapis.com/token",
    "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
    "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-hp4
  }
⚠️ **GitHub.com Fallback** ⚠️