Creating Base Tables

The following script is an example of how to create a base table events, which contains columns event_id, app_id, time, user_id, device_id, platform, sdk_version, and version_code. Note that the table is partitioned on year, month, and day.

CREATE EXTERNAL TABLE default.events (
   event_id STRING, 
   app_id STRING,  
   time TIMESTAMP,
   user_id STRING, 
   device_id STRING,  
   platform STRING, 
   sdk_version STRING, 
   version_code INT     
)

PARTITIONED BY (
   year INT, 
   month INT, 
   day INT    
)

location '/warehouse/sales/events';