You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@atlas.apache.org by Nigel Jones <ni...@gmail.com> on 2018/03/05 15:42:36 UTC

EntityREST Bulk & relationships

I'd like to check my understanding of the bulk api & relationships....

Let's say I have a database with a table, which contains a few columns. (like hive)

If the composition relationship is modelled using explicit attributes, I believe I could  create my entire definition containing multiple of all the above in a single EntityREST Bulk API request, using negative GUIDs as placeholders for the entities that are being referenced & created within the request.

If instead I don't use attributes, but use relationships to define the composition, I cannot do this, since I need to create all the entities initially (which could be done in one request) and then, based on the GUIDs generated, issue  a series of calls to RelationshipREST to define the relationships (relationships cannot be created as part of the bulk entity api call)

is my understanding correct? Have I missed anything?

Thanks
Nigel.

Re: EntityREST Bulk & relationships

Posted by Nigel Jones <ni...@gmail.com>.
On 2018/03/08 06:29:17, Madhan Neethiraj <ma...@apache.org> wrote: 

> Given REST APIs support create/update of relationship instances,  I think AtlasClientV2 should support the same. Can you please file a JIRA, with fixVersion=1.0.0?

Have done. I'll see if I can make a patch to share

Re: EntityREST Bulk & relationships

Posted by Madhan Neethiraj <ma...@apache.org>.
Nigel,

Given REST APIs support create/update of relationship instances,  I think AtlasClientV2 should support the same. Can you please file a JIRA, with fixVersion=1.0.0?

Thanks,
Madhan



On 3/7/18, 3:37 PM, "Nigel Jones" <ni...@gmail.com> wrote:

    
    
    On 2018/03/05 23:42:18, Madhan Neethiraj <ma...@apache.org> wrote: 
    
    > Entity update will process the relationship attributes specified in "AtlasEntity.relationshipAttributes" and update the relationships accordingly. If an entity has an attribute in both " attributes" and "relationshipAttributes" (like hive_table.columns), then the values specified in "attributes" would be ignored; and the entity will be updated for the value specified in "relationshipAttributes". Given this, it is possible to use 'relationshipAttributes', in the same way as 'attributes'. However, considering that relationships are dynamic (i.e. a relationship type can be added at runtime) and the entity-update API caller may not know all the relationships of an entity-type at compile time, I would think such API integration would only deal with attributes directly defined in an entity-type.
    
    
    As a follow-on question, to create some test data, I had been using the REST API directly, but spent a little time looking at the AtlasClientV2 api. Whilst I can create types, entities using that API, I noticed there didn't seem a way to create a relationship - only to get or delete. For client apps relationships can only be created via REST? Or did I miss something?
    
    



Re: EntityREST Bulk & relationships

Posted by Nigel Jones <ni...@gmail.com>.

On 2018/03/05 23:42:18, Madhan Neethiraj <ma...@apache.org> wrote: 

> Entity update will process the relationship attributes specified in "AtlasEntity.relationshipAttributes" and update the relationships accordingly. If an entity has an attribute in both " attributes" and "relationshipAttributes" (like hive_table.columns), then the values specified in "attributes" would be ignored; and the entity will be updated for the value specified in "relationshipAttributes". Given this, it is possible to use 'relationshipAttributes', in the same way as 'attributes'. However, considering that relationships are dynamic (i.e. a relationship type can be added at runtime) and the entity-update API caller may not know all the relationships of an entity-type at compile time, I would think such API integration would only deal with attributes directly defined in an entity-type.


As a follow-on question, to create some test data, I had been using the REST API directly, but spent a little time looking at the AtlasClientV2 api. Whilst I can create types, entities using that API, I noticed there didn't seem a way to create a relationship - only to get or delete. For client apps relationships can only be created via REST? Or did I miss something?

Re: EntityREST Bulk & relationships

Posted by Madhan Neethiraj <ma...@apache.org>.
Nigel,

>  If the composition relationship is modelled using explicit attributes, I believe I could  create my entire definition containing multiple of all the above in a single EntityREST Bulk API request, using negative GUIDs as placeholders for the entities that are being referenced & created within the request.

Yes. This is correct.

>  If instead I don't use attributes, but use relationships to define the composition, I cannot do this, since I need to create all the entities initially (which could be done in one request) and then, based on the GUIDs generated, issue  a series of calls to RelationshipREST to define the relationships (relationships cannot be created as part of the bulk entity api call)

Entity update will process the relationship attributes specified in "AtlasEntity.relationshipAttributes" and update the relationships accordingly. If an entity has an attribute in both " attributes" and "relationshipAttributes" (like hive_table.columns), then the values specified in "attributes" would be ignored; and the entity will be updated for the value specified in "relationshipAttributes". Given this, it is possible to use 'relationshipAttributes', in the same way as 'attributes'. However, considering that relationships are dynamic (i.e. a relationship type can be added at runtime) and the entity-update API caller may not know all the relationships of an entity-type at compile time, I would think such API integration would only deal with attributes directly defined in an entity-type.

Hope this helps.

Madhan




On 3/5/18, 7:42 AM, "Nigel Jones" <ni...@gmail.com> wrote:

    I'd like to check my understanding of the bulk api & relationships....
    
    Let's say I have a database with a table, which contains a few columns. (like hive)
    
    If the composition relationship is modelled using explicit attributes, I believe I could  create my entire definition containing multiple of all the above in a single EntityREST Bulk API request, using negative GUIDs as placeholders for the entities that are being referenced & created within the request.
    
    If instead I don't use attributes, but use relationships to define the composition, I cannot do this, since I need to create all the entities initially (which could be done in one request) and then, based on the GUIDs generated, issue  a series of calls to RelationshipREST to define the relationships (relationships cannot be created as part of the bulk entity api call)
    
    is my understanding correct? Have I missed anything?
    
    Thanks
    Nigel.