Community Articles
Find and share helpful community-sourced technical articles
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.
Super 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

4,484 Views
Comments

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.

Don't have an account?
Coming from Hortonworks? Activate your account here
Version history
Revision #:
2 of 2
Last update:
‎08-17-2019 01:47 PM
Updated by:
 
Contributors
Top Kudoed Authors