GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add incremental export and cross account export functionality in `DynamoDBToS3Operator` by Ghoul-SSZ · Pull Request #41304 · apache/airflow

Conversation

@Ghoul-SSZ

@Ghoul-SSZ Ghoul-SSZ commented Aug 7, 2024

Copy link
Copy Markdown

Problem

  1. Currently the DynamoDBToS3Operator only supports 2 ways of downloading data: "full export using scan" or "full exports using boto3's export_table_to_point_in_time". When using export_table_to_point_in_time method, you can also use "Incremental Export" instead of "Full Export" if you only wish for the delta of the data changes between the specified period. However this functionality is currently not supported in the DynamoDBToS3Operator.
  2. There are times we need to export the data from 1 AWS account (Account A) to another account (Account B). In the full export using scan method, you can specify 2 aws connection to facilitate this need. But for export_table_to_point_in_time, we would need an additional argument (s3_bucket_owner) to allow cross account export.

Proposed Changes

  1. Replace the export_time arg with a boolean value make the Operator more visible that it is doing a point in time export.
  2. Add export_type, incremental_export_from_time , incremental_export_to_time , incremental_export_view_type arguments to allow Incremental Export.
  3. Add s3_bucket_owner arguments to allow cross-account export

closes: #40737
related: #40737


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Yaworski-Joseph-bah reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Steven Shidi Zhou added 6 commits August 6, 2024 21:41
Steven Shidi Zhou
Add incremental export and cross account export functionality
6645c6a
Steven Shidi Zhou
replacements of right single quotation with straight one
9d3f188
Steven Shidi Zhou
convert str.format into f-strings
3ff5ba5
Steven Shidi Zhou
Add default value to s3_bucket_owner and update comments
dc9b48a
Steven Shidi Zhou
update tests
9fa988a
Steven Shidi Zhou
update readme and documentation
56b5c46
@Ghoul-SSZ
Ghoul-SSZ requested review from eladkal and o-nikolas as code owners August 7, 2024 11:31
@boring-cyborg boring-cyborg Bot added area:providers area:system-tests kind:documentation provider:amazon AWS/Amazon - related issues provider:fab labels Aug 7, 2024
@boring-cyborg

boring-cyborg Bot commented Aug 7, 2024

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: [email protected]
    Slack: https://s.apache.org/airflow-slack
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Steven Shidi Zhou added 2 commits August 7, 2024 13:57
Steven Shidi Zhou
Merge branch 'main' into feature/add-point-in-time-export-functionali…
35d40a9
…ty-for-DynamoDBToS3Operator
Steven Shidi Zhou
Merge branch 'main' into feature/add-point-in-time-export-functionali…
078b7d8
…ty-for-DynamoDBToS3Operator
eladkal
eladkal reviewed Aug 10, 2024
View reviewed changes
Comment thread airflow/providers/fab/auth_manager/cli_commands/user_command.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@eladkal
eladkal requested review from ferruzzi and vincbeck August 10, 2024 04:23
@eladkal eladkal changed the title Add incremental export and cross account export functionality Add incremental export and cross account export functionality in DynamoDBToS3Operator Aug 10, 2024
Steven Shidi Zhou added 10 commits August 11, 2024 18:08
Steven Shidi Zhou
revert f-string changes to the original state
b05690c
Steven Shidi Zhou
Merge branch 'main' into feature/add-point-in-time-export-functionali…
493f507
…ty-for-DynamoDBToS3Operator
Steven Shidi Zhou
Merge branch 'main' into feature/add-point-in-time-export-functionali…
76b5522
…ty-for-DynamoDBToS3Operator
Steven Shidi Zhou
Merge branch 'main' into feature/add-point-in-time-export-functionali…
27436c4
…ty-for-DynamoDBToS3Operator
Steven Shidi Zhou
fix doc build error for DynamoDBToS3 Operator point-in-time export
7dc0b6a
Steven Shidi Zhou
Merge branch 'main' into feature/add-point-in-time-export-functionali…
6b7ce52
…ty-for-DynamoDBToS3Operator
Steven Shidi Zhou
Merge branch 'main' into feature/add-point-in-time-export-functionali…
cd8fca0
…ty-for-DynamoDBToS3Operator
Steven Shidi Zhou
fix task id to match the operator logic
1082149
Steven Shidi Zhou
Merge branch 'main' into feature/add-point-in-time-export-functionali…
33c203a
…ty-for-DynamoDBToS3Operator
Steven Shidi Zhou
Merge branch 'main' into feature/add-point-in-time-export-functionali…
9d74345
…ty-for-DynamoDBToS3Operator
Steven Shidi Zhou
Merge branch 'main' into feature/add-point-in-time-export-functionali…
0a195aa
…ty-for-DynamoDBToS3Operator
vincbeck
vincbeck approved these changes Aug 13, 2024
View reviewed changes

@vincbeck vincbeck left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Very nice work!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Ghoul-SSZ reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@vincbeck

vincbeck commented Aug 13, 2024

Copy link
Copy Markdown
Contributor

Static checks are failing. Could you please run them

Ghoul-SSZ reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Steven Shidi Zhou added 2 commits August 14, 2024 01:17
Steven Shidi Zhou
ruff linting: move import to appropriate posistion
197fb43
Steven Shidi Zhou
Merge branch 'main' into feature/add-point-in-time-export-functionali…
f3a0083
…ty-for-DynamoDBToS3Operator
@Ghoul-SSZ

Ghoul-SSZ commented Aug 13, 2024

Copy link
Copy Markdown
Author

I have ran and update the import so that the Static checks should pass.

However, I have noticed that documentation build and spell checks have failed in the GitHub Action for commit 0a195aa but are not related to my changes.

Should I try to fix those now or maybe open a different Pull Request for it?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Steven Shidi Zhou
Merge branch 'main' into feature/add-point-in-time-export-functionali…
44cdeac
…ty-for-DynamoDBToS3Operator
@vincbeck

vincbeck commented Aug 14, 2024

Copy link
Copy Markdown
Contributor

I have ran and update the import so that the Static checks should pass.

However, I have noticed that documentation build and spell checks have failed in the GitHub Action for commit 0a195aa but are not related to my changes.

Should I try to fix those now or maybe open a different Pull Request for it?

I think it has been fixed by #41449, could you please update your fork and update this branch? It should solve the issue

Ghoul-SSZ reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Steven Shidi Zhou added 3 commits August 14, 2024 16:46
Steven Shidi Zhou
Merge branch 'main' into feature/add-point-in-time-export-functionali…
38a3b00
…ty-for-DynamoDBToS3Operator
Steven Shidi Zhou
Merge branch 'main' into feature/add-point-in-time-export-functionali…
c4085ba
…ty-for-DynamoDBToS3Operator
Steven Shidi Zhou
Merge branch 'main' into feature/add-point-in-time-export-functionali…
a111edc
…ty-for-DynamoDBToS3Operator
@Ghoul-SSZ

Ghoul-SSZ commented Aug 14, 2024

Copy link
Copy Markdown
Author

I have ran and update the import so that the Static checks should pass.
However, I have noticed that documentation build and spell checks have failed in the GitHub Action for commit 0a195aa but are not related to my changes.
Should I try to fix those now or maybe open a different Pull Request for it?

I think it has been fixed by #41449, could you please update your fork and update this branch? It should solve the issue

Looks like it is still failing. 😞

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vincbeck
vincbeck reviewed Aug 14, 2024
View reviewed changes
Comment thread airflow/providers/amazon/aws/transfers/dynamodb_to_s3.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@vincbeck
Update airflow/providers/amazon/aws/transfers/dynamodb_to_s3.py
0ed60a5
@vincbeck

vincbeck commented Aug 14, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

I resolved the doc building issue. Now, there is one unit test (Kubernetes provider) that is failing. It is definitely not related to this PR

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vincbeck

vincbeck commented Aug 14, 2024

Copy link
Copy Markdown
Contributor

But I am not sure what is going on either ....

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Ghoul-SSZ

Ghoul-SSZ commented Aug 14, 2024

Copy link
Copy Markdown
Author

But I am not sure what is going on either ....

yeah it is strange. I will also try to look at it tomorrow when I have time

vincbeck reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vincbeck

vincbeck commented Aug 15, 2024

Copy link
Copy Markdown
Contributor

It has been fixed in #41500, please rebase your PR :)

Ghoul-SSZ reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Steven Shidi Zhou
Merge branch 'main' into feature/add-point-in-time-export-functionali…
d950db2
…ty-for-DynamoDBToS3Operator
@Ghoul-SSZ

Ghoul-SSZ commented Aug 15, 2024

Copy link
Copy Markdown
Author

It has been fixed in #41500, please rebase your PR :)

All checks have passed! 🎉

Saziba reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vincbeck
vincbeck merged commit a70ee72 into apache:main Aug 15, 2024
@boring-cyborg

boring-cyborg Bot commented Aug 15, 2024

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Ghoul-SSZ
Ghoul-SSZ deleted the feature/add-point-in-time-export-functionality-for-DynamoDBToS3Operator branch August 15, 2024 16:57
ferruzzi
ferruzzi reviewed Aug 15, 2024
View reviewed changes

@ferruzzi ferruzzi left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This change has caused the test to start failing. I have found at least three issues; two I have left the fix for in the comments, the third I'm not sure yet. @Ghoul-SSZ - can you have a look and try to make the fixes?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread tests/system/providers/amazon/aws/example_dynamodb_to_s3.py
Comment on lines 227 to +228
export_time,
backup_db_to_point_in_time,
backup_db_to_point_in_time_full_export,

@ferruzzi ferruzzi Aug 15, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Insert latest_export_time between these two lines

       export_time,
       latest_export_time
       backup_db_to_point_in_time_full_export,

Without it listed in the chain(), it fires off at the very beginning and causes the test to fail because env_id isn't populated yet.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ferruzzi ferruzzi Aug 16, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

fixed in #41517

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread airflow/providers/amazon/aws/transfers/dynamodb_to_s3.py
self.point_in_time_export = point_in_time_export
self.export_time = export_time
self.export_format = export_format
self.export_table_to_point_in_time_kwargs = export_table_to_point_in_time_kwargs

@ferruzzi ferruzzi Aug 15, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

this needs to be

self.export_table_to_point_in_time_kwargs = export_table_to_point_in_time_kwargs or {}

otherwise if None is passed in, Line 199 fails because None can't be unpacked.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ferruzzi ferruzzi Aug 16, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

fixed in #41517

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread tests/system/providers/amazon/aws/example_dynamodb_to_s3.py
Comment on lines +196 to +197
"ExportFromTime": export_time,
"ExportToTime": latest_export_time,

@ferruzzi ferruzzi Aug 15, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This is an issue I have run out of time for today. with the other two fixes applied locally, the test keeps failing and I've tried a number of solutions. Here's what I've found so far:

error: "from" time can't be equal to "to" time
tried: so I set "from" to export_time - 1_minute
error: "from" can't be less than table creation time
tried: revert the above and set "to" to be latest_export_time + 1_minute
error: Difference between "from" time and "to" is less than 15 minutes
tried: revert the above and set "to" to be latest_export_time + 16_minutes
error: "to" time cannot be greater than the current time
tried: revert the above and set "to" time to utcnow()
error: this gets set at parse time and "to" time is now in the past

We will either need to figure out a way to make this happy or set that task to not run using an unreachable trigger_rule or a branch operator to skip it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@vincbeck vincbeck Aug 16, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

"error: Difference between "from" time and "to" is less than 15 minutes" is the most scary. That means we need to wait for 15 minutes so that we can create the incremental export. In that case we dont want to run it as part of the system test, so either we delete it from the system test, or we, somehow, skip it

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ferruzzi reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@ferruzzi ferruzzi Aug 16, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I agree. I just put up #41546 which skips that task. That way we can still have the snippet in the docs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced Aug 15, 2024
Partial fix for example_dynamodb_to_s3.py #41517
Merged
Skip task in example_dynamodb_to_s3.py #41546
Merged
Artuz37 pushed a commit to Artuz37/airflow that referenced this pull request Aug 19, 2024
Steven Shidi Zhou @vincbeck @Artuz37
Add incremental export and cross account export functionality in `Dyn…
56fb450
…amoDBToS3Operator` (apache#41304)



---------

Co-authored-by: Vincent <[email protected]>
@eladkal eladkal mentioned this pull request Aug 19, 2024
Status of testing Providers that were prepared on August 19, 2024 #41577
Closed
29 of 43 tasks
romsharon98 pushed a commit to romsharon98/airflow that referenced this pull request Aug 20, 2024
Steven Shidi Zhou @vincbeck @romsharon98
Add incremental export and cross account export functionality in `Dyn…
0bee859
…amoDBToS3Operator` (apache#41304)



---------

Co-authored-by: Vincent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ferruzzi ferruzzi ferruzzi left review comments
@eladkal eladkal eladkal left review comments
@vincbeck vincbeck vincbeck approved these changes
@o-nikolas o-nikolas Awaiting requested review from o-nikolas

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

area:providers area:system-tests kind:documentation provider:amazon AWS/Amazon - related issues provider:fab

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

DynamoDBToS3Operator using native export functionality.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@Ghoul-SSZ @vincbeck @ferruzzi @eladkal
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.