Skip to content
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

Implement remaining Update_Actions for update_database_table. #7035

Merged
merged 11 commits into from
Jun 15, 2023

Conversation

radeusgd
Copy link
Member

Pull Request Description

Closes #6498

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@radeusgd radeusgd self-assigned this Jun 14, 2023
@radeusgd radeusgd force-pushed the wip/radeusgd/update-database-table-contd branch from 9c2a4e4 to e130f02 Compare June 14, 2023 18:43
Copy link
Member

@jdunkerley jdunkerley left a comment

Choose a reason for hiding this comment

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

Looks good - just one thing to consider.

They key columns must be present under the same name in both tables.

This will usually be a query of the form
`DELETE FROM target WHERE (key_columns...) NOT IN (SELECT key_columns... FROM source)`.
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if a DELETE/JOIN would work better.

Add a constant marker to the source, and then something like:

DELETE target
  FROM target 
  LEFT JOIN source ON  ...
 WHERE source.marker is NULL

Copy link
Member Author

Choose a reason for hiding this comment

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

image image

This kind of syntax seems to not be supported in neither of the DBs we currently have.

Copy link
Member Author

Choose a reason for hiding this comment

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

In SQLite the DELETE syntax only allows for a WHERE clause, no joins are available.
image

In Postgres, I guess we may try to play with MERGE but that is for a later ticket, I think - so to be revisited in #7036

@radeusgd radeusgd added the CI: Ready to merge This PR is eligible for automatic merge label Jun 15, 2023
@mergify mergify bot merged commit dad57e6 into develop Jun 15, 2023
28 checks passed
@mergify mergify bot deleted the wip/radeusgd/update-database-table-contd branch June 15, 2023 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add update_database_table to In-Memory table
3 participants