Skip to content

Commit

Permalink
remove long handling
Browse files Browse the repository at this point in the history
  • Loading branch information
edgao committed Jul 15, 2022
1 parent 23f78c3 commit 33ade8d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
is_datetime_with_timezone,
is_datetime_without_timezone,
is_integer,
is_long,
is_number,
is_object,
is_simple_property,
Expand Down Expand Up @@ -514,8 +513,6 @@ def cast_property_type(self, property_name: str, column_name: str, jinja_column:
cast_operation = jinja_call(f"cast_to_boolean({jinja_column})")
return f"{cast_operation} as {column_name}"
elif is_integer(definition):
sql_type = jinja_call("dbt_utils.type_int()")
elif is_long(definition):
sql_type = jinja_call("dbt_utils.type_bigint()")
elif is_number(definition["type"]):
sql_type = jinja_call("dbt_utils.type_float()")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,7 @@ def is_number(property_type) -> bool:


def is_integer(definition: dict) -> bool:
# By default, {type: integer} will be treated as a long (see is_long)
return "airbyte_type" in definition and definition["airbyte_type"] == "integer"


def is_long(definition: dict) -> bool:
if "airbyte_type" in definition and definition["airbyte_type"] == "long":
if "airbyte_type" in definition and definition["airbyte_type"] == "integer":
return True
property_type = definition["type"]
if is_string(property_type) or is_number(property_type):
Expand All @@ -76,7 +71,7 @@ def is_long(definition: dict) -> bool:

def is_boolean(definition: dict) -> bool:
property_type = definition["type"]
if is_string(property_type) or is_number(property_type) or is_integer(definition) or is_long(definition):
if is_string(property_type) or is_number(property_type) or is_integer(definition):
# Handle union type, give priority to wider scope types
return False
return property_type == "boolean" or "boolean" in property_type
Expand All @@ -99,7 +94,7 @@ def is_simple_property(definition: dict) -> bool:
property_type = "object"
else:
property_type = definition["type"]
return is_string(property_type) or is_integer(definition) or is_long(definition) or is_number(property_type) or is_boolean(definition)
return is_string(property_type) or is_integer(definition) or is_number(property_type) or is_boolean(definition)


def is_combining_node(properties: dict) -> Set[str]:
Expand Down

0 comments on commit 33ade8d

Please sign in to comment.