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

Firebolt Source: adding new column types #21842

Closed
wants to merge 10 commits into from
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-firebolt/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ COPY source_firebolt ./source_firebolt
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.2.0
LABEL io.airbyte.version=0.3.0
ptiurin marked this conversation as resolved.
Show resolved Hide resolved
LABEL io.airbyte.name=airbyte/source-firebolt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def table_schema() -> str:
# with Decimal data type enabled
"column5": {"type": ["null", "string"], "airbyte_type": "big_number"},
"column6": {"type": "array", "items": {"type": ["null", "integer"]}},
"column7": {"type": ["null", "integer"]},
"column7": {"type": ["null", "boolean"]},
},
}
return schema
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-firebolt/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from setuptools import find_packages, setup

MAIN_REQUIREMENTS = ["airbyte-cdk~=0.2", "firebolt-sdk>=0.12.0"]
MAIN_REQUIREMENTS = ["airbyte-cdk~=0.2", "firebolt-sdk>=0.14.0"]

TEST_REQUIREMENTS = [
"pytest>=6.2.5", # 6.2.5 has python10 compatibility fixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ def convert_type(fb_type: str, nullable: bool) -> Dict[str, Union[str, Dict]]:
"FLOAT": {"type": "number"},
"DOUBLE": {"type": "number"},
"DOUBLE PRECISION": {"type": "number"},
"BOOLEAN": {"type": "integer"},
"BOOLEAN": {"type": "boolean"},
# Firebolt bigint is max 8 byte so it fits in Airbyte's "integer"
"BIGINT": {"type": "integer"},
"LONG": {"type": "integer"},
"DECIMAL": {"type": "string", "airbyte_type": "big_number"},
"DATE": {"type": "string", "format": "date"},
"PGDATE": {"type": "string", "format": "date"},
"TIMESTAMP": {
"type": "string",
"format": "datetime",
Expand All @@ -45,6 +46,16 @@ def convert_type(fb_type: str, nullable: bool) -> Dict[str, Union[str, Dict]]:
"format": "datetime",
"airbyte_type": "timestamp_without_timezone",
},
"TIMESTAMPNTZ": {
"type": "string",
"format": "datetime",
"airbyte_type": "timestamp_without_timezone",
},
"TIMESTAMPTZ": {
"type": "string",
"format": "datetime",
"airbyte_type": "timestamp_with_timezone",
},
}
if fb_type.upper().startswith("ARRAY"):
inner_type = fb_type[6:-1] # Strip ARRAY()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,26 @@ def test_connection(mock_connection, config, config_no_engine, logger):
("ARRAY(ARRAY(INT NOT NULL))", False, {"type": "array", "items": {"type": "array", "items": {"type": ["null", "integer"]}}}),
("int", True, {"type": ["null", "integer"]}),
("DUMMY", False, {"type": "string"}),
("boolean", False, {"type": "integer"}),
("boolean", False, {"type": "boolean"}),
("pgdate", False, {"type": "string", "format": "date"}),
(
"TIMESTAMPNTZ",
False,
{
"type": "string",
"format": "datetime",
"airbyte_type": "timestamp_without_timezone",
},
),
(
"TIMESTAMPTZ",
False,
{
"type": "string",
"format": "datetime",
"airbyte_type": "timestamp_with_timezone",
},
),
],
)
def test_convert_type(type, nullable, result):
Expand All @@ -143,9 +162,12 @@ def test_convert_type(type, nullable, result):
["a", 1],
),
([datetime.fromisoformat("2019-01-01 20:12:02"), 2], ["2019-01-01T20:12:02", 2]),
([[date.fromisoformat("0019-01-01"), 2], 0.2214], [["0019-01-01", 2], 0.2214]),
([[date.fromisoformat("2019-01-01"), 2], 0.2214], [["2019-01-01", 2], 0.2214]),
([[None, 2], None], [[None, 2], None]),
([Decimal("1231232.123459999990457054844258706536")], ["1231232.123459999990457054844258706536"]),
([datetime.fromisoformat("2019-01-01 20:12:02+01:30"), 2], ["2019-01-01T20:12:02+01:30", 2]),
([True, 2], [True, 2]),
],
)
def test_format_fetch_result(data, expected):
Expand Down