Skip to content

Commit c7021e6

Browse files
authored
πŸ› Source S3: work-around for format.delimiter change '\\t' -> '\t' (#9163)
* work-around for format.delimiter '\\t' -> '\t' Signed-off-by: Sergey Chvalyuk <[email protected]>
1 parent b6926d4 commit c7021e6

File tree

9 files changed

+32
-8
lines changed

9 files changed

+32
-8
lines changed

β€Žairbyte-config/init/src/main/resources/config/STANDARD_SOURCE_DEFINITION/69589781-7828-43c5-9f63-8925b1c1ccc2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"sourceDefinitionId": "69589781-7828-43c5-9f63-8925b1c1ccc2",
33
"name": "S3",
44
"dockerRepository": "airbyte/source-s3",
5-
"dockerImageTag": "0.1.7",
5+
"dockerImageTag": "0.1.9",
66
"documentationUrl": "https://docs.airbyte.io/integrations/sources/s3",
77
"icon": "s3.svg"
88
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@
593593
- name: S3
594594
sourceDefinitionId: 69589781-7828-43c5-9f63-8925b1c1ccc2
595595
dockerRepository: airbyte/source-s3
596-
dockerImageTag: 0.1.8
596+
dockerImageTag: 0.1.9
597597
documentationUrl: https://docs.airbyte.io/integrations/sources/s3
598598
icon: s3.svg
599599
sourceType: file

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6047,7 +6047,7 @@
60476047
path_in_connector_config:
60486048
- "credentials"
60496049
- "client_secret"
6050-
- dockerImage: "airbyte/source-s3:0.1.8"
6050+
- dockerImage: "airbyte/source-s3:0.1.9"
60516051
spec:
60526052
documentationUrl: "https://docs.airbyte.io/integrations/sources/s3"
60536053
changelogUrl: "https://docs.airbyte.io/integrations/sources/s3"
@@ -6103,7 +6103,8 @@
61036103
delimiter:
61046104
title: "Delimiter"
61056105
description: "The character delimiting individual cells in the CSV\
6106-
\ data. This may only be a 1-character string."
6106+
\ data. This may only be a 1-character string. For tab-delimited\
6107+
\ data enter '\\t'."
61076108
default: ","
61086109
minLength: 1
61096110
type: "string"

β€Žairbyte-integrations/connectors/source-s3/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ COPY source_s3 ./source_s3
1717
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
1818
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
1919

20-
LABEL io.airbyte.version=0.1.8
20+
LABEL io.airbyte.version=0.1.9
2121
LABEL io.airbyte.name=airbyte/source-s3

β€Žairbyte-integrations/connectors/source-s3/integration_tests/spec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
},
4747
"delimiter": {
4848
"title": "Delimiter",
49-
"description": "The character delimiting individual cells in the CSV data. This may only be a 1-character string.",
49+
"description": "The character delimiting individual cells in the CSV data. This may only be a 1-character string. For tab-delimited data enter '\\t'.",
5050
"default": ",",
5151
"minLength": 1,
5252
"type": "string"

β€Žairbyte-integrations/connectors/source-s3/source_s3/source.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44

55

6-
from typing import Optional
6+
from typing import Any, Mapping, Optional
77

88
from pydantic import BaseModel, Field
99

@@ -47,3 +47,9 @@ class SourceS3(SourceFilesAbstract):
4747
stream_class = IncrementalFileStreamS3
4848
spec_class = SourceS3Spec
4949
documentation_url = "https://docs.airbyte.io/integrations/sources/s3"
50+
51+
def read_config(self, config_path: str) -> Mapping[str, Any]:
52+
config = super().read_config(config_path)
53+
if config.get("format", {}).get("delimiter") == r"\t":
54+
config["format"]["delimiter"] = "\t"
55+
return config

β€Žairbyte-integrations/connectors/source-s3/source_s3/source_files_abstract/formats/csv_spec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Config:
2121
delimiter: str = Field(
2222
default=",",
2323
min_length=1,
24-
description="The character delimiting individual cells in the CSV data. This may only be a 1-character string.",
24+
description="The character delimiting individual cells in the CSV data. This may only be a 1-character string. For tab-delimited data enter '\\t'.",
2525
)
2626
quote_char: str = Field(
2727
default='"', description="The character used optionally for quoting CSV values. To disallow quoting, make this field blank."
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#
2+
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
3+
#
4+
5+
import json
6+
7+
from source_s3 import SourceS3
8+
9+
10+
def test_transform_backslash_t_to_tab(tmp_path):
11+
config_file = tmp_path / "config.json"
12+
with open(config_file, "w") as fp:
13+
json.dump({"format": {"delimiter": "\\t"}}, fp)
14+
source = SourceS3()
15+
config = source.read_config(config_file)
16+
assert config["format"]["delimiter"] == "\t"

β€Ždocs/integrations/sources/s3.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ You can find details on [here](https://arrow.apache.org/docs/python/generated/py
206206
207207
| Version | Date | Pull Request | Subject |
208208
| :--- | :--- | :--- | :--- |
209+
| 0.1.9 | 2022-01-06 | [9163](https://github.com/airbytehq/airbyte/pull/9163) | Work-around for web-UI, `backslash - t` converts to `tab` for `format.delimiter` field. |
209210
| 0.1.7 | 2021-11-08 | [7499](https://github.com/airbytehq/airbyte/pull/7499) | Remove base-python dependencies |
210211
| 0.1.6 | 2021-10-15 | [6615](https://github.com/airbytehq/airbyte/pull/6615) & [7058](https://github.com/airbytehq/airbyte/pull/7058) | Memory and performance optimisation. Advanced options for CSV parsing. |
211212
| 0.1.5 | 2021-09-24 | [6398](https://github.com/airbytehq/airbyte/pull/6398) | Support custom non Amazon S3 services |

0 commit comments

Comments
Β (0)