16

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

mrsrinivas
  • 34,112
  • 13
  • 125
  • 125
Sam
  • 2,545
  • 8
  • 38
  • 59

1 Answers1

21

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

Community
  • 1
  • 1
Remus Rusanu
  • 288,378
  • 40
  • 442
  • 569