PUT ddl/database/:db/table/:table


Create a new HCatalog table. For more information, please refer to the Hive documentation.




:db The database name Required None
:table The new table name Required None
group The user group to use when creating a table Optional None
permissions The permissions string to use when creating a table. Optional None
external Allows you to specify a location so that Hive does not use the default location for this table. Optional false
ifNotExists If true, you will not receive an error if the table already exists. Optional false
comment Comment for the table Optional None
columns A list of column descriptions, including name, type, and an optional comment. Optional None
partitionedBy A list of column descriptions used to partition the table. Like the columns parameter this is a list of name, type, and comment fields. Optional None
clusteredBy An object describing how to cluster the table including the parameters columnNames, sortedBy, numberOfBuckets. The sortedBy parameter includes the parameters columnName and order. For further information please refer to the examples below or to the Hive documentation. Optional None
format Storage format description including paraeters for rowFormat, storedAs and storedBy. For further information please refer to the examples below or to the Hive documentation. Optional None
location The HDFS path Optional None
tableProperties A list of table property names and values (key/value pairs) Optional None


table The new table name
database The database name


Curl Command

% curl -s -X PUT -HContent-type:application/json -d '{
 "comment": "Best table made today",
 "columns": [
   { "name": "id", "type": "bigint" },
   { "name": "price", "type": "float", "comment": "The unit price" } ],
 "partitionedBy": [
   { "name": "country", "type": "string" } ],
 "format": { "storedAs": "rcfile" } }' \

Curl Command (using clusteredBy)

% curl -s -X PUT -HContent-type:application/json -d '{
  "comment": "Best table made today",
  "columns": [
    { "name": "id", "type": "bigint"},
    { "name": "price", "type": "float", "comment": "The unit price" } ],
  "partitionedBy": [
    { "name": "country", "type": "string" } ],
  "clusteredBy": {
    "columnNames": ["id"],
    "sortedBy": [
      { "columnName": "id", "order": "ASC" } ],
    "numberOfBuckets": 10 },
  "format": {
    "storedAs": "rcfile",
    "rowFormat": {
      "fieldsTerminatedBy": "\u0001",
      "serde": {
        "name": "org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe",
        "properties": {
          "key": "value" } } } }
  } ' \

JSON Output

 "table": "test_table",
 "database": "default"

JSON Output (error)

  "statement": "use default; create table test_table_c(id bigint, price float comment ...",
  "error": "unable to create table: test_table_c",
  "exec": {
    "stdout": "",
    "stderr": "WARNING: org.apache.hadoop.metrics.jvm.EventCounter is deprecated...
        Hive history file=/tmp/ctdean/hive_job_log_ctdean_201204051335_2016086186.txt
        SLF4J: Class path contains multiple SLF4J bindings.
        SLF4J: Found binding in ...
        SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
        Time taken: 0.448 seconds
        FAILED: Error in semantic analysis: Operation not supported. HCatalog doesn't allow Clustered By in create table.
    "exitcode": 10