Skip to content

Commit

Permalink
Merge pull request airbytehq#6 from mohamagdy/destination-redshift-no…
Browse files Browse the repository at this point in the history
…-dbt

Call `DotMap` with square brackets
  • Loading branch information
mohamagdy authored Apr 8, 2022
2 parents 1b95872 + bdd3ef6 commit 751640d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,15 @@ def get_records(parents: Union[DotMap, List[DotMap]], method: str) -> List[DotMa

children_records = []
for parent_item in parents:
children = getattr(parent_item, method)
children = parent_item.get(method)
if not isinstance(children, list):
children = [children]

for child_item in children:
if child_item and final_table.references and method == node[-1]:
child_item[final_table.reference_key.name] = parent_item[AIRBYTE_ID_NAME]


children_records.append(child_item)

return children_records
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def _extract_tables(self, properties: dict, name: str, primary_keys: List[str] =

for property_key, property_value in properties.items():
item_type = property_value.get("type")
item_type = [item_type] if not isinstance(item_type, list) else item_type
if not set(item_type).intersection({"object", "array"}):
data_type = DataTypeConverter.convert(property_value["type"], property_value.get("format"), property_value.get("maxLength"))
table.fields.append(Field(name=property_key, data_type=data_type))
Expand Down

0 comments on commit 751640d

Please sign in to comment.