mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-11-04 12:36:23 +00:00 
			
		
		
		
	fix: table column description (#23928)
This commit is contained in:
		
							parent
							
								
									e49d3ee31a
								
							
						
					
					
						commit
						7ea87e7ca2
					
				@ -184,9 +184,11 @@ class SalesforceSource(DatabaseServiceSource):
 | 
				
			|||||||
                    )
 | 
					                    )
 | 
				
			||||||
                    if filter_by_table(
 | 
					                    if filter_by_table(
 | 
				
			||||||
                        self.config.sourceConfig.config.tableFilterPattern,
 | 
					                        self.config.sourceConfig.config.tableFilterPattern,
 | 
				
			||||||
 | 
					                        (
 | 
				
			||||||
                            table_fqn
 | 
					                            table_fqn
 | 
				
			||||||
                            if self.config.sourceConfig.config.useFqnForFiltering
 | 
					                            if self.config.sourceConfig.config.useFqnForFiltering
 | 
				
			||||||
                        else table_name,
 | 
					                            else table_name
 | 
				
			||||||
 | 
					                        ),
 | 
				
			||||||
                    ):
 | 
					                    ):
 | 
				
			||||||
                        self.status.filter(
 | 
					                        self.status.filter(
 | 
				
			||||||
                            table_fqn,
 | 
					                            table_fqn,
 | 
				
			||||||
@ -238,7 +240,7 @@ class SalesforceSource(DatabaseServiceSource):
 | 
				
			|||||||
        all_column_description = None
 | 
					        all_column_description = None
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            result = self.client.toolingexecute(
 | 
					            result = self.client.toolingexecute(
 | 
				
			||||||
                f"query/?q=SELECT+Description+FROM+FieldDefinition+WHERE+"
 | 
					                f"query/?q=SELECT+Description, QualifiedApiName+FROM+FieldDefinition+WHERE+"
 | 
				
			||||||
                f"EntityDefinition.QualifiedApiName='{table_name}'"
 | 
					                f"EntityDefinition.QualifiedApiName='{table_name}'"
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
            all_column_description = result["records"]
 | 
					            all_column_description = result["records"]
 | 
				
			||||||
@ -313,7 +315,7 @@ class SalesforceSource(DatabaseServiceSource):
 | 
				
			|||||||
            for item in all_column_description:
 | 
					            for item in all_column_description:
 | 
				
			||||||
                try:
 | 
					                try:
 | 
				
			||||||
                    if item.get("Description") is not None:
 | 
					                    if item.get("Description") is not None:
 | 
				
			||||||
                        column_name = item["attributes"]["url"].split(".")[-1]
 | 
					                        column_name = item["QualifiedApiName"]
 | 
				
			||||||
                        column_description_mapping.update(
 | 
					                        column_description_mapping.update(
 | 
				
			||||||
                            {column_name: item["Description"]}
 | 
					                            {column_name: item["Description"]}
 | 
				
			||||||
                        )
 | 
					                        )
 | 
				
			||||||
 | 
				
			|||||||
@ -215,7 +215,7 @@ SALESFORCE_FIELDS = [
 | 
				
			|||||||
            ("htmlFormatted", False),
 | 
					            ("htmlFormatted", False),
 | 
				
			||||||
            ("idLookup", False),
 | 
					            ("idLookup", False),
 | 
				
			||||||
            ("inlineHelpText", None),
 | 
					            ("inlineHelpText", None),
 | 
				
			||||||
            ("label", "Contact Description"),
 | 
					            ("label", "Contact Label"),
 | 
				
			||||||
            ("length", 32000),
 | 
					            ("length", 32000),
 | 
				
			||||||
            ("mask", None),
 | 
					            ("mask", None),
 | 
				
			||||||
            ("maskType", None),
 | 
					            ("maskType", None),
 | 
				
			||||||
@ -453,7 +453,9 @@ class SalesforceUnitTest(TestCase):
 | 
				
			|||||||
        "metadata.ingestion.source.database.salesforce.metadata.SalesforceSource.get_table_column_description"
 | 
					        "metadata.ingestion.source.database.salesforce.metadata.SalesforceSource.get_table_column_description"
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    def test_table_column(self, get_table_column_description):
 | 
					    def test_table_column(self, get_table_column_description):
 | 
				
			||||||
        get_table_column_description.return_value = None
 | 
					        get_table_column_description.return_value = [
 | 
				
			||||||
 | 
					            {"QualifiedApiName": "Description", "Description": "Contact Description"}
 | 
				
			||||||
 | 
					        ]
 | 
				
			||||||
        result = self.salesforce_source.get_columns("TEST_TABLE", SALESFORCE_FIELDS)
 | 
					        result = self.salesforce_source.get_columns("TEST_TABLE", SALESFORCE_FIELDS)
 | 
				
			||||||
        assert EXPECTED_COLUMN_VALUE == result
 | 
					        assert EXPECTED_COLUMN_VALUE == result
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user