-
Notifications
You must be signed in to change notification settings - Fork 26
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
CSV Upload #1642
base: minor
Are you sure you want to change the base?
CSV Upload #1642
Conversation
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.
The upload button on the entry doesn't seem to get the id, when I attempt the upload the id is undefined, and nothing goes into the table. Side note it does say the import was successful.
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 way too complicated for general plugin / utility.
There is a situation where a very specific update query is executed from the resolution of multiple promises with insert quaeries which have to modules and must receive a body with an array property arr.
I would recommend to cleanup, test, and document POST queries with an array body first.
This is a valid select statement that will return to you the array sent as POST body.
"select_body": {
"template": "SELECT %{body}",
"value_only": true
},
Any rerences to the updateQuery should be removed from the csvUpload utility. These should be handled in the plugin which I would add in a seperate the PR.
The csvUpload utility should be in line with the csvDownload utility which merges multiple array responses into a CSV file.
The csvDownload method should be fully documented before another even more complex utility is added.
The specification for the csvUpload utility method should be to split a csv into seperate array bodies provided as POST body to a SQL query and return an array of responses from the individual queries once all queries are resolved. It must be possible to provide queryparams for the individual queries as well as a parameter for the payload to use in the array split. It should be possible to define whether all queries should be run in parallel or whether the queries should be sent consecutively.
This can be tested with very small csv file and providing a small enough payload param to force this csv to be split into at least two parts to be sent to the simple select %{body} statement which returns the body.
8d07342
to
632605d
Compare
Quality Gate passedIssues Measures |
CSV Uploading
Description
This PR provides a new utility
lib.utils.csvUpload
. This module takes an input and parameters and stores the data to the database in chunks.An
updateQuery
is ran after the importing is successful, which can be used to generate the geometry of rows for example.The module returns a Promise, and an
outcome
object.The
outcome
object will contain asuccess
flag, of true or false indicating the success of the import, and a message, which can be displayed to the user in theplugins.csv_upload
.A new
plugins.csv_upload
has been added, this provides the UI for the CSV Upload - which is a button that opens a dialog for importing. Alerts are used when thePromise
resolves to inform the user of the import.This provides both a
mapp.ui.layers.panels.csv_upload
andmapp.ui.locations.entries.csv_upload
.GitHub Issue
#1676
Type of Change
Please delete options that are not relevant, and select all options that apply.
How have you tested this?
Tested on
bugs_testing/plugins/csv_upload/workspace.json
Testing Checklist
Please delete options that are not relevant, and select all options that apply.
Code Quality Checklist
Please delete options that are not relevant, and select all options that apply.