Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Celebrating as our community reaches 100,000 members! Thank you!
avatar
Master Guru

A often requested feature has popped up in HDP 2.5, Phoenix namespace mapping AKA Phoenix schemas. This feature allows creation of schemas and development within a schema work space. This guide will walk through steps to enable this feature and how to use it.

Use Case:

Create 2 schemea named "schema1" and "scheama2"

Within both schemas create table customer.

Create another schema named "schema3".

Drop schema "schema3"

Note - A schema can only be dropped if it is empty (does not host any tables).

1. Through Ambari go to HBase. Select Advanced tab

13749-1.jpg

2. Add a parameter to hbase-site.xml. To do this go to "Custom hbase-site" and click on "Add Property"

13750-2.jpg

3. Add the property

Key: phoenix.schema.isNamespaceMappingEnabled

Value: true

Click on Add button. A restart hbase service will be required.

13751-3.jpg

4. Test the functionality, use sqlline.py. It is located under

/usr/hdp/current/phoenix/bin

Note - I am using /usr/hdp/2.5.0.0-1245/phoenix/bin since I want to prove to the audience I am in fact using HDP 2.5.

13752-4.jpg

5. Create two schemeas named "schema1" and "schmea2"

13753-5.jpg

6. Set work space to use schema1 and create table customer

13754-6.jpg

7. Set work space to use schema2 and create table customer

13755-7.jpg

8. Run a !table to view all schemas and tables

13756-8.jpg

9. Create a schema "schema3" and drop "schema3"

13757-9.jpg

That's it! Simple and easy to use. Enjoy the new feature

6,907 Views
Comments
avatar

Hi @Sunile Manjee, you article is great. I tried following the same steps and was successful in creating a schema and a table within it. But if i try to drop the table, i see the error that "Table not found". And if i try to create the table, i see the message "Table exists". Any thoughts on it.