Skip to content

🐛 source: airtable - handle singleSelect types #22311

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

Merged
merged 6 commits into from
Feb 2, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- name: Airtable
sourceDefinitionId: 14c6e7ea-97ed-4f5e-a7b5-25e9a80b8212
dockerRepository: airbyte/source-airtable
dockerImageTag: 2.0.2
dockerImageTag: 2.0.3
documentationUrl: https://docs.airbyte.com/integrations/sources/airtable
icon: airtable.svg
sourceType: api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
supportsNormalization: false
supportsDBT: false
supported_destination_sync_modes: []
- dockerImage: "airbyte/source-airtable:2.0.2"
- dockerImage: "airbyte/source-airtable:2.0.3"
spec:
documentationUrl: "https://docs.airbyte.com/integrations/sources/airtable"
connectionSpecification:
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-airtable/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ COPY source_airtable ./source_airtable
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=2.0.2
LABEL io.airbyte.version=2.0.3
LABEL io.airbyte.name=airbyte/source-airtable
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#


import logging
from copy import deepcopy
from typing import Any, Dict

from airbyte_cdk.models import AirbyteStream
from airbyte_cdk.models.airbyte_protocol import DestinationSyncMode, SyncMode

logger: logging.Logger = logging.getLogger("airbyte")


class SchemaTypes:

Expand Down Expand Up @@ -58,6 +60,7 @@ class SchemaTypes:
"rating": SchemaTypes.number,
"richText": SchemaTypes.string,
"singleLineText": SchemaTypes.string,
"singleSelect": SchemaTypes.string,
"externalSyncSource": SchemaTypes.string,
"url": SchemaTypes.string,
# referal default type
Expand Down Expand Up @@ -103,7 +106,11 @@ def get_json_schema(table: Dict[str, Any]) -> Dict[str, str]:
# Other edge cases, if `field_type` not in SIMPLE_AIRTABLE_TYPES, fall back to "simpleText" == `string`
# reference issue: https://github.com/airbytehq/oncall/issues/1432#issuecomment-1412743120
if complex_type == SchemaTypes.array_with_any:
complex_type["items"] = deepcopy(SIMPLE_AIRTABLE_TYPES.get(field_type))
if field_type in SIMPLE_AIRTABLE_TYPES:
complex_type["items"] = deepcopy(SIMPLE_AIRTABLE_TYPES.get(field_type))
else:
complex_type["items"] = SchemaTypes.string
logger.warning(f"Unknown field type: {field_type}, falling back to `simpleText` type")
properties.update(**{name: complex_type})
elif original_type in SIMPLE_AIRTABLE_TYPES.keys():
field_type: str = exec_type if exec_type else original_type
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/airtable.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ See information about rate limits [here](https://airtable.com/developers/web/api

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