Merge pull request #347 from open-metadata/ISSUE-346

Fix #346: Add displayName to Chart and Dashboard entities and use the…
This commit is contained in:
Ayush Shah 2021-09-01 18:54:39 +05:30 committed by GitHub
commit 28e27972bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
79 changed files with 207 additions and 132 deletions

View File

@ -147,6 +147,11 @@ public abstract class ChartRepository {
if (storedDB.getDescription() == null || storedDB.getDescription().isEmpty()) {
storedDB.withDescription(updatedChart.getDescription());
}
//update the display name from source
if (updatedChart.getDisplayName() != null && !updatedChart.getDisplayName().isEmpty()) {
storedDB.withDisplayName(updatedChart.getDisplayName());
}
chartDAO().update(storedDB.getId().toString(), JsonUtils.pojoToJson(storedDB));
// Update owner relationship

View File

@ -138,6 +138,11 @@ public abstract class DashboardRepository {
if (storedDashboard.getDescription() == null || storedDashboard.getDescription().isEmpty()) {
storedDashboard.withDescription(updatedDashboard.getDescription());
}
//update the display name from source
if (updatedDashboard.getDisplayName() != null && !updatedDashboard.getDisplayName().isEmpty()) {
storedDashboard.withDisplayName(updatedDashboard.getDisplayName());
}
dashboardDAO().update(storedDashboard.getId().toString(), JsonUtils.pojoToJson(storedDashboard));
// Update owner relationship
@ -198,6 +203,7 @@ public abstract class DashboardRepository {
}
private Dashboard setFields(Dashboard dashboard, Fields fields) throws IOException {
dashboard.setDisplayName(dashboard.getDisplayName());
dashboard.setOwner(fields.contains("owner") ? getOwner(dashboard) : null);
dashboard.setService(fields.contains("service") ? getService(dashboard) : null);
dashboard.setFollowers(fields.contains("followers") ? getFollowers(dashboard) : null);

View File

@ -237,8 +237,9 @@ public class ChartResource {
@Valid CreateChart create) throws IOException {
SecurityUtil.checkAdminOrBotRole(authorizer, securityContext);
Chart chart =
new Chart().withId(UUID.randomUUID()).withName(create.getName()).withDescription(create.getDescription())
.withService(create.getService()).withChartId(create.getChartId())
new Chart().withId(UUID.randomUUID()).withName(create.getName()).withDisplayName(create.getDisplayName())
.withDescription(create.getDescription())
.withService(create.getService())
.withChartType(create.getChartType()).withChartUrl(create.getChartUrl())
.withTables(create.getTables()).withTags(create.getTags())
.withOwner(create.getOwner());
@ -284,8 +285,9 @@ public class ChartResource {
@Valid CreateChart create) throws IOException {
Chart chart =
new Chart().withId(UUID.randomUUID()).withName(create.getName()).withDescription(create.getDescription())
.withService(create.getService()).withChartId(create.getChartId())
new Chart().withId(UUID.randomUUID()).withName(create.getName()).withDisplayName(create.getDisplayName())
.withDescription(create.getDescription())
.withService(create.getService())
.withChartType(create.getChartType()).withChartUrl(create.getChartUrl())
.withTables(create.getTables()).withTags(create.getTags())
.withOwner(create.getOwner());

View File

@ -242,6 +242,7 @@ public class DashboardResource {
@Valid CreateDashboard create) throws IOException {
SecurityUtil.checkAdminOrBotRole(authorizer, securityContext);
Dashboard dashboard = new Dashboard().withId(UUID.randomUUID()).withName(create.getName())
.withDisplayName(create.getDisplayName())
.withDescription(create.getDescription()).withService(create.getService()).withCharts(create.getCharts())
.withDashboardUrl(create.getDashboardUrl()).withTags(create.getTags())
.withOwner(create.getOwner());
@ -287,6 +288,7 @@ public class DashboardResource {
@Context SecurityContext securityContext,
@Valid CreateDashboard create) throws IOException {
Dashboard dashboard = new Dashboard().withId(UUID.randomUUID()).withName(create.getName())
.withDisplayName(create.getDisplayName())
.withDescription(create.getDescription()).withService(create.getService()).withCharts(create.getCharts())
.withDashboardUrl(create.getDashboardUrl()).withTags(create.getTags())
.withOwner(create.getOwner());

View File

@ -11,12 +11,12 @@
"minLength": 1,
"maxLength": 64
},
"description": {
"description": "Description of the database instance. What it has and how to use it.",
"displayName": {
"description": "Display Name that identifies this Chart. It could be title or label from the source services",
"type": "string"
},
"chartId": {
"description": "Unique Identifier of the Chart from the Source Service.",
"description": {
"description": "Description of the database instance. What it has and how to use it.",
"type": "string"
},
"chartType": {

View File

@ -11,6 +11,10 @@
"minLength": 1,
"maxLength": 64
},
"displayName": {
"description": "Display Name that identifies this Dashboard. It could be title or label from the source services",
"type": "string"
},
"description": {
"description": "Description of the database instance. What it has and how to use it.",
"type": "string"

View File

@ -66,6 +66,10 @@
"minLength": 1,
"maxLength": 64
},
"displayName": {
"description": "Display Name that identifies this Chart. It could be title or label from the source services",
"type": "string"
},
"fullyQualifiedName": {
"description": "A unique name that identifies a dashboard in the format 'ServiceName.ChartName'.",
"type": "string",
@ -76,10 +80,6 @@
"description": "Description of the dashboard, what it is, and how to use it.",
"type": "string"
},
"chartId": {
"description": "Unique Identifier of the Chart from the Source Service.",
"type": "string"
},
"chartType": {
"$ref": "#/definitions/chartType"
},

View File

@ -16,6 +16,10 @@
"minLength": 1,
"maxLength": 64
},
"displayName": {
"description": "Display Name that identifies this Dashboard. It could be title or label from the source services",
"type": "string"
},
"fullyQualifiedName": {
"description": "A unique name that identifies a dashboard in the format 'ServiceName.DashboardName'.",
"type": "string",

View File

@ -145,7 +145,7 @@ public class ChartResourceTest extends CatalogApplicationTest {
@Test
public void post_chartWithTeamOwner_200_ok(TestInfo test) throws HttpResponseException {
createAndCheckChart(create(test).withOwner(TEAM_OWNER1), adminAuthHeaders());
createAndCheckChart(create(test).withOwner(TEAM_OWNER1).withDisplayName("chart1"), adminAuthHeaders());
}
@Test
@ -159,7 +159,7 @@ public class ChartResourceTest extends CatalogApplicationTest {
@Test
public void post_chartWithoutRequiredFields_4xx(TestInfo test) {
HttpResponseException exception = assertThrows(HttpResponseException.class, () ->
createChart(create(test).withName(null).withChartId("0"), adminAuthHeaders()));
createChart(create(test).withName(null), adminAuthHeaders()));
assertResponse(exception, BAD_REQUEST, "[name must not be null]");
exception = assertThrows(HttpResponseException.class, () ->
@ -330,8 +330,10 @@ public class ChartResourceTest extends CatalogApplicationTest {
createAndCheckChart(request, adminAuthHeaders());
// Update null description with a new description
Chart chart = updateAndCheckChart(request.withDescription("newDescription"), OK, adminAuthHeaders());
Chart chart = updateAndCheckChart(request.withDescription("newDescription").withDisplayName("newChart")
, OK, adminAuthHeaders());
assertEquals("newDescription", chart.getDescription());
assertEquals("newChart", chart.getDisplayName());
}
@Test
@ -531,7 +533,8 @@ public class ChartResourceTest extends CatalogApplicationTest {
public static Chart createAndCheckChart(CreateChart create,
Map<String, String> authHeaders) throws HttpResponseException {
Chart chart = createChart(create, authHeaders);
validateChart(chart, create.getDescription(), create.getOwner(), create.getService(), create.getTags());
validateChart(chart, chart.getDisplayName(), create.getDescription(), create.getOwner(), create.getService(),
create.getTags());
return getAndValidate(chart.getId(), create, authHeaders);
}
@ -596,6 +599,14 @@ public class ChartResourceTest extends CatalogApplicationTest {
assertNotNull(chart.getService());
}
private static Chart validateChart(Chart chart, String expectedDisplayName, String expectedDescription,
EntityReference expectedOwner, EntityReference expectedService,
List<TagLabel> expectedTags) throws HttpResponseException {
Chart newChart = validateChart(chart, expectedDescription, expectedOwner, expectedService, expectedTags);
assertEquals(expectedDisplayName, newChart.getDisplayName());
return chart;
}
private static Chart validateChart(Chart chart, String expectedDescription, EntityReference expectedOwner,
EntityReference expectedService, List<TagLabel> expectedTags)
throws HttpResponseException {

View File

@ -152,7 +152,7 @@ public class DashboardResourceTest extends CatalogApplicationTest {
@Test
public void post_DashboardWithTeamOwner_200_ok(TestInfo test) throws HttpResponseException {
createAndCheckDashboard(create(test).withOwner(TEAM_OWNER1), adminAuthHeaders());
createAndCheckDashboard(create(test).withOwner(TEAM_OWNER1).withDisplayName("Dashboard1"), adminAuthHeaders());
}
@Test
@ -333,8 +333,10 @@ public class DashboardResourceTest extends CatalogApplicationTest {
createAndCheckDashboard(request, adminAuthHeaders());
// Update null description with a new description
Dashboard db = updateAndCheckDashboard(request.withDescription("newDescription"), OK, adminAuthHeaders());
Dashboard db = updateAndCheckDashboard(request.withDisplayName("dashboard1").
withDescription("newDescription"), OK, adminAuthHeaders());
assertEquals("newDescription", db.getDescription());
assertEquals("dashboard1", db.getDisplayName());
}
@Test
@ -530,7 +532,8 @@ public class DashboardResourceTest extends CatalogApplicationTest {
public static Dashboard createAndCheckDashboard(CreateDashboard create,
Map<String, String> authHeaders) throws HttpResponseException {
Dashboard dashboard = createDashboard(create, authHeaders);
validateDashboard(dashboard, create.getDescription(), create.getOwner(), create.getService());
validateDashboard(dashboard, create.getDisplayName(),
create.getDescription(), create.getOwner(), create.getService());
return getAndValidate(dashboard.getId(), create, authHeaders);
}
@ -608,7 +611,14 @@ public class DashboardResourceTest extends CatalogApplicationTest {
}
private static Dashboard validateDashboard(Dashboard dashboard, String expectedDescription,
private static Dashboard validateDashboard(Dashboard dashboard, String expectedDisplayName,
String expectedDescription,
EntityReference expectedOwner, EntityReference expectedService) {
Dashboard newDashboard = validateDashboard(dashboard, expectedDescription, expectedOwner, expectedService);
assertEquals(expectedDisplayName, newDashboard.getDisplayName());
return newDashboard;
}
private static Dashboard validateDashboard(Dashboard dashboard, String expectedDescription,
EntityReference expectedOwner, EntityReference expectedService) {
assertNotNull(dashboard.getId());
assertNotNull(dashboard.getHref());

View File

@ -2,7 +2,8 @@
"charts": [
{
"id": "2841fdb1-e378-4a2c-94f8-27c9f5d6ef8e",
"name": "# of Games That Hit 100k in Sales By Release Year",
"name": "101",
"displayName": "# of Games That Hit 100k in Sales By Release Year",
"fullyQualifiedName": "local_superset.# of Games That Hit 100k in Sales By Release Year",
"description": "",
"chartId": "114",
@ -11,7 +12,8 @@
"href": "http://localhost:8585/api/v1/charts/2841fdb1-e378-4a2c-94f8-27c9f5d6ef8e"
}, {
"id": "3bcba490-9e5c-4946-a0e3-41e8ff8f4aa4",
"name": "% Rural",
"name":"110",
"displayName": "% Rural",
"fullyQualifiedName": "local_superset.% Rural",
"description": "",
"chartId": "166",
@ -20,8 +22,8 @@
"href": "http://localhost:8585/api/v1/charts/3bcba490-9e5c-4946-a0e3-41e8ff8f4aa4"
}, {
"id": "22b95748-4a7b-48ad-859e-cf7c66a7f343",
"name": "✈️ Relocation ability",
"fullyQualifiedName": "local_superset.✈️ Relocation ability",
"name": "92",
"displayName": "✈️ Relocation ability",
"description": "",
"chartId": "92",
"chartType": "Other",
@ -29,7 +31,8 @@
"href": "http://localhost:8585/api/v1/charts/22b95748-4a7b-48ad-859e-cf7c66a7f343"
}, {
"id": "62b31dcc-4619-46a0-99b1-0fa7cd6f93da",
"name": "Age distribution of respondents",
"name": "11y",
"displayName": "Age distribution of respondents",
"fullyQualifiedName": "local_superset.Age distribution of respondents",
"description": "",
"chartId": "117",
@ -38,55 +41,55 @@
"href": "http://localhost:8585/api/v1/charts/62b31dcc-4619-46a0-99b1-0fa7cd6f93da"
}, {
"id": "57944482-e187-439a-aaae-0e8aabd2f455",
"name": "Arcs",
"displayName": "Arcs",
"fullyQualifiedName": "local_superset.Arcs",
"description": "",
"chartId": "197",
"name": "197",
"chartType": "Other",
"chartUrl": "http://localhost:8088/superset/explore/?form_data=%7B%22slice_id%22%3A%20197%7D",
"href": "http://localhost:8585/api/v1/charts/57944482-e187-439a-aaae-0e8aabd2f455"
}, {
"id": "d88e2056-c74a-410d-829e-eb31b040c132",
"name": "Are you an ethnic minority in your city?",
"displayName": "Are you an ethnic minority in your city?",
"fullyQualifiedName": "local_superset.Are you an ethnic minority in your city?",
"description": "",
"chartId": "127",
"name": "127",
"chartType": "Other",
"chartUrl": "http://localhost:8088/superset/explore/?form_data=%7B%22slice_id%22%3A%20127%7D",
"href": "http://localhost:8585/api/v1/charts/d88e2056-c74a-410d-829e-eb31b040c132"
}, {
"id": "c1d3e156-4628-414e-8d6e-a6bdd486128f",
"name": "Average and Sum Trends",
"displayName": "Average and Sum Trends",
"fullyQualifiedName": "local_superset.Average and Sum Trends",
"description": "",
"chartId": "183",
"name": "183",
"chartType": "Line",
"chartUrl": "http://localhost:8088/superset/explore/?form_data=%7B%22slice_id%22%3A%20183%7D",
"href": "http://localhost:8585/api/v1/charts/c1d3e156-4628-414e-8d6e-a6bdd486128f"
}, {
"id": "bfc57519-8cef-47e6-a423-375d5b89a6a4",
"name": "Birth in France by department in 2016",
"displayName": "Birth in France by department in 2016",
"fullyQualifiedName": "local_superset.Birth in France by department in 2016",
"description": "",
"chartId": "161",
"name": "161",
"chartType": "Other",
"chartUrl": "http://localhost:8088/superset/explore/?form_data=%7B%22slice_id%22%3A%20161%7D",
"href": "http://localhost:8585/api/v1/charts/bfc57519-8cef-47e6-a423-375d5b89a6a4"
}, {
"id": "bf2eeac4-7226-46c6-bbef-918569c137a0",
"name": "Box plot",
"displayName": "Box plot",
"fullyQualifiedName": "local_superset.Box plot",
"description": "",
"chartId": "170",
"name": "170",
"chartType": "Bar",
"chartUrl": "http://localhost:8088/superset/explore/?form_data=%7B%22slice_id%22%3A%20170%7D",
"href": "http://localhost:8585/api/v1/charts/bf2eeac4-7226-46c6-bbef-918569c137a0"
}, {
"id": "167fd63b-42f1-4d7e-a37d-893fd8173b44",
"name": "Boy Name Cloud",
"displayName": "Boy Name Cloud",
"fullyQualifiedName": "local_superset.Boy Name Cloud",
"description": "",
"chartId": "180",
"name": "180",
"chartType": "Other",
"chartUrl": "http://localhost:8088/superset/explore/?form_data=%7B%22slice_id%22%3A%20180%7D",
"href": "http://localhost:8585/api/v1/charts/167fd63b-42f1-4d7e-a37d-893fd8173b44"

View File

@ -2,7 +2,8 @@
"dashboards": [
{
"id": "d4dc7baf-1b17-45f8-acd5-a15b78cc7c5f",
"name": "[ untitled dashboard ]",
"name": "8",
"displayName": "[ untitled dashboard ]",
"fullyQualifiedName": "local_superset.[ untitled dashboard ]",
"description": "",
"dashboardUrl": "http://localhost:808/superset/dashboard/1/",
@ -11,7 +12,8 @@
},
{
"id": "063cd787-8630-4809-9702-34d3992c7248",
"name": "COVID Vaccine Dashboard",
"name": "9",
"displayName": "COVID Vaccine Dashboard",
"fullyQualifiedName": "local_superset.COVID Vaccine Dashboard",
"description": "",
"dashboardUrl": "http://localhost:808/superset/dashboard/8/",
@ -20,7 +22,8 @@
},
{
"id": "df6c698e-066a-4440-be0a-121025573b73",
"name": "deck.gl Demo",
"name": "10",
"displayName": "deck.gl Demo",
"fullyQualifiedName": "local_superset.deck.gl Demo",
"description": "",
"dashboardUrl": "http://localhost:808/superset/dashboard/deck/",
@ -29,7 +32,8 @@
},
{
"id": "98b38a49-b5c6-431b-b61f-690e39f8ead2",
"name": "FCC New Coder Survey 2018",
"name": "11",
"displayName": "FCC New Coder Survey 2018",
"fullyQualifiedName": "local_superset.FCC New Coder Survey 2018",
"description": "",
"dashboardUrl": "http://localhost:808/superset/dashboard/7/",
@ -38,7 +42,8 @@
},
{
"id": "dffcf9b2-4f43-4881-a5f5-10109655bf50",
"name": "Misc Charts",
"name": "12",
"displayName": "Misc Charts",
"fullyQualifiedName": "local_superset.Misc Charts",
"description": "",
"dashboardUrl": "http://localhost:808/superset/dashboard/misc_charts/",
@ -47,7 +52,8 @@
},
{
"id": "2583737d-6236-421e-ba0f-cd0b79adb216",
"name": "Sales Dashboard",
"name": "31",
"displayName": "Sales Dashboard",
"fullyQualifiedName": "local_superset.Sales Dashboard",
"description": "",
"dashboardUrl": "http://localhost:808/superset/dashboard/6/",
@ -56,7 +62,8 @@
},
{
"id": "6bf9bfcb-4e80-4af0-9f0c-13e47bbc27a2",
"name": "Slack Dashboard",
"name": "33",
"displayName": "Slack Dashboard",
"fullyQualifiedName": "local_superset.Slack Dashboard",
"description": "",
"dashboardUrl": "http://localhost:808/superset/dashboard/10/",
@ -65,7 +72,8 @@
},
{
"id": "1f02caf2-c5e5-442d-bda3-b8ce3e757b45",
"name": "Unicode Test",
"name": "34",
"displayName": "Unicode Test",
"fullyQualifiedName": "local_superset.Unicode Test",
"description": "",
"dashboardUrl": "http://localhost:808/superset/dashboard/unicode-test/",
@ -74,7 +82,8 @@
},
{
"id": "a3ace318-ee37-4da1-974a-62eddbd77d20",
"name": "USA Births Names",
"name": "45",
"displayName": "USA Births Names",
"fullyQualifiedName": "local_superset.USA Births Names",
"description": "",
"dashboardUrl": "http://localhost:808/superset/dashboard/births/",
@ -83,7 +92,8 @@
},
{
"id": "e6e21717-1164-403f-8807-d12be277aec6",
"name": "Video Game Sales",
"name": "51",
"displayName": "Video Game Sales",
"fullyQualifiedName": "local_superset.Video Game Sales",
"description": "",
"dashboardUrl": "http://localhost:808/superset/dashboard/11/",

View File

@ -1,3 +1,3 @@
# generated by datamodel-codegen:
# filename: json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: data/tags/personalDataTags.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: data/tags/piiTags.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: data/tags/tierTags.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: data/tags/userTags.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,3 +1,3 @@
# generated by datamodel-codegen:
# filename: json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/api/catalogVersion.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,3 +1,3 @@
# generated by datamodel-codegen:
# filename: json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/api/data/createChart.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations
@ -16,6 +16,10 @@ class CreateChartEntityRequest(BaseModel):
name: constr(min_length=1, max_length=64) = Field(
..., description='Name that identifies this dashboard.'
)
displayName: Optional[str] = Field(
None,
description='Display Name that identifies this Chart. It could be title or label from the source services',
)
description: Optional[str] = Field(
None,
description='Description of the database instance. What it has and how to use it.',

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/api/data/createDashboard.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations
@ -15,6 +15,10 @@ class CreateDashboardEntityRequest(BaseModel):
name: constr(min_length=1, max_length=64) = Field(
..., description='Name that identifies this dashboard.'
)
displayName: Optional[str] = Field(
None,
description='Display Name that identifies this Dashboard. It could be title or label from the source services',
)
description: Optional[str] = Field(
None,
description='Description of the database instance. What it has and how to use it.',

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/api/data/createDatabase.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/api/data/createTable.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/api/data/createTopic.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,3 +1,3 @@
# generated by datamodel-codegen:
# filename: json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/api/feed/createThread.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,3 +1,3 @@
# generated by datamodel-codegen:
# filename: json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/api/services/createDashboardService.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/api/services/createDatabaseService.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/api/services/createMessagingService.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/api/services/updateDashboardService.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/api/services/updateDatabaseService.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/api/services/updateMessagingService.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/api/setOwner.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,3 +1,3 @@
# generated by datamodel-codegen:
# filename: json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/api/tags/createTag.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/api/tags/createTagCategory.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,3 +1,3 @@
# generated by datamodel-codegen:
# filename: json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/api/teams/createTeam.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/api/teams/createUser.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,3 +1,3 @@
# generated by datamodel-codegen:
# filename: json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/entity/bots.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,3 +1,3 @@
# generated by datamodel-codegen:
# filename: json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/entity/data/chart.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations
@ -32,6 +32,10 @@ class Chart(BaseModel):
name: constr(min_length=1, max_length=64) = Field(
..., description='Name that identifies this Chart.'
)
displayName: Optional[str] = Field(
None,
description='Display Name that identifies this Chart. It could be title or label from the source services',
)
fullyQualifiedName: Optional[constr(min_length=1, max_length=64)] = Field(
None,
description="A unique name that identifies a dashboard in the format 'ServiceName.ChartName'.",
@ -39,9 +43,6 @@ class Chart(BaseModel):
description: Optional[str] = Field(
None, description='Description of the dashboard, what it is, and how to use it.'
)
chartId: Optional[str] = Field(
None, description='Unique Identifier of the Chart from the Source Service.'
)
chartType: Optional[ChartType] = None
chartUrl: Optional[AnyUrl] = Field(
None, description='Chart URL, pointing to its own Service URL'

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/entity/data/dashboard.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations
@ -18,6 +18,10 @@ class Dashboard(BaseModel):
name: constr(min_length=1, max_length=64) = Field(
..., description='Name that identifies this dashboard.'
)
displayName: Optional[str] = Field(
None,
description='Display Name that identifies this Dashboard. It could be title or label from the source services',
)
fullyQualifiedName: Optional[constr(min_length=1, max_length=64)] = Field(
None,
description="A unique name that identifies a dashboard in the format 'ServiceName.DashboardName'.",

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/entity/data/database.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/entity/data/metrics.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/entity/data/pipeline.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/entity/data/report.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/entity/data/table.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/entity/data/topic.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,3 +1,3 @@
# generated by datamodel-codegen:
# filename: json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/entity/feed/thread.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,3 +1,3 @@
# generated by datamodel-codegen:
# filename: json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/entity/services/dashboardService.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/entity/services/databaseService.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/entity/services/messagingService.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,3 +1,3 @@
# generated by datamodel-codegen:
# filename: json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/entity/tags/tagCategory.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,3 +1,3 @@
# generated by datamodel-codegen:
# filename: json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/entity/teams/team.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/entity/teams/user.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,3 +1,3 @@
# generated by datamodel-codegen:
# filename: json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/type/auditLog.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/type/basic.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/type/collectionDescriptor.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/type/dailyCount.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/type/entityReference.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/type/entityUsage.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/type/jdbcConnection.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/type/profile.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/type/schedule.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/type/tagLabel.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema/type/usageDetails.json
# timestamp: 2021-08-28T03:07:16+00:00
# timestamp: 2021-09-01T06:44:13+00:00
from __future__ import annotations

View File

@ -219,7 +219,7 @@ class DashboardOwner(BaseModel):
class Chart(BaseModel):
"""Chart"""
name: str
chart_id: str
displayName:str
description: str
chart_type: str
url: str
@ -233,9 +233,10 @@ class Chart(BaseModel):
class Dashboard(BaseModel):
"""Dashboard"""
name: str
displayName: str
description: str
url: str
owners: List = None
charts: List
owners: List[DashboardOwner] = None
charts: List[str]
service: EntityReference
lastModified: int = None

View File

@ -87,23 +87,23 @@ class MetadataRestDashboardsSink(Sink):
chart_request = CreateChartEntityRequest(
name=chart.name,
displayName=chart.displayName,
description=chart.description,
chartId=chart.chart_id,
chartType=om_chart_type,
chartUrl=chart.url,
service=chart.service
)
created_chart = self.client.create_or_update_chart(chart_request)
self.charts_dict[chart.chart_id] = EntityReference(id=created_chart.id, type='chart')
self.charts_dict[chart.name] = EntityReference(id=created_chart.id, type='chart')
logger.info(
'Successfully ingested {}'.format(created_chart.name))
'Successfully ingested {}'.format(created_chart.displayName))
self.status.records_written(
'{}'.format(created_chart.name))
'{}'.format(created_chart.displayName))
except (APIError, ValidationError) as err:
logger.error(
"Failed to ingest chart {}".format(chart.name))
"Failed to ingest chart {}".format(chart.displayName))
logger.error(err)
self.status.failure(chart.name)
self.status.failure(chart.displayName)
def _ingest_dashboards(self, dashboard: Dashboard):
try:
@ -111,14 +111,15 @@ class MetadataRestDashboardsSink(Sink):
dashboard_request = CreateDashboardEntityRequest(
name=dashboard.name,
displayName=dashboard.displayName,
description=dashboard.description,
dashboardUrl=dashboard.url,
charts=charts,
service=dashboard.service
)
created_dashboard = self.client.create_or_update_dashboard(dashboard_request)
logger.info('Successfully ingested {}'.format(created_dashboard.name))
self.status.records_written('{}'.format(created_dashboard.name))
logger.info('Successfully ingested {}'.format(created_dashboard.displayName))
self.status.records_written('{}'.format(created_dashboard.displayName))
except (APIError, ValidationError) as err:
logger.error("Failed to ingest chart {}".format(dashboard.name))
logger.error(err)

View File

@ -86,11 +86,11 @@ class SampleDashboardsSource(Source):
for chart in self.charts['charts']:
try:
chart_ev = Chart(name=chart['name'],
description=chart['description'],
chart_id=chart['chartId'],
chart_type=chart['chartType'],
url=chart['chartUrl'],
service=EntityReference(id=self.service.id, type="dashboardService"))
displayName=chart['displayName'],
description=chart['description'],
chart_type=chart['chartType'],
url=chart['chartUrl'],
service=EntityReference(id=self.service.id, type="dashboardService"))
yield chart_ev
except ValidationError as err:
logger.error(err)
@ -98,6 +98,7 @@ class SampleDashboardsSource(Source):
for dashboard in self.dashboards['dashboards']:
dashboard_ev = Dashboard(name=dashboard['name'],
displayName=dashboard['displayName'],
description=dashboard['description'],
url=dashboard['dashboardUrl'],
charts=dashboard['charts'],

View File

@ -111,6 +111,7 @@ class SupersetSource(Source):
yield from self._fetch_dashboards()
def _build_dashboard(self, dashboard_json) -> Dashboard:
dashboard_id = dashboard_json['id']
name = dashboard_json['dashboard_title']
dashboard_url = f"{self.config.url[:-1]}{dashboard_json['url']}"
last_modified = dateparser.parse(dashboard_json.get("changed_on_utc", "now")).timestamp() * 1000
@ -125,7 +126,8 @@ class SupersetSource(Source):
chart_id = value.get('meta', {}).get('chartId', 'unknown')
charts.append(chart_id)
return Dashboard(name=name,
return Dashboard(name=dashboard_id,
displayName=name,
description="",
url=dashboard_url,
owners=owners,
@ -195,9 +197,9 @@ class SupersetSource(Source):
"Dimensions": ", ".join(group_bys),
}
chart = Chart(name=name,
chart = Chart(name=chart_id,
displayName=name,
description="",
chart_id=chart_id,
chart_type=chart_type,
url=chart_url,
owners=owners,