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 Table.delete_rows function allowing deleting rows in a database table. #7238

Closed
jdunkerley opened this issue Jul 7, 2023 · 5 comments · Fixed by #7709
Closed

Add Table.delete_rows function allowing deleting rows in a database table. #7238

jdunkerley opened this issue Jul 7, 2023 · 5 comments · Fixed by #7709
Assignees
Labels
-libs Libraries: New libraries to be implemented l-db-write Libraries: database writer x-new-feature Type: new feature request
Milestone

Comments

@jdunkerley
Copy link
Member

jdunkerley commented Jul 7, 2023

  • Just a Database API. In-Memory should have an Unsupported Operation (join Left Exclusive has same result).
  • For Database, ony can act on a trivial table (as per update_datebase_table).
  • Locked behind the Output context.
  • Dry run doesn't affect the table but should compute the row_count.
  • Source table should be able to be either in-memory (silent upload) or in-database (same connection),
Table.delete_rows
    self -> ## Trivial Table whose rows are will be deleted.
    key_values_to_delete : Table -> ## Extra columns are ignored, primary key columns must exist and must map by name.
    (key_columns : Vector | Nothing = default_key_columns self) -> ## By default uses the primary key of self.
    Integer (row_count of deleted)

For example, my_students.delete_rows (student_leaving_table) ["first_name", "last_name"] returning number of rows (e.g. 31).

Additionally, we should add a function is to delete all rows.
Connection.truncate_table target_table:Table -> Integer returning the row count of deleted.
Similar to drop_table.

Additionally, flip update_database_table to be consistent:

Table.update_rows
    self ->  ## Trivial Table whose rows are will be updated.
    source_table:Table -> ## Set of data
    (update_action : Update_Action = Update_Action.Update_Or_Insert) ->
    (key_columns : Vector | Nothing = default_key_columns self) ->
    (error_on_missing_columns : Boolean = False)
    (on_problems : Problem_Behavior = Problem_Behavior.Report_Warning) 
@jdunkerley jdunkerley converted this from a draft issue Jul 7, 2023
@jdunkerley
Copy link
Member Author

Aim to review on Tuesday 11th

@jdunkerley jdunkerley added the -libs Libraries: New libraries to be implemented label Jul 7, 2023
@radeusgd radeusgd added l-db-write Libraries: database writer x-new-feature Type: new feature request labels Jul 7, 2023
@jdunkerley jdunkerley moved this from ⚙️ Design to 📤 Backlog in Issues Board Jul 13, 2023
@jdunkerley jdunkerley added this to the Beta Release milestone Jul 19, 2023
@jdunkerley jdunkerley changed the title Design for deleting records from a database table Add Table.delete_rows function allowing deleting rows in a database table. Jul 28, 2023
@jdunkerley
Copy link
Member Author

Do we feel that a "filter_rows" where we produce effectively the result but in a query state is useful?

  • Equivalent to a Left Exclusive join effectively.

@jdunkerley jdunkerley removed their assignment Jul 28, 2023
@radeusgd radeusgd moved this from 📤 Backlog to 🔧 Implementation in Issues Board Aug 29, 2023
@enso-bot
Copy link

enso-bot bot commented Aug 30, 2023

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

Progress: Adding new APIs for delete_rows. Clarifying spec and writing docs. Lots of meetings. Drafting a doc on an MVP for library sharing. It should be finished by 2023-09-01.

Next Day: Next day I will be working on the same task. Finish the libraries doc. Update update_rows API. Write tests for delete_rows.

@enso-bot
Copy link

enso-bot bot commented Aug 30, 2023

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

Progress: Posted the libraries "roadmap" doc. Updated the update_rows API - I think the new shape reads much better indeed. Written (I think quite comprehensive set of) tests for delete_rows. It should be finished by 2023-09-01.

Next Day: Next day I will be working on the same task. Implement delete_rows

@radeusgd radeusgd moved this from 🔧 Implementation to 👁️ Code review in Issues Board Aug 31, 2023
@enso-bot
Copy link

enso-bot bot commented Sep 1, 2023

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

Progress: Finished the delete_rows implementation - PR ready for review. Fixing the pending library resolution PR - some errors that I have overlooked earlier. Discussions on Data.post etc. It should be finished by 2023-09-01.

Next Day: Next day I will be working on the #7354 task. Ensure the libraries resolution PR gets merged. Start next task - fixing small defects I found earlier.

@mergify mergify bot closed this as completed in #7709 Sep 7, 2023
mergify bot pushed a commit that referenced this issue Sep 7, 2023
- Closes #7238
- Aligns `update_database_table` to a more consistent and clearer API - `update_rows`.
- Adds a `truncate_table` helper function, to pair up with `drop_table`. Both are `PRIVATE` for now.
- Adds tests for NULLs in keys in `update_rows` and `delete_rows`.
- The behaviour is sometimes unexpected, so instead these fail with `Null_Values_In_Key_Columns`.
- Adds a workaround for oracle/graal#7359
- Adds a workaround for a related bug where a stack frame has no name (its `rootNode.getName() == null`).
- I could not track down this bug to provide a neat repro.
@github-project-automation github-project-automation bot moved this from 👁️ Code review to 🟢 Accepted in Issues Board Sep 7, 2023
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-db-write Libraries: database writer x-new-feature Type: new feature request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants