Skip to content

chore(source-s3): Update CDK to v5 (old) #45199

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

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 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
@@ -1,5 +1,7 @@
{
"documentationUrl": "https://docs.airbyte.com/integrations/sources/s3",
"supportsNormalization": false,
"supportsDBT": false,
"connectionSpecification": {
"title": "Config",
"description": "NOTE: When this Spec is changed, legacy_config_transformer.py must also be modified to uptake the changes\nbecause it is responsible for converting legacy S3 v3 configs into v4 configs using the File-Based CDK.",
Expand Down Expand Up @@ -338,6 +340,21 @@
},
"description": "Extract text from document formats (.pdf, .docx, .md, .pptx) and emit as one record per file.",
"required": ["filetype"]
},
{
"title": "Excel Format",
"type": "object",
"properties": {
"filetype": {
"title": "Filetype",
"default": "excel",
"const": "excel",
"type": "string"
}
},
"required": [
"filetype"
]
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-s3/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data:
connectorSubtype: file
connectorType: source
definitionId: 69589781-7828-43c5-9f63-8925b1c1ccc2
dockerImageTag: 4.8.0
dockerImageTag: 4.9.0
dockerRepository: airbyte/source-s3
documentationUrl: https://docs.airbyte.com/integrations/sources/s3
githubIssueLabel: source-s3
Expand Down
860 changes: 518 additions & 342 deletions airbyte-integrations/connectors/source-s3/poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions airbyte-integrations/connectors/source-s3/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
version = "4.8.0"
version = "4.9.0"
name = "source-s3"
description = "Source implementation for S3."
authors = [ "Airbyte <[email protected]>",]
Expand All @@ -23,7 +23,7 @@ python-snappy = "==0.6.1"
dill = "==0.3.4"
transformers = "4.38.2"
urllib3 = "<2"
airbyte-cdk = {extras = ["file-based"], version = "^3"}
airbyte-cdk = {extras = ["file-based"], version = "^5"}

[tool.poetry.scripts]
source-s3 = "source_s3.run:run"
Expand Down
31 changes: 18 additions & 13 deletions airbyte-integrations/connectors/source-s3/source_s3/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
#

import sys
import time
import traceback
from datetime import datetime
from typing import List

from airbyte_cdk import AirbyteEntrypoint, AirbyteMessage, Type, launch
from airbyte_cdk.models import AirbyteErrorTraceMessage, AirbyteTraceMessage, TraceType
from airbyte_cdk.models import AirbyteErrorTraceMessage, AirbyteMessageSerializer, AirbyteTraceMessage, TraceType
from orjson import orjson
from source_s3.v4 import Config, Cursor, SourceS3, SourceS3StreamReader


Expand All @@ -27,17 +28,21 @@ def get_source(args: List[str]):
)
except Exception:
print(
AirbyteMessage(
type=Type.TRACE,
trace=AirbyteTraceMessage(
type=TraceType.ERROR,
emitted_at=int(datetime.now().timestamp() * 1000),
error=AirbyteErrorTraceMessage(
message="Error starting the sync. This could be due to an invalid configuration or catalog. Please contact Support for assistance.",
stack_trace=traceback.format_exc(),
),
),
).json()
orjson.dumps(
AirbyteMessageSerializer.dump(
AirbyteMessage(
type=Type.TRACE,
trace=AirbyteTraceMessage(
type=TraceType.ERROR,
emitted_at=time.time_ns() // 1_000_000,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

error=AirbyteErrorTraceMessage(
message="Error starting the sync. This could be due to an invalid configuration or catalog. Please contact Support for assistance.",
stack_trace=traceback.format_exc(),
),
),
)
)
).decode()
)
return None

Expand Down
31 changes: 18 additions & 13 deletions airbyte-integrations/connectors/source-s3/v4_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
#

import sys
import time
import traceback
from datetime import datetime
from typing import List

from airbyte_cdk import AirbyteEntrypoint, AirbyteMessage, Type, launch
from airbyte_cdk.models import AirbyteErrorTraceMessage, AirbyteTraceMessage, TraceType
from airbyte_cdk.models import AirbyteErrorTraceMessage, AirbyteMessageSerializer, AirbyteTraceMessage, TraceType
from orjson import orjson
from source_s3.v4 import Config, Cursor, SourceS3, SourceS3StreamReader


Expand All @@ -27,17 +28,21 @@ def get_source(args: List[str]):
)
except Exception:
print(
AirbyteMessage(
type=Type.TRACE,
trace=AirbyteTraceMessage(
type=TraceType.ERROR,
emitted_at=int(datetime.now().timestamp() * 1000),
error=AirbyteErrorTraceMessage(
message="Error starting the sync. This could be due to an invalid configuration or catalog. Please contact Support for assistance.",
stack_trace=traceback.format_exc(),
),
),
).json()
orjson.dumps(
AirbyteMessageSerializer.dump(
AirbyteMessage(
type=Type.TRACE,
trace=AirbyteTraceMessage(
type=TraceType.ERROR,
emitted_at=time.time_ns() // 1_000_000,
error=AirbyteErrorTraceMessage(
message="Error starting the sync. This could be due to an invalid configuration or catalog. Please contact Support for assistance.",
stack_trace=traceback.format_exc(),
),
),
)
)
).decode()
)
return None

Expand Down
Loading
Loading