.get() method returns a list instead of a dict in Realtime Database

Open
#687 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
databases

Research direction

Start by reproducing the reported behavior with the Realtime Database .get() call and the provided Python snippet, then inspect the implementation behind data.ref.child("key").get(). Done means retrieving {"1": "Hello", "2": "World!"} returns a dict rather than [None, "Hello", "World!"], while also checking the described integer-key variations.

Written by the indexing model from the issue text.

Description

api: database
[REQUIRED] Step 2: Describe your environment
  • Operating System version: windows 11
  • Firebase SDK version: 6.1.0
  • Firebase Product: Realtime Database
  • Python version: 3.9
  • Pip version: pip 23.0.1
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:

If you set a key in Realtime Database with a value like this: {"1": "value1", "2": "value2"} and use .get() to retrieve the value, you will receive a list [None, "value1", "value2"] instead of a dict. In addition, it seems that if you use keys that are either too far apart as integers or if you put 0 before a number, you won't get a list.

Relevant Code:
data.ref.child("key").set({"1": "Hello", "2": "World!"})
print(data.ref.child("key").get())
Dominant language
Python
Stars
1.2k
Forks
359
Avg merge
5d 6m
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from firebase/firebase-admin-python

All issues in firebase/firebase-admin-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.