firebase / firebase/firebase-admin-python

[FR] Change the firestore db in firestore.client.

Open
#789 2 comments 1 reaction 0 assignees View on GitHub
api: firestore type: feature request
Dominant language
Python
Stars
1.2k
Forks
359
Avg merge
5d 6m
Merged PRs (30d)
2

Description

In short: There is currently no way to change the firestore database to write to from default.
See question on stackoverflow: https://stackoverflow.com/questions/78533417/how-to-write-to-a-firestore-db-other-than-default-in-a-python-cloud-function

As far as I understand there is currently no option to pass the databaseId to firestore.client or to the options when initializing the app (initialize_app(cred)). You can pass the databaseURL to the options in initialze_app, however the Url cannot be looked up in the firebase console anymore.

In my opinion, it would make sense to passt database as an argument to firestore.client() much like you would when initializing the Client class in google.cloud.firestore directly.
```python
db = firestore.client(app, database="my-db")
```

Alternatively the databaseId could be passed as an option when initializing the app.
```python
app = initialize_app(cred, options={"databaseId": "my-db")
```

I'd be willing to implement this feature.

Contributor guide

Open the contributing guide

Research direction

Start by reading the firestore.client and initialize_app entry points described in the issue, then compare their options with the Google Cloud Firestore Client interface. Resolve whether databaseId belongs on firestore.client or app initialization, and confirm that a non-default database can be selected without relying on databaseURL.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.