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

Update table data via CSV import #10313

Merged
merged 9 commits into from
May 25, 2023

Conversation

melohagan
Copy link
Collaborator

@melohagan melohagan commented Apr 14, 2023

Description

Added a toggle for internal DB CSV imports that allows a user to update existing rows.
You choose one or more fields to match for the update. This could easily be changed to a single options picker if that's easier to understand for the user.

I choose to only make this option available for the Internal DB because to be honest I wasn't able to figure out how to do an upsert with Knex - the blogs I saw were for a specific DB implementation and not a generic one.
Also an upsert would also need to be implemented for Google Sheets, so it may be worth adding this feature just for the Internal DB to start with.

There is also no import verification for uniqueness. As it is, it's up to the user to pick fields appropriately, but a check could potentially be added.

Addresses:

Screenshots

Insert mode
Screenshot 2023-04-14 at 22 56 08

Duplicate row:
Screenshot 2023-04-14 at 22 57 19

Upsert mode (one key field)
Screenshot 2023-04-14 at 23 01 18

Upsert mode (multiple key fields)
Screenshot 2023-04-14 at 23 03 40

Original row updated:
Screenshot 2023-04-14 at 23 01 45

@codecov-commenter
Copy link

codecov-commenter commented Apr 14, 2023

Codecov Report

Merging #10313 (743b7d5) into develop (59b81d1) will decrease coverage by 0.72%.
The diff coverage is 31.57%.

❗ Current head 743b7d5 differs from pull request most recent head 2d543d9. Consider uploading reports for the commit 2d543d9 to get more accurate results

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@             Coverage Diff             @@
##           develop   #10313      +/-   ##
===========================================
- Coverage    69.88%   69.16%   -0.72%     
===========================================
  Files          536      524      -12     
  Lines        19537    19306     -231     
  Branches      3893     3840      -53     
===========================================
- Hits         13653    13353     -300     
- Misses        5449     5517      +68     
- Partials       435      436       +1     
Impacted Files Coverage Δ
packages/server/src/api/controllers/table/utils.ts 66.66% <23.52%> (-3.90%) ⬇️
...kages/server/src/api/controllers/table/internal.ts 84.26% <100.00%> (ø)

... and 116 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Collaborator

@mike12345567 mike12345567 left a comment

Choose a reason for hiding this comment

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

EDIT - failed to notice the table type being passed around - all good.

@melohagan melohagan merged commit d77568c into develop May 25, 2023
@melohagan melohagan deleted the budi-5688-update-table-data-via-csv-import branch May 25, 2023 17:05
@github-actions github-actions bot locked and limited conversation to collaborators May 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants