column-issue-fixed (#3138)

* column-issue-fixed

* column-type-lookup-optimized
This commit is contained in:
codingwithabhi 2022-03-04 17:01:10 +05:30 committed by GitHub
parent 24ef2af50a
commit 40d3f5e239
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,13 +92,19 @@ class SalesforceSource(Source[OMetaDatabaseAndTable]):
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()
@ -143,9 +149,10 @@ class SalesforceSource(Source[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