How do I add a primary in hive version 0.14.0.2.2.0.0-2041?

0

How do I add a primary in hive version 0.14.0.2.2.0.0-2041?

Attempt

CREATE TABLE simple_rule (
  simple_rule_id           int(10) unsigned default '0' not null auto_increment,
  condition_analysis_id    int(10) unsigned NOT NULL,
  goal_analysis_id         int(10) unsigned NOT NULL,

  PRIMARY KEY (simple_rule_id),
  UNIQUE (condition_analysis_id, goal_analysis_id)
);
    
asked by anonymous 08.08.2017 / 20:42

1 answer

0

Hive is not a relational database and does not have the same concept of primary / foreign key.

But you can add this information in the table Metadata:

CREATE TABLE simple_rule (
    simple_rule_id          int 
    condition_analysis_id   int,
    goal_analysis_id        int,
)
TBLPROPERTIES("PRIMARY KEY"="simple_rule_id");

But reinforcing this will not make any difference in the table.

    
08.08.2017 / 21:45