Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEN-1434: Improvement : Show displayName for database and databaseSchema in explore tree #17876

Merged
merged 9 commits into from
Sep 26, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,14 @@ private static SearchSourceBuilder buildSearchAcrossIndexesBuilder(
AggregationBuilders.terms("databaseSchema.name.keyword")
.field("databaseSchema.name.keyword")
.size(MAX_AGGREGATE_SIZE));
searchSourceBuilder.aggregation(
AggregationBuilders.terms("database.displayName")
.field("database.displayName")
.size(MAX_AGGREGATE_SIZE));
searchSourceBuilder.aggregation(
AggregationBuilders.terms("databaseSchema.displayName")
.field("databaseSchema.displayName")
.size(MAX_AGGREGATE_SIZE));
return addAggregation(searchSourceBuilder);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,14 @@ private static SearchSourceBuilder buildSearchAcrossIndexesBuilder(
AggregationBuilders.terms("databaseSchema.name.keyword")
.field("databaseSchema.name.keyword")
.size(MAX_AGGREGATE_SIZE));
searchSourceBuilder.aggregation(
AggregationBuilders.terms("database.displayName")
.field("database.displayName")
.size(MAX_AGGREGATE_SIZE));
searchSourceBuilder.aggregation(
AggregationBuilders.terms("databaseSchema.displayName")
.field("databaseSchema.displayName")
.size(MAX_AGGREGATE_SIZE));
return addAggregation(searchSourceBuilder);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "text"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "keyword",
"normalizer": "lowercase_normalizer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
Expand Down Expand Up @@ -225,6 +226,7 @@
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "text"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "keyword",
"normalizer": "lowercase_normalizer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
Expand Down Expand Up @@ -231,6 +232,7 @@
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "text"
},
Expand Down Expand Up @@ -228,6 +238,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "text"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "text"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "keyword",
"normalizer": "lowercase_normalizer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
Expand Down Expand Up @@ -211,6 +212,7 @@
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "text"
},
Expand Down Expand Up @@ -204,6 +214,16 @@
}
}
},
"displayName": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase_normalizer",
"ignore_above": 256
}
}
},
"fullyQualifiedName": {
"type": "text"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,8 @@ test.describe('Advanced Search', { tag: '@advanced-search' }, () => {
tierTag2.responseData.fullyQualifiedName,
],
'service.displayName.keyword': [table1.service.name, table2.service.name],
'database.displayName.keyword': [
table1.database.name,
table2.database.name,
],
'databaseSchema.displayName.keyword': [
table1.schema.name,
table2.schema.name,
],
'database.displayName': [table1.database.name, table2.database.name],
'databaseSchema.displayName': [table1.schema.name, table2.schema.name],
aniketkatkar97 marked this conversation as resolved.
Show resolved Hide resolved
'columns.name.keyword': ['email', 'shop_id'],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
* limitations under the License.
*/
import test, { expect } from '@playwright/test';
import { get } from 'lodash';
import { SidebarItem } from '../../constant/sidebar';
import { redirectToHomePage } from '../../utils/common';
import { EntityTypeEndpoint } from '../../support/entity/Entity.interface';
import { TableClass } from '../../support/entity/TableClass';
import { getApiContext, redirectToHomePage } from '../../utils/common';
import { updateDisplayNameForEntity } from '../../utils/entity';
import { sidebarClick } from '../../utils/sidebar';

// use the admin user to login
Expand Down Expand Up @@ -107,4 +111,82 @@ test.describe('Explore Tree scenarios ', () => {
}
);
});

test('Verify Database and Database schema after rename', async ({ page }) => {
const { apiContext, afterAction } = await getApiContext(page);
const table = new TableClass();
await table.create(apiContext);
await table.visitEntityPage(page);
const schemaName = get(table.schemaResponseData, 'name', '');
const dbName = get(table.databaseResponseData, 'name', '');
const serviceName = get(table.serviceResponseData, 'name', '');
const updatedSchemaName = `Test ${schemaName} updated`;
const updatedDbName = `Test ${dbName} updated`;

const schemaRes = page.waitForResponse('/api/v1/databaseSchemas/name/*');
await page.getByRole('link', { name: schemaName }).click();
// Rename Schema Page
await schemaRes;
await updateDisplayNameForEntity(
page,
updatedSchemaName,
EntityTypeEndpoint.DatabaseSchema
);

const dbRes = page.waitForResponse('/api/v1/databases/name/*');
await page.getByRole('link', { name: dbName }).click();
// Rename Database Page
await dbRes;
await updateDisplayNameForEntity(
page,
updatedDbName,
EntityTypeEndpoint.Database
);

await sidebarClick(page, SidebarItem.EXPLORE);
await page.waitForLoadState('networkidle');
const serviceNameRes = page.waitForResponse(
'/api/v1/search/query?q=&index=database_search_index&from=0&size=0*mysql*'
);
await page
.locator('div')
.filter({ hasText: /^mysql$/ })
.locator('svg')
.first()
.click();
await serviceNameRes;

const databaseRes = page.waitForResponse(
'/api/v1/search/query?q=&index=dataAsset*serviceType*'
);

await page
.locator('.ant-tree-treenode')
.filter({ hasText: serviceName })
.locator('.ant-tree-switcher svg')
.click();
await databaseRes;

await expect(
page.getByTestId(`explore-tree-title-${updatedDbName}`)
).toBeVisible();

const databaseSchemaRes = page.waitForResponse(
'/api/v1/search/query?q=&index=dataAsset*database.displayName*'
);

await page
.locator('.ant-tree-treenode')
.filter({ hasText: updatedDbName })
.locator('.ant-tree-switcher svg')
.click();
await databaseSchemaRes;

await expect(
page.getByTestId(`explore-tree-title-${updatedSchemaName}`)
).toBeVisible();

await table.delete(apiContext);
await afterAction();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ export const FIELDS: EntityFields[] = [
},
{
id: 'Database',
name: 'database.displayName.keyword',
name: 'database.displayName',
localSearch: false,
},
{
id: 'Database Schema',
name: 'databaseSchema.displayName.keyword',
name: 'databaseSchema.displayName',
localSearch: false,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export enum EntityFields {
TAG = 'tags.tagFQN',
TIER = 'tier.tagFQN',
SERVICE = 'service.displayName.keyword',
DATABASE = 'database.name.keyword',
DATABASE_SCHEMA = 'databaseSchema.name.keyword',
DATABASE = 'database.displayName',
DATABASE_SCHEMA = 'databaseSchema.displayName',
COLUMN = 'columns.name.keyword',
CHART = 'charts.displayName.keyword',
TASK = 'tasks.displayName.keyword',
Expand Down
Loading
Loading