Skip to content

Commit

Permalink
run gradlew format (airbytehq#5552)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosmarxm authored Aug 20, 2021
1 parent a9b2c08 commit 7225187
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from typing import Any, Dict, Mapping

import pkg_resources

from airbyte_cdk.logger import AirbyteLogger
from airbyte_cdk.models import ConnectorSpecification
from jsonschema import RefResolver, validate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,30 +52,18 @@
"type": "integer"
},
"children": {
"type": [
"null",
"array"
],
"type": ["null", "array"],
"items": {
"type": "object",
"properties": {
"ab_id": {
"type": [
"null",
"integer"
]
"type": ["null", "integer"]
},
"owner": {
"type": [
"null",
"object"
],
"type": ["null", "object"],
"properties": {
"owner_id": {
"type": [
"null",
"integer"
]
"type": ["null", "integer"]
}
}
}
Expand Down Expand Up @@ -380,4 +368,4 @@
"primary_key": [["id"]]
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -335,28 +335,25 @@ def generate_json_parsing_model(self, from_table: str, column_names: Dict[str, T
fields=self.extract_json_columns(column_names),
from_table=jinja_call(from_table),
unnesting_after_query=self.unnesting_after_query(),
sql_table_comment=self.sql_table_comment()
sql_table_comment=self.sql_table_comment(),
)
return sql

def extract_json_columns(self, column_names: Dict[str, Tuple[str, str]]) -> List[str]:
return [
StreamProcessor.extract_json_column(
field, self.json_column_name, self.properties[field], column_names[field][0], 'table_alias'
)
StreamProcessor.extract_json_column(field, self.json_column_name, self.properties[field], column_names[field][0], "table_alias")
for field in column_names
]

@staticmethod
def extract_json_column(
property_name: str, json_column_name: str, definition: Dict, column_name: str, table_alias: str) -> str:
def extract_json_column(property_name: str, json_column_name: str, definition: Dict, column_name: str, table_alias: str) -> str:
json_path = [property_name]
# In some cases, some destination aren't able to parse the JSON blob using the original property name
# we make their life easier by using a pre-populated and sanitized column name instead...
normalized_json_path = [transform_json_naming(property_name)]
table_alias = f"{table_alias}"
if "unnested_column_value" in json_column_name:
table_alias = ''
table_alias = ""
json_extract = jinja_call(f"json_extract('{table_alias}', {json_column_name}, {json_path})")
if "type" in definition:
if is_array(definition["type"]):
Expand Down Expand Up @@ -593,7 +590,7 @@ def generate_final_model(self, from_table: str, column_names: Dict[str, Tuple[st
fields=self.list_fields(column_names),
hash_id=self.hash_id(),
from_table=jinja_call(from_table),
sql_table_comment=self.sql_table_comment(include_from_table=True)
sql_table_comment=self.sql_table_comment(include_from_table=True),
)
return sql

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
Teams,
)


TOKEN_SEPARATOR = ","


Expand Down

0 comments on commit 7225187

Please sign in to comment.