Skip to content

Commit 2f6103e

Browse files
🐛 source: airtable - handle singleSelect types (#22311)
* add type for singleSelect * default type fallback * fmt * bump and changelog * use deepcopy * auto-bump connector version --------- Co-authored-by: Octavia Squidington III <[email protected]>
1 parent 4242c04 commit 2f6103e

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
- name: Airtable
1818
sourceDefinitionId: 14c6e7ea-97ed-4f5e-a7b5-25e9a80b8212
1919
dockerRepository: airbyte/source-airtable
20-
dockerImageTag: 2.0.2
20+
dockerImageTag: 2.0.3
2121
documentationUrl: https://docs.airbyte.com/integrations/sources/airtable
2222
icon: airtable.svg
2323
sourceType: api

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
supportsNormalization: false
179179
supportsDBT: false
180180
supported_destination_sync_modes: []
181-
- dockerImage: "airbyte/source-airtable:2.0.2"
181+
- dockerImage: "airbyte/source-airtable:2.0.3"
182182
spec:
183183
documentationUrl: "https://docs.airbyte.com/integrations/sources/airtable"
184184
connectionSpecification:

airbyte-integrations/connectors/source-airtable/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ COPY source_airtable ./source_airtable
3434
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
3535
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
3636

37-
LABEL io.airbyte.version=2.0.2
37+
LABEL io.airbyte.version=2.0.3
3838
LABEL io.airbyte.name=airbyte/source-airtable

airbyte-integrations/connectors/source-airtable/source_airtable/schema_helpers.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
33
#
44

5-
5+
import logging
66
from copy import deepcopy
77
from typing import Any, Dict
88

99
from airbyte_cdk.models import AirbyteStream
1010
from airbyte_cdk.models.airbyte_protocol import DestinationSyncMode, SyncMode
1111

12+
logger: logging.Logger = logging.getLogger("airbyte")
13+
1214

1315
class SchemaTypes:
1416

@@ -58,6 +60,7 @@ class SchemaTypes:
5860
"rating": SchemaTypes.number,
5961
"richText": SchemaTypes.string,
6062
"singleLineText": SchemaTypes.string,
63+
"singleSelect": SchemaTypes.string,
6164
"externalSyncSource": SchemaTypes.string,
6265
"url": SchemaTypes.string,
6366
# referal default type
@@ -103,7 +106,11 @@ def get_json_schema(table: Dict[str, Any]) -> Dict[str, str]:
103106
# Other edge cases, if `field_type` not in SIMPLE_AIRTABLE_TYPES, fall back to "simpleText" == `string`
104107
# reference issue: https://github.com/airbytehq/oncall/issues/1432#issuecomment-1412743120
105108
if complex_type == SchemaTypes.array_with_any:
106-
complex_type["items"] = deepcopy(SIMPLE_AIRTABLE_TYPES.get(field_type))
109+
if field_type in SIMPLE_AIRTABLE_TYPES:
110+
complex_type["items"] = deepcopy(SIMPLE_AIRTABLE_TYPES.get(field_type))
111+
else:
112+
complex_type["items"] = SchemaTypes.string
113+
logger.warning(f"Unknown field type: {field_type}, falling back to `simpleText` type")
107114
properties.update(**{name: complex_type})
108115
elif original_type in SIMPLE_AIRTABLE_TYPES.keys():
109116
field_type: str = exec_type if exec_type else original_type

docs/integrations/sources/airtable.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ See information about rate limits [here](https://airtable.com/developers/web/api
103103

104104
| Version | Date | Pull Request | Subject |
105105
|:--------|:-----------|:---------------------------------------------------------|:-------------------------------------------------------|
106+
| 2.0.3 | 2023-02-02 | [22311](https://github.com/airbytehq/airbyte/pull/22311) | Fix for `singleSelect` types when discovering the schema
106107
| 2.0.2 | 2023-02-01 | [22245](https://github.com/airbytehq/airbyte/pull/22245) | Fix for empty `result` object when discovering the schema
107108
| 2.0.1 | 2023-02-01 | [22224](https://github.com/airbytehq/airbyte/pull/22224) | Fixed broken `API Key` authentication
108109
| 2.0.0 | 2023-01-27 | [21962](https://github.com/airbytehq/airbyte/pull/21962) | Added casting of native Airtable data types to JsonSchema types

0 commit comments

Comments
 (0)