Search code examples
pythongoogle-cloud-platformgoogle-cloud-firestore

How to use Google Cloud Firestore local emulator for python and for testing purpose


I tried to find out how to use firestore local emulator for python and for testing purpose. But I can not find out how-to document.

Could somebody help me?


Solution

  • Welcome to SO :)

    The primary purpose of the Cloud Firestore Emulator (at the moment) seems to be to test security rules, as documented here. This section states: "The only SDK that currently supports the emulator is the Node.js SDK."

    Confusingly there are also these Ruby docs for the Google Cloud Client Libraries. The same thing does not seem to be available in Python yet.

    Here are instructions for running the emulator as part of the Google Cloud SDK.


    Consider using Cloud Firestore in Datastore mode, which has better tooling (it's probably just had more time to mature). You can find instructions for running its emulator on the Running the Datastore mode Emulator page.

    Use the Choosing between Native Mode and Datastore Mode page to decide which direction you want to take. If you feel you need the additional 'Native mode' features, it'll probably be easiest to connect straight to a real Firestore instance in the cloud.