# Introducing Hive Metastore Browser

The Table Browser application enables you to browse tables and partitions of a Hive database. For information about Hive, see Hive Documentation. You can create Hive tables, view Hive tables, and load data into Hive tables.

Hue makes it easy to create Hive tables.

With HUE-1746, Hue guesses the columns names and types (int, string, float…) directly by looking at your data. If your data starts with a header, this one will automatically be used and skipped while creating the table.

Quoted CSV fields are also compatible thanks to HUE-1747.

Here is the data file used:

http://www.fdic.gov/bank/individual/failed/banklist.html

This is the SerDe for reading quoted CSV:

https://github.com/ogrodnek/csv-serde

And the command to switch the SerDe used by the table:

    ALTER TABLE banks SET SERDE 'com.bizo.hive.serde.csv.CSVSerde'

Now go analyze the data with the Hive, Impala or Pig editors!

## Contents

- Introducing Table Browser
- Table Browser and Hive Installation and Configuration
- Starting Table Browser

- Installing the Sample Tables
- Importing Your Own Data

- Working with Tables

- Selecting the Database
- Creating Tables
- Browsing Tables
- Importing Data into Tables
- Dropping Tables
- Viewing a Table's Location

# Table Browser and Hive Installation and Configuration

Table Browser is installed and configured as part of Hue. For information about installing and configuring Hue, see Hue Installation.

Table Browser depends on the Beeswax application being installed and available.

# Starting Table Browser

To start the Table Browser application, click the Table Browser icon () in the navigation bar at the top of the Hue browser page.

### Installing the Sample Tables

You can install two sample tables to use as examples.

1. In the Table Browser window, click Tables.
2. In the ACTIONS pane, click Install samples.

Once you have installed the sample data, you will no longer see the Install samples link.

### Importing Your Own Data

If you want to import your own data instead of installing the sample tables, following the procedure in Creating Tables.

### Creating Tables

Although you can create tables by executing the appropriate HQL DDL query commands, it is easier to create a table using the Table Browser table creation wizard.

There are two ways to create a table: from a file or manually.

If you create a table from a file, the format of the data in the file will determine some of the properties of the table, such as the record and file formats. The data from the file you specify is imported automatically upon table creation.

When you create a file manually, you specify all the properties of the table, and then execute the resulting query to actually create the table. You then import data into the table as an additional step.

To create a table from a file:

1. In the Table Browser window, click Tables.
2. In the ACTIONS pane, click Create a new table from a file.
   The table creation wizard starts.
3. Follow the instructions in the wizard to create the table. The basic steps are:
   - Choose your input file. The input file you specify must exist.
     Note that you can choose to have Table Browser create the table definition only based on the import file you select, without actually importing data from that file.
   - Specify the column delimiter.
   - Define your columns, providing a name and selecting the type.
4. Click Create Table to create the table.
   The new table's metadata displays on the right side of the Table Metadata window.
   At this point, you can view the metadata or a sample of the data in the table.
   From the ACTIONS pane you can import new data into the table, browse the table, drop it, or go to the File Browser to see the location of the data.

To create a table manually:

1. In the Table Browser window, click Tables.
2. In the ACTIONS pane, click Create a new table manually.
   The table creation wizard starts.
3. Follow the instructions in the wizard to create the table. The basic steps are:
   - Name your table.
   - Choose the record format.
   - Configure record serialization by specifying delimiters for columns, collections, and map keys.
   - Choose the file format.
   - Specify the location for your table's data.
   - Define your columns, providing a name and selecting the type.
   - Add partitions, if appropriate.
4. Click Create table.
   The Table Metadata window displays.

### Browsing Tables

To browse the data in a table:

1. In the Table List window, click the Browse Data button next to the table you want to browse.
   The table's data displays in the Query Results window.

To browse the metadata in a table:

1. In the Table List window, click the table name.
   The table's metadata displays opened to the Columns tab. You can view the data in the table by selecting the Sample tab.

### Importing Data into Tables

When importing data, you can choose to append or overwrite the table's data with data from a file.

To import data into a table:

1. In the Table List window, click the table name.
   The Table Metadata window displays.
2. In the ACTIONS pane, click Import Data.
3. For Path, enter the path to the file that contains the data you want to import.
4. Check Overwrite existing data to replace the data in the selected table with the imported data. Leave this unchecked to append to the table.
5. Click Submit.

### Dropping Tables

To drop a table:

1. In the Table List window, click the table name.
   The Table Metadata window displays.
2. In the ACTIONS pane, click Drop Table.
3. Click Yes to confirm the deletion.

### Viewing a Table's Location

To view a table's location:

1. In the Table List window, click the table name.
   The Table Metadata window displays.
2. Click View File Location.
   The file location of the selected table displays in its directory in the File Browser window.