Skip to content

Commit

Permalink
Source google sheets: fix full_refresh test by adding supported_sync_…
Browse files Browse the repository at this point in the history
…modes to Stream inistialization (#5951)

* added supported_sync_modes for AirbyteStream initialization to fic full_refresh test

* fix unit test with supported_sync_modes argument in AirbyteStream initialization
  • Loading branch information
midavadim authored Sep 13, 2021
1 parent 0fe7a53 commit 6ffb682
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"sourceDefinitionId": "71607ba1-c0ac-4799-8049-7f4b90dd50f7",
"name": "Google Sheets",
"dockerRepository": "airbyte/source-google-sheets",
"dockerImageTag": "0.2.4",
"dockerImageTag": "0.2.5",
"documentationUrl": "https://docs.airbyte.io/integrations/sources/google-sheets",
"icon": "google-sheets.svg"
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
- sourceDefinitionId: 71607ba1-c0ac-4799-8049-7f4b90dd50f7
name: Google Sheets
dockerRepository: airbyte/source-google-sheets
dockerImageTag: 0.2.4
dockerImageTag: 0.2.5
documentationUrl: https://docs.airbyte.io/integrations/sources/google-sheets
icon: google-sheets.svg
- sourceDefinitionId: 435bb9a5-7887-4809-aa58-28c27df0d7ad
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ RUN pip install .

ENV AIRBYTE_ENTRYPOINT "/airbyte/base.sh"

LABEL io.airbyte.version=0.2.4
LABEL io.airbyte.version=0.2.5
LABEL io.airbyte.name=airbyte/source-google-sheets
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def headers_to_airbyte_stream(logger: AirbyteLogger, sheet_name: str, header_row
"properties": {field: {"type": "string"} for field in fields},
}

return AirbyteStream(name=sheet_name, json_schema=sheet_json_schema)
return AirbyteStream(name=sheet_name, json_schema=sheet_json_schema, supported_sync_modes=["full_refresh"])

@staticmethod
def get_valid_headers_and_duplicates(header_row_values: List[str]) -> (List[str], List[str]):
Expand Down Expand Up @@ -149,7 +149,7 @@ def get_available_sheets_to_column_index_to_name(
client, spreadsheet_id: str, requested_sheets_and_columns: Dict[str, FrozenSet[str]]
) -> Dict[str, Dict[int, str]]:
available_sheets = Helpers.get_sheets_in_spreadsheet(client, spreadsheet_id)

print(f"available_sheets: {available_sheets}")
available_sheets_to_column_index_to_name = defaultdict(dict)
for sheet, columns in requested_sheets_and_columns.items():
if sheet in available_sheets:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def test_headers_to_airbyte_stream(self):
# For simplicity, the type of every cell is a string
"properties": {header: {"type": "string"} for header in header_values},
},
supported_sync_modes=["full_refresh"],
)

actual_stream = Helpers.headers_to_airbyte_stream(logger, sheet_name, header_values)
Expand Down Expand Up @@ -79,6 +80,7 @@ def test_duplicate_headers_to_ab_stream_ignores_duplicates(self):
# For simplicity, the type of every cell is a string
"properties": {header: {"type": "string"} for header in expected_stream_header_values},
},
supported_sync_modes=["full_refresh"],
)

actual_stream = Helpers.headers_to_airbyte_stream(logger, sheet_name, header_values)
Expand All @@ -96,6 +98,7 @@ def test_headers_to_airbyte_stream_blank_values_terminate_row(self):
# For simplicity, the type of every cell is a string
"properties": {"h1": {"type": "string"}},
},
supported_sync_modes=["full_refresh"],
)
actual_stream = Helpers.headers_to_airbyte_stream(logger, sheet_name, header_values)

Expand Down Expand Up @@ -133,12 +136,12 @@ def test_parse_sheet_and_column_names_from_catalog(self):
catalog = ConfiguredAirbyteCatalog(
streams=[
ConfiguredAirbyteStream(
stream=AirbyteStream(name=sheet1, json_schema=sheet1_schema),
stream=AirbyteStream(name=sheet1, json_schema=sheet1_schema, supported_sync_modes=["full_refresh"]),
sync_mode=SyncMode.full_refresh,
destination_sync_mode=DestinationSyncMode.overwrite,
),
ConfiguredAirbyteStream(
stream=AirbyteStream(name=sheet2, json_schema=sheet2_schema),
stream=AirbyteStream(name=sheet2, json_schema=sheet2_schema, supported_sync_modes=["full_refresh"]),
sync_mode=SyncMode.full_refresh,
destination_sync_mode=DestinationSyncMode.overwrite,
),
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/google-sheets.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ The Airbyte UI will ask for two things:

| Version | Date | Pull Request | Subject |
| :------ | :-------- | :----- | :------ |
| 0.2.5 | 2021-09-12 | [5972](https://github.com/airbytehq/airbyte/pull/5972) | Fix full_refresh test by adding supported_sync_modes to Stream initialization |
| 0.2.4 | 2021-08-05 | [5233](https://github.com/airbytehq/airbyte/pull/5233) | Fix error during listing sheets with diagram only |
| 0.2.3 | 2021-06-09 | [3973](https://github.com/airbytehq/airbyte/pull/3973) | Add AIRBYTE_ENTRYPOINT for Kubernetes support |
| 0.2.2 | 2021-04-20 | [2994](https://github.com/airbytehq/airbyte/pull/2994) | Formatting spec |
Expand Down

0 comments on commit 6ffb682

Please sign in to comment.