Skip to content

fix(flows): FlowAppendView support for 'once' flag by forcing batch read#22

Merged
liamperritt merged 3 commits intodatabricks-solutions:mainfrom
liamperritt:fix/append-view-once
Apr 7, 2026
Merged

fix(flows): FlowAppendView support for 'once' flag by forcing batch read#22
liamperritt merged 3 commits intodatabricks-solutions:mainfrom
liamperritt:fix/append-view-once

Conversation

@liamperritt
Copy link
Copy Markdown
Collaborator

Implementing a fix for appending views using the 'once' flag by ensuring the returned value is a batch DataFrame, not a streaming DataFrame.

As outlined in the append_flow documentation:

Using once=True changes the flow: the return value must be a batch DataFrame in this case, not a streaming DataFrame.

Currently, configuring the 'once' flag with a batch data source fails with:
View is not a streaming view and must be referenced using read.

I've tested this fix manually, and it resolves the issue: it successfully appends a one-time batch flow into the target streaming table, as expected.

@rederik76 rederik76 linked an issue Mar 26, 2026 that may be closed by this pull request
1 task
@rederik76 rederik76 changed the title Fix FlowAppendView support for 'once' flag by forcing batch read fix(flows): FlowAppendView support for 'once' flag by forcing batch read Mar 27, 2026
@PremRajendran
Copy link
Copy Markdown
Collaborator

LGTM

spark = self.spark
spark_reader = spark.readStream
if self.once:
spark_reader = spark.read
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what happens in streaming flows if you have this turned on, have we tested this? and can we please add a sample for this as well if possible

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I've successfully tested this manually, but I'm happy to add a sample as well.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

awesome, yeah that would be good if you could add one into the features samples under bronze, we use these as regression testing for now and will later turn into the tests for CICD pipeline so if we have a test for every feature that would help make sure we don't break anything on future developments

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ok, sounds good.

I just finished testing this change on new samples locally with these results:

  • When the source view has mode: batch, the flow succeeds (the batch view is inserted "once" into the target streaming table during the initial pipeline run, and then ignored in subsequent runs).
  • When the source view has mode: stream, the flow fails with View 'v_append_view_once_stream_flow' is a streaming view and must be referenced using readStream.

This behaviour is expected, as customers should only ever use a batch view as the source for an append once flow. As outlined in the append_flow documentation:

Using once=True changes the flow: the return value must be a batch DataFrame in this case, not a streaming DataFrame.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@liamperritt liamperritt merged commit f6fe798 into databricks-solutions:main Apr 7, 2026
haillew pushed a commit that referenced this pull request Apr 10, 2026
…ead (#22)

* Fix FlowAppendView support for 'once' flag by forcing batch read

* Add new sample dataflow for append_view_once_flow

* Improve flow name in append_view_once dataflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Run once append view flow throws exception

3 participants