问题
I have a web-app in Django and backend in Hbase. To access hbase I'm using Apache Phoenix to query hbase. Phoenix has jdbc drivers exposed.
How can I integrate Phoenix with Django ORM using these jdbc drivers? Can I write customer db adapter or is there any other way?
Thanks in advance.
回答1:
I have also been trying to see if it is possible to extend the ORM of django to use apache phoenix. but for a start, you can checkout
JayDeBeAPI
or
phoenixdb
As an example, I was able to connect and retrieve data using the phoenixdb package.
- Install the package via pip install phoenixdb
Run the sample code:
import phoenixdb
database_url = 'http://localhost:8765/?v=1.6'
conn = phoenixdb.connect(database_url, autocommit=True)
cursor = conn.cursor()
cursor.execute('select * from WEB_STAT limit 1')
rs = cursor.fetchall()
print rs
It is important to know the version of the phoenix you are using, you can find the details in the link provided.
来源:https://stackoverflow.com/questions/37708696/how-to-write-custom-database-adapter-for-django-using-jdbc-drivers