Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve tap to specify column maxLength, allowing targets to size col… #100

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions tap_salesforce/salesforce/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,11 @@ def field_to_property_schema(field, mdata): # pylint:disable=too-many-branches

if sf_type in STRING_TYPES:
property_schema['type'] = "string"
if field['length'] > 0:
property_schema['maxLength'] = field['length']
elif sf_type in DATE_TYPES:
date_type = {"type": "string", "format": "date-time"}
string_type = {"type": ["string", "null"]}
string_type = {"type": ["string", "null"], "maxLength": 28} # eg. 2021-03-18T06:17:29.000+0000
property_schema["anyOf"] = [date_type, string_type]
elif sf_type == "boolean":
property_schema['type'] = "boolean"
Expand All @@ -153,19 +155,20 @@ def field_to_property_schema(field, mdata): # pylint:disable=too-many-branches
elif sf_type == "address":
property_schema['type'] = "object"
property_schema['properties'] = {
"street": {"type": ["null", "string"]},
"state": {"type": ["null", "string"]},
"postalCode": {"type": ["null", "string"]},
"city": {"type": ["null", "string"]},
"country": {"type": ["null", "string"]},
"street": {"type": ["null", "string"], "maxLength": 255},
"state": {"type": ["null", "string"], "maxLength": 80},
"postalCode": {"type": ["null", "string"], "maxLength": 20},
"city": {"type": ["null", "string"], "maxLength": 80},
"country": {"type": ["null", "string"], "maxLength": 80},
"longitude": {"type": ["null", "number"]},
"latitude": {"type": ["null", "number"]},
"geocodeAccuracy": {"type": ["null", "string"]}
"geocodeAccuracy": {"type": ["null", "string"], "maxLength": 40}
}
elif sf_type == "int":
property_schema['type'] = "integer"
elif sf_type == "time":
property_schema['type'] = "string"
property_schema['maxLength'] = 13 # eg. 04:34:12.000Z
elif sf_type in LOOSE_TYPES:
return property_schema, mdata # No type = all types
elif sf_type in BINARY_TYPES:
Expand Down