mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-12-01 01:56:04 +00:00
fix: add field label as displayName for table and columns (#23993)
This commit is contained in:
parent
be8d9c6a4b
commit
ba5f8e5bf6
@ -206,9 +206,7 @@ class SalesforceSource(DatabaseServiceSource):
|
||||
)
|
||||
)
|
||||
|
||||
def get_table_description(
|
||||
self, table_name: str, object_label: Optional[str]
|
||||
) -> Optional[str]:
|
||||
def get_table_description(self, table_name: str) -> Optional[str]:
|
||||
"""
|
||||
Method to get the table description for salesforce with Tooling API
|
||||
"""
|
||||
@ -231,7 +229,7 @@ class SalesforceSource(DatabaseServiceSource):
|
||||
logger.warning(
|
||||
f"Unable to get description with Tooling API for table [{table_name}]: {exc}"
|
||||
)
|
||||
return table_description if table_description else object_label
|
||||
return table_description
|
||||
|
||||
def get_table_column_description(self, table_name: str) -> Optional[List]:
|
||||
"""
|
||||
@ -273,10 +271,9 @@ class SalesforceSource(DatabaseServiceSource):
|
||||
columns = self.get_columns(table_name, salesforce_objects.get("fields", []))
|
||||
table_request = CreateTableRequest(
|
||||
name=EntityName(table_name),
|
||||
displayName=salesforce_objects.get("label"),
|
||||
tableType=table_type,
|
||||
description=self.get_table_description(
|
||||
table_name, salesforce_objects.get("label")
|
||||
),
|
||||
description=self.get_table_description(table_name),
|
||||
columns=columns,
|
||||
tableConstraints=table_constraints,
|
||||
databaseSchema=FullyQualifiedEntityName(
|
||||
@ -331,14 +328,13 @@ class SalesforceSource(DatabaseServiceSource):
|
||||
col_constraint = Constraint.NOT_NULL
|
||||
if column["unique"]:
|
||||
col_constraint = Constraint.UNIQUE
|
||||
if column_description_mapping.get(column["name"]):
|
||||
column_description = column_description_mapping[column["name"]]
|
||||
else:
|
||||
column_description = column["label"]
|
||||
|
||||
column_description = column_description_mapping.get(column["name"])
|
||||
|
||||
columns.append(
|
||||
Column(
|
||||
name=column["name"],
|
||||
displayName=column["label"],
|
||||
description=column_description,
|
||||
dataType=self.column_type(column["type"].upper()),
|
||||
dataTypeDisplay=column["type"],
|
||||
|
||||
@ -106,7 +106,7 @@ MOCK_DATABASE_SCHEMA = DatabaseSchema(
|
||||
EXPECTED_COLUMN_VALUE = [
|
||||
Column(
|
||||
name=ColumnName("Description"),
|
||||
displayName=None,
|
||||
displayName="Contact Label",
|
||||
dataType=DataType.VARCHAR,
|
||||
arrayDataType=None,
|
||||
dataLength=32000,
|
||||
@ -125,14 +125,14 @@ EXPECTED_COLUMN_VALUE = [
|
||||
),
|
||||
Column(
|
||||
name=ColumnName("OwnerId"),
|
||||
displayName=None,
|
||||
displayName="Owner ID",
|
||||
dataType=DataType.VARCHAR,
|
||||
arrayDataType=None,
|
||||
dataLength=18,
|
||||
precision=None,
|
||||
scale=None,
|
||||
dataTypeDisplay="reference",
|
||||
description="Owner ID",
|
||||
description=None,
|
||||
fullyQualifiedName=None,
|
||||
tags=[],
|
||||
constraint=Constraint.NOT_NULL,
|
||||
@ -144,14 +144,14 @@ EXPECTED_COLUMN_VALUE = [
|
||||
),
|
||||
Column(
|
||||
name=ColumnName("Phone"),
|
||||
displayName=None,
|
||||
displayName="Phone",
|
||||
dataType=DataType.VARCHAR,
|
||||
arrayDataType=None,
|
||||
dataLength=0,
|
||||
precision=None,
|
||||
scale=None,
|
||||
dataTypeDisplay="phone",
|
||||
description="Phone",
|
||||
description=None,
|
||||
fullyQualifiedName=None,
|
||||
tags=[],
|
||||
constraint=Constraint.NOT_NULL,
|
||||
@ -163,14 +163,14 @@ EXPECTED_COLUMN_VALUE = [
|
||||
),
|
||||
Column(
|
||||
name=ColumnName("CreatedById"),
|
||||
displayName=None,
|
||||
displayName="Created By ID",
|
||||
dataType=DataType.UNKNOWN,
|
||||
arrayDataType=None,
|
||||
dataLength=18,
|
||||
precision=None,
|
||||
scale=None,
|
||||
dataTypeDisplay="anytype",
|
||||
description="Created By ID",
|
||||
description=None,
|
||||
fullyQualifiedName=None,
|
||||
tags=[],
|
||||
constraint=Constraint.NOT_NULL,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user