Skip to content

Commit 6ffb682

Browse files
authored
Source google sheets: fix full_refresh test by adding supported_sync_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
1 parent 0fe7a53 commit 6ffb682

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

airbyte-config/init/src/main/resources/config/STANDARD_SOURCE_DEFINITION/71607ba1-c0ac-4799-8049-7f4b90dd50f7.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"sourceDefinitionId": "71607ba1-c0ac-4799-8049-7f4b90dd50f7",
33
"name": "Google Sheets",
44
"dockerRepository": "airbyte/source-google-sheets",
5-
"dockerImageTag": "0.2.4",
5+
"dockerImageTag": "0.2.5",
66
"documentationUrl": "https://docs.airbyte.io/integrations/sources/google-sheets",
77
"icon": "google-sheets.svg"
88
}

airbyte-config/init/src/main/resources/seed/source_definitions.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
- sourceDefinitionId: 71607ba1-c0ac-4799-8049-7f4b90dd50f7
9696
name: Google Sheets
9797
dockerRepository: airbyte/source-google-sheets
98-
dockerImageTag: 0.2.4
98+
dockerImageTag: 0.2.5
9999
documentationUrl: https://docs.airbyte.io/integrations/sources/google-sheets
100100
icon: google-sheets.svg
101101
- sourceDefinitionId: 435bb9a5-7887-4809-aa58-28c27df0d7ad

airbyte-integrations/connectors/source-google-sheets/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ RUN pip install .
1313

1414
ENV AIRBYTE_ENTRYPOINT "/airbyte/base.sh"
1515

16-
LABEL io.airbyte.version=0.2.4
16+
LABEL io.airbyte.version=0.2.5
1717
LABEL io.airbyte.name=airbyte/source-google-sheets

airbyte-integrations/connectors/source-google-sheets/google_sheets_source/helpers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def headers_to_airbyte_stream(logger: AirbyteLogger, sheet_name: str, header_row
7171
"properties": {field: {"type": "string"} for field in fields},
7272
}
7373

74-
return AirbyteStream(name=sheet_name, json_schema=sheet_json_schema)
74+
return AirbyteStream(name=sheet_name, json_schema=sheet_json_schema, supported_sync_modes=["full_refresh"])
7575

7676
@staticmethod
7777
def get_valid_headers_and_duplicates(header_row_values: List[str]) -> (List[str], List[str]):
@@ -149,7 +149,7 @@ def get_available_sheets_to_column_index_to_name(
149149
client, spreadsheet_id: str, requested_sheets_and_columns: Dict[str, FrozenSet[str]]
150150
) -> Dict[str, Dict[int, str]]:
151151
available_sheets = Helpers.get_sheets_in_spreadsheet(client, spreadsheet_id)
152-
152+
print(f"available_sheets: {available_sheets}")
153153
available_sheets_to_column_index_to_name = defaultdict(dict)
154154
for sheet, columns in requested_sheets_and_columns.items():
155155
if sheet in available_sheets:

airbyte-integrations/connectors/source-google-sheets/unit_tests/test_helpers.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def test_headers_to_airbyte_stream(self):
4949
# For simplicity, the type of every cell is a string
5050
"properties": {header: {"type": "string"} for header in header_values},
5151
},
52+
supported_sync_modes=["full_refresh"],
5253
)
5354

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

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

@@ -133,12 +136,12 @@ def test_parse_sheet_and_column_names_from_catalog(self):
133136
catalog = ConfiguredAirbyteCatalog(
134137
streams=[
135138
ConfiguredAirbyteStream(
136-
stream=AirbyteStream(name=sheet1, json_schema=sheet1_schema),
139+
stream=AirbyteStream(name=sheet1, json_schema=sheet1_schema, supported_sync_modes=["full_refresh"]),
137140
sync_mode=SyncMode.full_refresh,
138141
destination_sync_mode=DestinationSyncMode.overwrite,
139142
),
140143
ConfiguredAirbyteStream(
141-
stream=AirbyteStream(name=sheet2, json_schema=sheet2_schema),
144+
stream=AirbyteStream(name=sheet2, json_schema=sheet2_schema, supported_sync_modes=["full_refresh"]),
142145
sync_mode=SyncMode.full_refresh,
143146
destination_sync_mode=DestinationSyncMode.overwrite,
144147
),

docs/integrations/sources/google-sheets.md

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ The Airbyte UI will ask for two things:
8989

9090
| Version | Date | Pull Request | Subject |
9191
| :------ | :-------- | :----- | :------ |
92+
| 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 |
9293
| 0.2.4 | 2021-08-05 | [5233](https://github.com/airbytehq/airbyte/pull/5233) | Fix error during listing sheets with diagram only |
9394
| 0.2.3 | 2021-06-09 | [3973](https://github.com/airbytehq/airbyte/pull/3973) | Add AIRBYTE_ENTRYPOINT for Kubernetes support |
9495
| 0.2.2 | 2021-04-20 | [2994](https://github.com/airbytehq/airbyte/pull/2994) | Formatting spec |

0 commit comments

Comments
 (0)