You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Ashok Kumar <as...@yahoo.com> on 2016/01/10 15:45:20 UTC

foreign keys in Hive

 hi,
what is the equivalent to foreign keys in Hive?
Thanks

RE: foreign keys in Hive

Posted by Mich Talebzadeh <mi...@peridale.co.uk>.
Apologies a correction

 

The phrase below:

 

… It does not really make sense to enforce the same logic in Hive which is built on schema on read. Once you start adding foreign keys constraints to Hive, you are actually making it “schema on read”.

 

It should read

 

It does not really make sense to enforce the same logic in Hive which is built on schema on read. Once you start adding foreign key constraints to Hive, you are actually making it “schema on read write”…..

 

 

Dr Mich Talebzadeh

 

LinkedIn   <https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw> https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw

 

Sybase ASE 15 Gold Medal Award 2008

A Winning Strategy: Running the most Critical Financial Data on ASE 15

 <http://login.sybase.com/files/Product_Overviews/ASE-Winning-Strategy-091908.pdf> http://login.sybase.com/files/Product_Overviews/ASE-Winning-Strategy-091908.pdf

Author of the books "A Practitioner’s Guide to Upgrading to Sybase ASE 15", ISBN 978-0-9563693-0-7. 

co-author "Sybase Transact SQL Guidelines Best Practices", ISBN 978-0-9759693-0-4

Publications due shortly:

Complex Event Processing in Heterogeneous Environments, ISBN: 978-0-9563693-3-8

Oracle and Sybase, Concepts and Contrasts, ISBN: 978-0-9563693-1-4, volume one out shortly

 

 <http://talebzadehmich.wordpress.com/> http://talebzadehmich.wordpress.com

 

NOTE: The information in this email is proprietary and confidential. This message is for the designated recipient only, if you are not the intended recipient, you should destroy it immediately. Any information in this message shall not be understood as given or endorsed by Peridale Technology Ltd, its subsidiaries or their employees, unless expressly so stated. It is the responsibility of the recipient to ensure that this email is virus free, therefore neither Peridale Ltd, its subsidiaries nor their employees accept any responsibility.

 

From: Mich Talebzadeh [mailto:mich@peridale.co.uk] 
Sent: 10 January 2016 19:10
To: user@hive.apache.org; 'Ashok Kumar' <as...@yahoo.com>
Subject: RE: foreign keys in Hive

 

Hi,

 

Primary key and foreign key constraints are really more applicable to transactional databases where the transaction logic needs to be enforced. That is once a unit of work is completed it is either committed or rolled back.

 

It does not really make sense to enforce the same logic in Hive which is built on schema on read. Once you start adding foreign keys constraints to Hive, you are actually making it “schema on read”. Case in point if you want to add data to multiple tables in Hive, then you have to know the schema in advance as your data may be rejected (say you are inserting into child table without the corresponding record in parent table). This is not what Hive is designed for in my opinion.

 

 

HTH,

 

 

Dr Mich Talebzadeh

 

LinkedIn   <https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw> https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw

 

Sybase ASE 15 Gold Medal Award 2008

A Winning Strategy: Running the most Critical Financial Data on ASE 15

 <http://login.sybase.com/files/Product_Overviews/ASE-Winning-Strategy-091908.pdf> http://login.sybase.com/files/Product_Overviews/ASE-Winning-Strategy-091908.pdf

Author of the books "A Practitioner’s Guide to Upgrading to Sybase ASE 15", ISBN 978-0-9563693-0-7. 

co-author "Sybase Transact SQL Guidelines Best Practices", ISBN 978-0-9759693-0-4

Publications due shortly:

Complex Event Processing in Heterogeneous Environments, ISBN: 978-0-9563693-3-8

Oracle and Sybase, Concepts and Contrasts, ISBN: 978-0-9563693-1-4, volume one out shortly

 

 <http://talebzadehmich.wordpress.com/> http://talebzadehmich.wordpress.com

 

NOTE: The information in this email is proprietary and confidential. This message is for the designated recipient only, if you are not the intended recipient, you should destroy it immediately. Any information in this message shall not be understood as given or endorsed by Peridale Technology Ltd, its subsidiaries or their employees, unless expressly so stated. It is the responsibility of the recipient to ensure that this email is virus free, therefore neither Peridale Ltd, its subsidiaries nor their employees accept any responsibility.

 

From: Ashok Kumar [mailto:ashok34668@yahoo.com] 
Sent: 10 January 2016 14:45
To: User <user@hive.apache.org <ma...@hive.apache.org> >
Subject: foreign keys in Hive

 

hi,

 

what is the equivalent to foreign keys in Hive?

 

Thanks

 


RE: foreign keys in Hive

Posted by Mich Talebzadeh <mi...@peridale.co.uk>.
Hi,

 

Primary key and foreign key constraints are really more applicable to transactional databases where the transaction logic needs to be enforced. That is once a unit of work is completed it is either committed or rolled back.

 

It does not really make sense to enforce the same logic in Hive which is built on schema on read. Once you start adding foreign keys constraints to Hive, you are actually making it “schema on read”. Case in point if you want to add data to multiple tables in Hive, then you have to know the schema in advance as your data may be rejected (say you are inserting into child table without the corresponding record in parent table). This is not what Hive is designed for in my opinion.

 

 

HTH,

 

 

Dr Mich Talebzadeh

 

LinkedIn   <https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw> https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw

 

Sybase ASE 15 Gold Medal Award 2008

A Winning Strategy: Running the most Critical Financial Data on ASE 15

 <http://login.sybase.com/files/Product_Overviews/ASE-Winning-Strategy-091908.pdf> http://login.sybase.com/files/Product_Overviews/ASE-Winning-Strategy-091908.pdf

Author of the books "A Practitioner’s Guide to Upgrading to Sybase ASE 15", ISBN 978-0-9563693-0-7. 

co-author "Sybase Transact SQL Guidelines Best Practices", ISBN 978-0-9759693-0-4

Publications due shortly:

Complex Event Processing in Heterogeneous Environments, ISBN: 978-0-9563693-3-8

Oracle and Sybase, Concepts and Contrasts, ISBN: 978-0-9563693-1-4, volume one out shortly

 

 <http://talebzadehmich.wordpress.com/> http://talebzadehmich.wordpress.com

 

NOTE: The information in this email is proprietary and confidential. This message is for the designated recipient only, if you are not the intended recipient, you should destroy it immediately. Any information in this message shall not be understood as given or endorsed by Peridale Technology Ltd, its subsidiaries or their employees, unless expressly so stated. It is the responsibility of the recipient to ensure that this email is virus free, therefore neither Peridale Ltd, its subsidiaries nor their employees accept any responsibility.

 

From: Ashok Kumar [mailto:ashok34668@yahoo.com] 
Sent: 10 January 2016 14:45
To: User <us...@hive.apache.org>
Subject: foreign keys in Hive

 

hi,

 

what is the equivalent to foreign keys in Hive?

 

Thanks

 


Re: foreign keys in Hive

Posted by Marcin Tustin <mt...@handybook.com>.
You can join on any equality criterion, just like in any other relational
database. Foreign keys in "standard" relational databases are primarily an
integrity constraint. Hive in general lacks integrity constraints.

On Sun, Jan 10, 2016 at 9:45 AM, Ashok Kumar <as...@yahoo.com> wrote:

> hi,
>
> what is the equivalent to foreign keys in Hive?
>
> Thanks
>
>

-- 
Want to work at Handy? Check out our culture deck and open roles 
<http://www.handy.com/careers>
Latest news <http://www.handy.com/press> at Handy
Handy just raised $50m 
<http://venturebeat.com/2015/11/02/on-demand-home-service-handy-raises-50m-in-round-led-by-fidelity/> led 
by Fidelity