Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Realtime Database API #28

Closed
galuszkak opened this issue May 24, 2017 · 13 comments
Closed

FR: Realtime Database API #28

galuszkak opened this issue May 24, 2017 · 13 comments
Assignees

Comments

@galuszkak
Copy link

FR: Realtime Database API

  • Operating System version: Ubuntu
  • Firebase SDK version: 2.0
  • Firebase Product: database

Describe the problem

Lack of support for Realtime Database API now in firebase-admin.

@google-oss-bot
Copy link

Hmmm this issue does not seem to follow the issue template. Make sure you provide all the required information.

@hiranya911
Copy link
Contributor

You might be interested to know, that a database API around the existing REST support is currently bring developed at https://github.com/firebase/firebase-admin-python/tree/hkj-simple-db

@rgbsuede
Copy link

rgbsuede commented Jun 20, 2017

@hiranya911, I'm having trouble using your merged (#31) Database API, do you have any examples of using db.py? Here's what I'm trying to do with your work:

import firebase_admin
from firebase_admin import credentials
from firebase_admin import db

cred = credentials.Certificate('service-account-credentials.json')
app = firebase_admin.initialize_app(cred)
dbRef = db.Reference(path='/', app=app)

users = dbRef.child('users')
print(users)
print(users.get_value())

and I get

<firebase_admin.db.Reference object at 0x03BE3EB0>
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\firebase_admin\db.py", line 131, in get_value
    return self._client.request('get', self._add_suffix())
AttributeError: 'NoneType' object has no attribute 'request'

@rgbsuede
Copy link

PS @galuszkak to access db.py you'll need to use pip install git+https://github.com/firebase/firebase-admin-python (and not just pip install firebase-admin) until the pip package is updated

@hiranya911
Copy link
Contributor

Try something like:

app = firebase_admin.initialize_app(cred, {'dbURL' : 'https://your-db-url.firebase.com'})
ref = db.get_reference()

However, note that we are still working on this and the API is subject to change.

@rgbsuede
Copy link

rgbsuede commented Jun 20, 2017 via email

@rgbsuede
Copy link

Also, and sorry if I'm being a bother, but it doesn't appear that there is an implementation in this python SDK for subscribing to and handling events (like .on('child_added') in the node SDK, for example.) Could I be of any help in extending this for that?

@hiranya911
Copy link
Contributor

@joshbabb We are not going to implement realtime event handling capabilities in this iteration. We will consider it for a future release, if there's enough demand for it. But feel free to document your requirements/suggestions as issues in this repo. That will help us to prioritize the features.

We will also gladly accept any code contributions you can provide us. But if you're going to implement realtime support I'd recommend you to wait until we release what we have already implemented (should be any day now -- we are just finalizing the internal approval processes).

@hiranya911
Copy link
Contributor

Also please note that I've just merged #35 into master. You should update your test code as follows:

app = firebase_admin.initialize_app(cred, {'databaseURL' : 'https://your-db-url.firebase.com'})
ref = db.reference()

@rgbsuede
Copy link

Thanks for the note and all your responses, @hiranya911

I'll make an issue for the request at a later time. We're going to hack what we can together for the time being :)

@hiranya911
Copy link
Contributor

This was released today https://firebase.google.com/support/release-notes/admin/python#2.1.0

@sachaschwab
Copy link

This is just to say that I much appreciate the great and easy to understand stuff you're doing. Keep on going!

@hiranya911
Copy link
Contributor

Thanks @fugu2 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants