-
Notifications
You must be signed in to change notification settings - Fork 8
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
fix: update csv parser for builder compatibility #364
Conversation
📝 WalkthroughWalkthroughThis pull request implements two main changes. In the Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as Caller
participant Parser as CsvParser.parse()
participant Reader as csv.DictReader
Caller->>Parser: parse(data)
Parser->>Reader: Initialize csv.DictReader
loop Iterating each row
Reader-->>Parser: row
Parser-->>Caller: row
end
sequenceDiagram
participant Client as Caller
participant Factory as ModelToComponentFactory.create_csv_decoder()
participant Decoder as CompositeRawDecoder
Client->>Factory: create_csv_decoder(model, config)
alt _emit_connector_builder_messages is True
note right of Factory: set stream_response = False
else
note right of Factory: stream_response remains True
end
Factory->>Decoder: Instantiate with stream_response value
Decoder-->>Factory: csv decoder instance
Factory-->>Client: csv decoder
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (8)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
What
Addresses a couple issues related to enabling the
CsvParser
in the Builder UI.Closed File Error
When trying to parse a CSV file using the declarative
CsvParser
, the following error gets thrown:This seems to be because when we
yield from reader
, the file handle is somehow closed before the data has been read. Iterating and yielding each row seems to resolve the issue.No Records in Builder Read
Specifically when running a test read in the builder, even when getting a successful response with the CSV data included, 0 records are being read:
The issue appears to be because the contents of the record generator are consumed when the records are emitted during read. So no data is subsequently passed to the Builder to be displayed in the testing panel. By flagging the component to specifically not emit messages when in the Builder environment, we can get accurate test results again.
Summary by CodeRabbit