Skip to content

Commit

Permalink
column-issue-fixed (#3138)
Browse files Browse the repository at this point in the history
* column-issue-fixed

* column-type-lookup-optimized
  • Loading branch information
codingwithabhi committed Mar 4, 2022
1 parent 24ef2af commit 40d3f5e
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions ingestion/src/metadata/ingestion/source/salesforce.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,19 @@ def create(cls, config: dict, metadata_config: dict, ctx: WorkflowContext):
return cls(config, metadata_config, ctx)

def column_type(self, column_type: str):
if column_type in ["ID", "PHONE", "CURRENCY"]:
type = "INT"
elif column_type in ["REFERENCE", "PICKLIST", "TEXTAREA", "ADDRESS", "URL"]:
type = "VARCHAR"
else:
type = column_type
return type
if column_type in {"ID", "PHONE", "CURRENCY"}:
return "INT"
if column_type in {
"REFERENCE",
"PICKLIST",
"TEXTAREA",
"ADDRESS",
"URL",
"EMAIL",
}:
return "VARCHAR"

return column_type

def next_record(self) -> Iterable[OMetaDatabaseAndTable]:
yield from self.salesforce_client()
Expand Down Expand Up @@ -143,9 +149,10 @@ def salesforce_client(self) -> Iterable[OMetaDatabaseAndTable]:
Column(
name=column["name"],
description=column["label"],
columnDataType=self.column_type(column["type"].upper()),
columnConstraint=col_constraint,
dataType=self.column_type(column["type"].upper()),
constraint=col_constraint,
ordinalPosition=row_order,
dataLength=column["length"],
)
)
row_order += 1
Expand Down

0 comments on commit 40d3f5e

Please sign in to comment.