DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Coding
  3. Languages
  4. Developing Python Applications Against Apache Phoenix (HBase)

Developing Python Applications Against Apache Phoenix (HBase)

Tim Spann explains how you can develope Python applications to access HBase big data on Hadoop via the Phoenix JDBC/SQL API.

Tim Spann user avatar by
Tim Spann
CORE ·
Sep. 30, 16 · Tutorial
Like (4)
Save
Tweet
Share
10.40K Views

Join the DZone community and get the full member experience.

Join For Free

First off, Apache Phoenix is an SQL interface to the HBase database on Hadoop. You can access this database with a specialized connector for Spark: Phoenix with Spark.

Phoenix allows for non-JVM developers to access HBase in an easy, standard way. Python is popular for data sciences and web applications. This article will get you started Developing Phoenix Apps with Python. Check out the documentation here. 

Installing the library to access Phoenix from Python is very easy. First off, make sure that you have Python 2.7 or Python 3.x. If you don't have PIP installed, you can see the instructions below. It's a simple one-line PiP install for PhoenixDB.

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
pip install phoenixdb

If you get stuck installing Phoenix libraries for Python, then check out the documentation. You will need to have Apache HBase and Apache Phoenix Running. From your Ambari admin console, grab the server for Phoenix IP/domain name and port. The default port is 8765, but someone may have changed it. These can run either standalone or part of a cluster.  The easiest way is to download a distribution like HDP 2.5.

Access Phoenix Using the Thin Client on HDP

 /usr/hdp/current/phoenix-client/bin/sqlline-thin.py http://server:8765/ 

The newest version of the Hortonworks distribution of Hadoop, HDP 2.5, has Apache Phoenix 4.7.0. Make sure you know the version of Phoenix that you are running. Phoenixdb doesn't work with JSON only Protobuf, so you have to manually change that.

To develop web application against Phoenix, you can use Python with Flask and rapidly developer web apps or REST/JSON Web APIs. Again, make sure you have Python 2.7 or 3 with PiP installed.  You may need root access or need to install via sudo.

To Install Python's Flask Library

pip install gunicorn flask

You can also access Phoenix through standard drivers for .NET and Java. Microsoft provides Phoenix Drivers for Microsoft's .NET. They work fine and are well-supported for HDInsight and other hosted Phoenix servers.

You can finally also access Apache Phoenix via the Phoenix JDBC Drivers that can be used by BI and ETL tools as well as for coding in Java and Scala.

Leave a comment if you are looking for more help or have questions. Thanks!

Apache Phoenix Python (language) Web application

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Cloud-Native Application Networking
  • The Data Leakage Nightmare in AI
  • PostgreSQL: Bulk Loading Data With Node.js and Sequelize
  • Using JSON Web Encryption (JWE)

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: