redpanda-data / redpanda-data/connect

Output file mode

Open
#802 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement outputs ux
Dominant language
Go
Stars
8.8k
Forks
969
Avg merge
1d 13h
Merged PRs (30d)
64

Description

I'd like to follow-up on #628 and make sure we come up with something generic that will suit file-based outputs. Right now, I think the following outputs would be in scope: aws_s3, azure_blob_storage, file, gcp_cloud_storage, hdfs, sftp.

I think having a mode field for these is probably the way to go, such that the user can specify what behaviour they'd like to have when the output file already exists: error, overwrite, append, skip (anything else?).

From the comment you left here, I think setting the mode to error would let users implement the dead letter queue pattern with a try broker.

Looking at Go's io package, the following constants are provided:

const (
    // Exactly one of O_RDONLY, O_WRONLY, or O_RDWR must be specified.
    O_RDONLY int = syscall.O_RDONLY // open the file read-only.
    O_WRONLY int = syscall.O_WRONLY // open the file write-only.
    O_RDWR   int = syscall.O_RDWR   // open the file read-write.
    // The remaining values may be or'ed in to control behavior.
    O_APPEND int = syscall.O_APPEND // append data to the file when writing.
    O_CREATE int = syscall.O_CREAT  // create a new file if none exists.
    O_EXCL   int = syscall.O_EXCL   // used with O_CREATE, file must not exist.
    O_SYNC   int = syscall.O_SYNC   // open for synchronous I/O.
    O_TRUNC  int = syscall.O_TRUNC  // truncate regular writable file when opened.
)

As another example, Spark defines the following SaveMode constants:

Append - Append mode means that when saving a DataFrame to a data source, if data/table already exists, contents of the DataFrame are expected to be appended to existing data.
ErrorIfExists - ErrorIfExists mode means that when saving a DataFrame to a data source, if data already exists, an exception is expected to be thrown.
Ignore - Ignore mode means that when saving a DataFrame to a data source, if data already exists, the save operation is expected to not save the contents of the DataFrame and to not change the existing data.
Overwrite - Overwrite mode means that when saving a DataFrame to a data source, if data/table already exists, existing data is expected to be overwritten by the contents of the DataFrame.

WDYT?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading issue #628 and the linked comment, then compare the listed file-based outputs and the Go io and Spark mode references. The issue does not name implementation files or tests; done would require an agreed generic output-mode design and confirmed behavior across the in-scope outputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
data-engineering
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.