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

Add update_database_table to In-Memory table #6498

Closed
jdunkerley opened this issue May 2, 2023 · 10 comments · Fixed by #7035
Closed

Add update_database_table to In-Memory table #6498

jdunkerley opened this issue May 2, 2023 · 10 comments · Fixed by #7035
Assignees
Labels
-libs Libraries: New libraries to be implemented l-writedata x-new-feature Type: new feature request
Milestone

Comments

@jdunkerley
Copy link
Member

## Update an existing database table from an in-memory table or database query.

   If an update would affect mutiple rows per key then error process.
   If unmapped columns exists then an error will occur.
   
   If an existing column is missing from the source, we will insert the database
   default value for it. If this results in an error the process will fail. When
   updating a record these columns will be left unchanged.
   If `error_on_missing_columns` is True then all existing columns must be present
   of a `Missing_Column` error will occur.

   If the table doesn't exist then a `Table_Not_Found` error.
   If any of the primary key cannot be mapped a `Primary_Key_Unmatched` error.
   If column types are incompatible then a `Invalid_Value_Type` error.
Table.update_database_table
    connection:Connection
    table_name:Text
    update_action:Update_Action = Update_Action.Update_Or_Insert
    primary_key:Vector Text = Connection.get_primary_key table_name
    multi_row_update: Boolean = False
    match_columns:Match_Columns=Match_Columns.By_Name
    error_on_missing_columns:Boolean = False
    on_problems:Problem_Behavior = Problem_Behavior.Report_Warning
    -> Database_Table

type Update_Action
    ## Records are appended but if cause a primary key clash will fail.
    Insert

    ## Just update the existing records. Unmatched columns are left unchanged.
       Errors if any record is not matched in the target table.
    Update

    ## Append the records to the new table if not found.
       Updates existing records to the new values. Unmatched columns are left unchanged.
    Update_Or_Insert

    ## Appends new records, updates existing records, removes records not in the target table
    Align_Records

A suggestion would be to load a temp table and then do SELECT-INTO / UPDATE.

@github-project-automation github-project-automation bot moved this to ❓New in Issues Board May 2, 2023
@jdunkerley jdunkerley added x-new-feature Type: new feature request -libs Libraries: New libraries to be implemented l-writedata labels May 2, 2023
@jdunkerley jdunkerley added this to the Beta Release milestone May 2, 2023
@jdunkerley jdunkerley moved this from ❓New to 📤 Backlog in Issues Board May 2, 2023
@radeusgd radeusgd moved this from 📤 Backlog to 🔧 Implementation in Issues Board May 30, 2023
@enso-bot
Copy link

enso-bot bot commented Jun 2, 2023

Radosław Waśko reports a new STANDUP for yesterday (2023-06-01):

Progress: Refactoring create_database_table into select_into_database_table and Connection.create_table. Refactoring Update Table structure (creating a separate module for Internals), some support for In_Transaction checks; a simple Set implementation. It should be finished by 2023-06-07.

Next Day: Next day I will be working on the same task. Finish the refactor. Continue writing tests.

@enso-bot
Copy link

enso-bot bot commented Jun 2, 2023

Radosław Waśko reports a new STANDUP for today (2023-06-02):

Progress: finished the refactor and ensured tests are passing. The changes are already big so created a PR for phase 1. Rest will be in separate PR. It should be finished by 2023-06-07.

Next Day: Next day I will be working on the same task. work on follow up - implement the insert and upsert logic

@enso-bot
Copy link

enso-bot bot commented Jun 6, 2023

Radosław Waśko reports a new STANDUP for yesterday (2023-06-05):

Progress: Fixing the PR, continuing work on Insert. Meetings, reviews. It should be finished by 2023-06-07.

Next Day: Next day I will be working on the same task. continue work on insert/upsert logic and tests

mergify bot pushed a commit that referenced this issue Jun 6, 2023
…select_into_database_table`, implement `Set`. (#6925)

First part for #6498 - refactoring of the upload infrastructure, in preparation for `update_database_table`.

Implemented a `Set` data structure which was long needed.

The APIs are added and an initial implementation is created, but it is not complete - but it has grown significantly already so the remaining implementation will be done as a separate PR.

Adds some basic ability for a function to ensure that it is only executed from within a transaction.
@enso-bot
Copy link

enso-bot bot commented Jun 7, 2023

Radosław Waśko reports a new STANDUP for yesterday (2023-06-06):

Progress: Implemented workaround for #6912. writing tests for Insert. more meetings, reviews. It should be finished by 2023-06-07.

Next Day: Next day I will be working on the same task. more tests, continue work on insert/upsert logic

@enso-bot
Copy link

enso-bot bot commented Jun 7, 2023

Radosław Waśko reports a new 🔴 DELAY for today (2023-06-07):

Summary: There is 6 days delay in implementation of the Add update_database_table to In-Memory table (#6498) task.
It will cause 0 days delay for the delivery of this weekly plan.

4 of these 6 days is the long weekend.

Delay Cause: I underestimated the task. I should have split it into smaller pieces (that's what I'm doing with the PRs). Fleshing out the specification and refactoring the related functionality took a lot of time and I did not expec this initially. Also a lot of stuff in parallel (meetings, reviews, bookclubs) so progress was not as fast as I initially anticipated.

@enso-bot
Copy link

enso-bot bot commented Jun 7, 2023

Radosław Waśko reports a new STANDUP for today (2023-06-07):

Progress: Submitted a draft PR implementing the common input validation logic and Insert update action. Implemented tests for all scenarios (other update actions are marked as pending). Most tests are passing. It should be finished by 2023-06-13.

Next Day: Next day I will be working on the same task. Fix the remaining tests and get the 1. Stage PR merged. Continue implementing the remaininga actions.

@enso-bot
Copy link

enso-bot bot commented Jun 13, 2023

Radosław Waśko reports a new STANDUP for yesterday (2023-06-12):

Progress: Preparing the draft PR for review - fixing remaining tests. Implementing column constraints for create_table - needed for unit tests of default value handling because the DDL statements to create the table in the test were not portable enough, so I just extended our existing tool. Helping with legal review on the AWS PR. Meetings. It should be finished by 2023-06-13.

Next Day: Next day I will be working on the same task. Get the PR merged. Catchup on bookclubs. Work on remaining Update-Actions.

@enso-bot
Copy link

enso-bot bot commented Jun 13, 2023

Radosław Waśko reports a new STANDUP for yesterday (2023-06-13):

Progress: Addressing review comments on my PR, fixes. Meetings. Catching up on bookclubs. Reviews. It should be finished by 2023-06-13.

Next Day: Next day I will be working on the same task. Work on remaining Update-Actions.

@enso-bot
Copy link

enso-bot bot commented Jun 14, 2023

Radosław Waśko reports a new 🔴 DELAY for today (2023-06-14):

Summary: There is 1 days delay in implementation of the Add update_database_table to In-Memory table (#6498) task.
It will cause 0 days delay for the delivery of this weekly plan.

Delay Cause: Got the Insert on time but needed one more day for the remaining modes. I greatly underestimated the complexity when estimating initially.

@mergify mergify bot closed this as completed in #7035 Jun 15, 2023
@github-project-automation github-project-automation bot moved this from 🔧 Implementation to 🟢 Accepted in Issues Board Jun 15, 2023
@enso-bot
Copy link

enso-bot bot commented Jun 15, 2023

Radosław Waśko reports a new STANDUP for yesterday (2023-06-14):

Progress: Implemented the remaining Update Actions, prepared a PR. It should be finished by 2023-06-14.

Next Day: Next day I will be working on the #6887 task. Start work on integrating DB write with execution contexts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-libs Libraries: New libraries to be implemented l-writedata x-new-feature Type: new feature request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants