diff --git a/metadata-ingestion/src/datahub/ingestion/source/salesforce.py b/metadata-ingestion/src/datahub/ingestion/source/salesforce.py index 6d52646f85d0a7..35af541c9e5326 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/salesforce.py +++ b/metadata-ingestion/src/datahub/ingestion/source/salesforce.py @@ -573,10 +573,15 @@ def _get_schema_field( fieldTags: List[str] = self.get_field_tags(fieldName, field) + description = self._get_field_description(field, customField) + + # escaping string starting with `#` + description = "\\" + description if description.startswith("#") else description + schemaField = SchemaFieldClass( fieldPath=fieldPath, type=SchemaFieldDataTypeClass(type=TypeClass()), # type:ignore - description=self._get_field_description(field, customField), + description=description, # nativeDataType is set to data type shown on salesforce user interface, # not the corresponding API data type names. nativeDataType=field["FieldDefinition"]["DataType"], diff --git a/metadata-ingestion/tests/integration/salesforce/mock_files/account_fields_soql_response.json b/metadata-ingestion/tests/integration/salesforce/mock_files/account_fields_soql_response.json index 947761b8c79a0f..138c5743235888 100644 --- a/metadata-ingestion/tests/integration/salesforce/mock_files/account_fields_soql_response.json +++ b/metadata-ingestion/tests/integration/salesforce/mock_files/account_fields_soql_response.json @@ -2508,6 +2508,74 @@ }, "RelationshipName": null, "IsNillable": true + }, + { + "attributes": { + "type": "EntityParticle", + "url": "/services/data/v54.0/tooling/sobjects/EntityParticle/Account.Unique_Account" + }, + "QualifiedApiName": "Unique_Account", + "DeveloperName": "Unique_Account", + "Label": "# Unique_Account", + "FieldDefinition": { + "attributes": { + "type": "FieldDefinition", + "url": "/services/data/v54.0/tooling/sobjects/FieldDefinition/Account.Unique_Account" + }, + "DataType": "Text(80)", + "LastModifiedDate": null, + "LastModifiedBy": null, + "IsIndexed": false, + "ComplianceGroup": null, + "SecurityClassification": null + }, + "DataType": "string", + "Precision": 0, + "Scale": 0, + "Length": 80, + "Digits": 0, + "IsUnique": false, + "IsCompound": false, + "IsComponent": false, + "ReferenceTo": { + "referenceTo": null + }, + "RelationshipName": null, + "IsNillable": true + }, + { + "attributes": { + "type": "EntityParticle", + "url": "/services/data/v54.0/tooling/sobjects/EntityParticle/Account.Unique_Number" + }, + "QualifiedApiName": "Unique_Number", + "DeveloperName": "Unique_Account", + "Label": "#Unique_Number", + "FieldDefinition": { + "attributes": { + "type": "FieldDefinition", + "url": "/services/data/v54.0/tooling/sobjects/FieldDefinition/Account.Unique_Number" + }, + "DataType": "Text(80)", + "LastModifiedDate": null, + "LastModifiedBy": null, + "IsIndexed": false, + "ComplianceGroup": null, + "SecurityClassification": null + }, + "DataType": "string", + "Precision": 0, + "Scale": 0, + "Length": 80, + "Digits": 0, + "IsUnique": false, + "IsCompound": false, + "IsComponent": false, + "ReferenceTo": { + "referenceTo": null + }, + "RelationshipName": null, + "IsNillable": true } ] } \ No newline at end of file diff --git a/metadata-ingestion/tests/integration/salesforce/salesforce_mces_golden.json b/metadata-ingestion/tests/integration/salesforce/salesforce_mces_golden.json index 4e54f199eafed4..90df0997495f03 100644 --- a/metadata-ingestion/tests/integration/salesforce/salesforce_mces_golden.json +++ b/metadata-ingestion/tests/integration/salesforce/salesforce_mces_golden.json @@ -1350,6 +1350,40 @@ }, "isPartOfKey": false, "jsonProps": "{}" + }, + { + "fieldPath": "Unique_Account", + "nullable": true, + "description": "\\# Unique_Account", + "type": { + "type": { + "com.linkedin.schema.StringType": {} + } + }, + "nativeDataType": "Text(80)", + "recursive": false, + "globalTags": { + "tags": [] + }, + "isPartOfKey": false, + "jsonProps": "{}" + }, + { + "fieldPath": "Unique_Number", + "nullable": true, + "description": "\\#Unique_Number", + "type": { + "type": { + "com.linkedin.schema.StringType": {} + } + }, + "nativeDataType": "Text(80)", + "recursive": false, + "globalTags": { + "tags": [] + }, + "isPartOfKey": false, + "jsonProps": "{}" } ], "primaryKeys": [