OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

Changing Tier does not replace the previously selected Tier

Open darth-coder00 opened this issue 5 years ago • 4 comments

Patch API : api/v1/tables/

Payload:

[{"op":"replace","path":"/tags/0/tagFQN","value":"Tier.Tier3"}]

Response:

{
  "id": "338fe5bb-b125-4ba6-aa61-313b29e9947d",
  "name": "sql_sizing_profiles",
  "href": "http://localhost:8585/api/v1/tables/338fe5bb-b125-4ba6-aa61-313b29e9947d",
  "fullyQualifiedName": "aws_redshift.information_schema.sql_sizing_profiles",

  <----------Other_fields------------->

  "tags": [
    {
      "tagFQN": "Tier.Tier1",
      "labelType": "Manual",
      "state": "Confirmed"
    },
    {
      "tagFQN": "Tier.Tier3",
      "labelType": "Manual",
      "state": "Confirmed"
    }
  ]
}

Expected behaviour: Response should only have 1 Tier set, i.e. Tier3 in this case

darth-coder00 avatar Aug 10 '21 16:08 darth-coder00

@darth-coder00, are you creating a patch using JSON patch diff by diffing the original JSON and the updated JSON? I return the tags ordered by tag FQN name. When applying the patch, the server backend applies it to the table JSON in the same order. If you generated JSON patch with diffing two JSONs, then I recommend you use the right array index based on the JSON that you received from the server.

If you can repro this, can you also include the original table JSON you got?

sureshms avatar Aug 10 '21 17:08 sureshms

Original JSON with tier as Tier1:

{
  "id": "54a8f217-9674-453e-8639-fd2e31c70e9e",
  "name": "category",
  "href": "http://localhost:8585/api/v1/tables/54a8f217-9674-453e-8639-fd2e31c70e9e",
  "fullyQualifiedName": "aws_redshift.public.category",
  "columns": [
    {
      "name": "catid",
      "columnDataType": "INT",
      "fullyQualifiedName": "aws_redshift.public.category.catid",
      "tags": [],
      "columnConstraint": "NOT_NULL",
      "ordinalPosition": 1
    },
    {
      "name": "catgroup",
      "columnDataType": "VARCHAR",
      "fullyQualifiedName": "aws_redshift.public.category.catgroup",
      "tags": [],
      "columnConstraint": "NULL",
      "ordinalPosition": 2
    },
    {
      "name": "catname",
      "columnDataType": "VARCHAR",
      "fullyQualifiedName": "aws_redshift.public.category.catname",
      "tags": [],
      "columnConstraint": "NULL",
      "ordinalPosition": 3
    },
    {
      "name": "catdesc",
      "columnDataType": "VARCHAR",
      "fullyQualifiedName": "aws_redshift.public.category.catdesc",
      "tags": [],
      "columnConstraint": "NULL",
      "ordinalPosition": 4
    }
  ],
  "usageSummary": {
    "dailyStats": {
      "count": 0,
      "percentileRank": 0
    },
    "weeklyStats": {
      "count": 0,
      "percentileRank": 0
    },
    "monthlyStats": {
      "count": 0,
      "percentileRank": 0
    },
    "date": "2021-08-11"
  },
  "followers": [],
  "database": {
    "id": "654965e3-127a-475d-8ea1-783968da9c30",
    "type": "database",
    "name": "public",
    "description": " ",
    "href": "http://localhost:8585/api/v1/databases/654965e3-127a-475d-8ea1-783968da9c30"
  },
  "tags": [
    {
      "tagFQN": "Tier.Tier1",
      "labelType": "Manual",
      "state": "Confirmed"
    }
  ],
  "joins": {
    "startDate": "2021-07-12",
    "dayCount": 30,
    "columnJoins": []
  }
}

darth-coder00 avatar Aug 11 '21 13:08 darth-coder00

JSON patch:

[{"op":"replace","path":"/tags/0/tagFQN","value":"Tier.Tier3"}]

darth-coder00 avatar Aug 11 '21 13:08 darth-coder00

Response JSON:

{
  "id": "54a8f217-9674-453e-8639-fd2e31c70e9e",
  "name": "category",
  "href": "http://localhost:8585/api/v1/tables/54a8f217-9674-453e-8639-fd2e31c70e9e",
  "fullyQualifiedName": "aws_redshift.public.category",
  "columns": [
    {
      "name": "catid",
      "columnDataType": "INT",
      "fullyQualifiedName": "aws_redshift.public.category.catid",
      "tags": [],
      "columnConstraint": "NOT_NULL",
      "ordinalPosition": 1
    },
    {
      "name": "catgroup",
      "columnDataType": "VARCHAR",
      "fullyQualifiedName": "aws_redshift.public.category.catgroup",
      "tags": [],
      "columnConstraint": "NULL",
      "ordinalPosition": 2
    },
    {
      "name": "catname",
      "columnDataType": "VARCHAR",
      "fullyQualifiedName": "aws_redshift.public.category.catname",
      "tags": [],
      "columnConstraint": "NULL",
      "ordinalPosition": 3
    },
    {
      "name": "catdesc",
      "columnDataType": "VARCHAR",
      "fullyQualifiedName": "aws_redshift.public.category.catdesc",
      "tags": [],
      "columnConstraint": "NULL",
      "ordinalPosition": 4
    }
  ],
  "database": {
    "id": "654965e3-127a-475d-8ea1-783968da9c30",
    "type": "database",
    "name": "public",
    "description": " ",
    "href": "http://localhost:8585/api/v1/databases/654965e3-127a-475d-8ea1-783968da9c30"
  },
  "tags": [
    {
      "tagFQN": "Tier.Tier1",
      "labelType": "Manual",
      "state": "Confirmed"
    },
    {
      "tagFQN": "Tier.Tier3",
      "labelType": "Manual",
      "state": "Confirmed"
    }
  ]
}

darth-coder00 avatar Aug 11 '21 13:08 darth-coder00