[ 
https://issues.apache.org/jira/browse/ATLAS-3546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16988422#comment-16988422
 ] 

Madhan Neethiraj commented on ATLAS-3546:
-----------------------------------------

[~api123] - about the first scenario: to create a single rdbms_column, 
providing object-id of an existing rdbms_table entity should be enough; there 
should be no need to provide rdbms_instance/rdbms_db/... For example:
{noformat}
{
  "guid":     "-1",
  "typeName": "rdbms_column",
  "attributes": {
    "name":          "id",
    "qualifiedName": "sales.order_items.id@prod",
    "data_type":     "long",
    "isPrimaryKey":  false
  },
  "relationshipAttributes": {
    "table": {
      "relationshipType": "rdbms_table_columns",
      "typeName":         "rdbms_table",
      "uniqueAttributes": {
        "qualifiedName": "sales.order_items@prod"
      }
    }
  }
}
{noformat}

For the second scenario, perhaps you can consider modeling this as an 
aggregation. Composition, by definition needs a container entity to be present 
for a contained entity to exist. If this constraint can't be met, then perhaps 
the relationship shouldn't be modeled as composition.

You might also want to consider the enhancement added in ATLAS-3405, which will 
create a shell/empty entity for non-existing object-references. In your 
example, if rdbms_table with {{qualifiedName=sales.order_items@prod doesn't 
exist}}, Atlas will create an shell entity for the rdbms_table (with only 
qualifiedName attribute populated), and create rdbms_column entity with link to 
the created table entity. The table entity can be populated later in a 
subsequent call. Note that configuration 
{{atlas.rest.create.shell.entity.for.non-existing.ref=true}} should be set for 
the above handling; else Atlas will fail creation of the column entity.

> isOptional for composition relationship category?
> -------------------------------------------------
>
>                 Key: ATLAS-3546
>                 URL: https://issues.apache.org/jira/browse/ATLAS-3546
>             Project: Atlas
>          Issue Type: Improvement
>          Components:  atlas-core
>    Affects Versions: 2.0.0
>            Reporter: charles shen
>            Priority: Major
>
> I noticed since 
> [ATLAS-3051|https://issues.apache.org/jira/browse/ATLAS-3051], the 
> relationship attribute must be specified in the end def which is not 
> container and relationship category is composition. 
> I understand it's to prohibit orphan children but is it too strong? Reason 
> below:
>  # I have to provide all the entities along the relationship path in the 
> payload when creating a child, eg, for RDBMS, I have to provide 
> rdbms_instance, rdbms_db, rdbms_table, rdbms_column where I just want to 
> create a single rdbms_column, it brings performance overhead to check 
> existence of rdbms_instance, rdbms_db, etc..., 
>  # I have defined a composition relationship type where each end is the same 
> entity type, it couldn't be created successfully anymore since it always 
> requires the mandatory attribute where it's the same type and then falls into 
> infinite loop.
> Three possible fixes:
>  # Remove the isOptional constraint, since ownedRef/inverseRef doesn't have 
> such constraint.
>  # Add isOptional to relationship type end def.
>  # Add option in Rest to ignore the isOptional constraint for relationship 
> type.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to