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
Closed
Show file tree
Hide file tree
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
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.1
LABEL io.airbyte.version=1.0.0
LABEL io.airbyte.name=airbyte/source-firebolt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def table_schema() -> str:
# Removed as part of PR 25965 because... it just didn't work?
"column5": {"type": ["null", "string"]},
"column6": {"type": "array", "items": {"type": ["null", "integer"]}},
"column7": {"type": ["null", "integer"]},
"column7": {"type": ["null", "boolean"]},
},
}
return schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ data:
connectorSubtype: database
connectorType: source
definitionId: 6f2ac653-8623-43c4-8950-19218c7caf3d
dockerImageTag: 0.2.1
dockerImageTag: 1.0.0
dockerRepository: airbyte/source-firebolt
githubIssueLabel: source-firebolt
icon: firebolt.svg
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": "date-time",
Expand All @@ -45,6 +46,16 @@ def convert_type(fb_type: str, nullable: bool) -> Dict[str, Union[str, Dict]]:
"format": "date-time",
"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
1 change: 1 addition & 0 deletions docs/integrations/sources/firebolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ You can now use the Airbyte Firebolt source.

| Version | Date | Pull Request | Subject |
| :------ | :--------- | :------------------------------------------------------- | :------------------------------------------------ |
| 1.0.0 | 2023-07-20 | [21842](https://github.com/airbytehq/airbyte/pull/21842) | PGDate, TimestampTZ, TimestampNTZ and Boolean column support |
| 0.2.1 | 2022-05-10 | [25965](https://github.com/airbytehq/airbyte/pull/25965) | Fix DATETIME conversion to Airbyte date-time type |
| 0.2.0 | 2022-09-09 | [16583](https://github.com/airbytehq/airbyte/pull/16583) | Reading from views |
| 0.1.0 | 2022-04-28 | [13874](https://github.com/airbytehq/airbyte/pull/13874) | Create Firebolt source |