Hive - Database

Card Puncher Data Processing

About

All table in hive are in a database.

The database:

  • has a namespaces function
  • are used to enforce security for a user or group of users.

Management

Set

  • Qualify the table names db_name.table_name
  • or issue the USE statement before the query statement (since Hive 0.6).
USE database_name;
SELECT query_specifications;
USE default;

Current

SELECT current_database();
default/

Describe

DescribeDatabase

DESCRIBE DATABASE [EXTENDED] db_name;
DESCRIBE SCHEMA [EXTENDED] db_name;     -- (Note: Hive 1.1.0 and later)

Example

DESCRIBE DATABASE default;
+----------+------------------------+----------------------------+-------------+-------------+-------------+--+
| db_name  |        comment         |          location          | owner_name  | owner_type  | parameters  |
+----------+------------------------+----------------------------+-------------+-------------+-------------+--+
| default  | Default Hive database  | adl://home/hive/warehouse  | public      | ROLE        |             |
+----------+------------------------+----------------------------+-------------+-------------+-------------+--+

Create

CreateDatabase

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

List / Show

show databases;





Discover More
Card Puncher Data Processing
Hive - Data Model (Data Units)

Data in Hive is organized into: database: Namespaces function Tables - A relation table Partitions - Data in each table may be divided into Partitions. Buckets - Data in each partition may be...
Card Puncher Data Processing
Hive - Schema

The notion of schema is known in Hive as database
Card Puncher Data Processing
Hive - Table

Table implementation in Hive. serializer/deserializers (SerDe) The fully qualified name in Hive for a table is: where: db_name is the database name By default, tables are assumed to be of:...
Card Puncher Data Processing
Hive - URI (Connection URL )

cliservice/confhive.server2.thrift.http.path transportMode : . Default port for HTTP transport mode is 10001. See conf hive.server2.thrift.http.port clientURI Zookeeper Quorum Headnode (Example...



Share this page:
Follow us:
Task Runner