Creating Databases Based on COS

Last updated: 2020-07-10 16:46:56

There are two ways to create a Cloud Object Storage (COS) data warehouse:

  1. Method 1. Create the whole database in COS
    To do so, run the following statement:
    create database hivewithcos location 'cosn://huadong/hive';
    Here, huadong is the bucket name, and hive is the path, which can be set as needed. After creating the database, you can create a data table.
    create table record(id int, name string) row format delimited fields terminated by ',' stored as textfile;
    Then, load data into the table, which can be used in exactly the same way as HDFS.
  2. Method 2. Move the specified table into COS
    First, select or create a database in Hive. Then move the specified table into COS by running the following statement:
    create table record(id int, name string) row format delimited fields terminated by ',' stored as textfile location 'cosn://huadong/hive/cos';
    Load data into the table. Now the table is stored in COS.

Was this page helpful?

Was this page helpful?

  • Not at all
  • Not very helpful
  • Somewhat helpful
  • Very helpful
  • Extremely helpful
Send Feedback
Help