Menu
Amazon EMR
Developer Guide

Create and Populate Impala Tables

In this section, you create the Impala tables and fill them with test data.

To create and populate the Impala tables with the test data

  1. In the SSH window, launch the Impala shell prompt using the following command:

    Copy
    impala-shell
  2. Create and populate the books table with the test data by running the following command at the Impala shell prompt:

    Copy
    create EXTERNAL TABLE books( id BIGINT, isbn STRING, category STRING, publish_date TIMESTAMP, publisher STRING, price FLOAT ) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' LOCATION '/data/books/';
  3. Create and populate the customers table with the test data by running the following command at the Impala shell prompt:

    Copy
    create EXTERNAL TABLE customers( id BIGINT, name STRING, date_of_birth TIMESTAMP, gender STRING, state STRING, email STRING, phone STRING ) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' LOCATION '/data/customers/';
  4. Create and populate the transactions table with the test data by running the following command at the Impala shell prompt:

    Copy
    create EXTERNAL TABLE transactions( id BIGINT, customer_id BIGINT, book_id BIGINT, quantity INT, transaction_date TIMESTAMP ) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' LOCATION '/data/transactions/';