Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create a schema in hive

Tags:

hadoop

hive

hdfs

How can I create multiple schema under a user defined DB in hive?

I am trying to create a schema under a DB sam_db in hive. I am using the folowing code.

use sam_db;
create schema sam_db_schema;

But when I visit the local host to see the filesystem I see that instead of a schema being created inside sam_db a db named sam_db_schema is getting created.

Below is the screen shot presenting my case: enter image description here

Isn't multiple schemas for a DB not possible in hive.

If possible then how do I create them.

Are both database and schema same for hive. Because when I do a

show databases;
show schemas

It gives me the same output.

Please help me understand : Thanks in advance

like image 371
Sam Avatar asked Mar 03 '14 10:03

Sam


1 Answers

Are both database and schema same for hive?

Yes. The Language manual states this clearly:

CREATE (DATABASE|SCHEMA) [IF NOT EXISTS] database_name
 [COMMENT database_comment]
 [LOCATION hdfs_path]
 [WITH DBPROPERTIES (property_name=property_value, ...)];

The uses of SCHEMA and DATABASE are interchangeable – they mean the same thing

like image 178
Remus Rusanu Avatar answered Nov 04 '22 09:11

Remus Rusanu