Open Namyalg opened 2 years ago
Another option is to have SQL transactions for renaming attributes. The python sqlite3 library doesn't seem to support transactions by default, but I found this: https://stackoverflow.com/a/23634805/10047268
We can have transactions by this but I think we'll need to manually execute "commit" after each statement in other endpoints if we make the isolation_level
to None
Thank you @YashKandalkar, will take a look
@Namyalg — Any updates on this? It would be good to resolve the merge conflicts as well.
This is not yet resolved
@Namyalg - do you have time to finish this PR? If not, let's file an issue and try to attract other contributions to finish the featureset.
I will work on resolving the issue.
Pull Request Template
Description
This PR adds an endpoint to rename/modify the attribute name of a table
Fixes #177
Type of change
How Has This Been Tested?
The functionality of the endpoint has been tested locally
Working
The endpoint is a
POST
request that takes in the payload as :Using cURL, it can be performed as :
turnover_parameter
, title of simulation asrun4
turnover_parameter
has the attributes (can be obtained using the endpoint/upload/db/tables
) : ["id","foliage","stems","branch","stem_snag","branch_snag","coarse_root","fine_root","branch_snag_split","coarse_ag_split","fine_ag_split"]To rename the attribute
id
toids
, the cURL command isErroneous cases handled
turn_parameter
instead ofturnover_parameter
, the request will result inAttribute
stems
does not exist inturnover_parameter
Questions
In the current design, encountering an error of the 2 types will immediately return from the endpoint with the {
status
: 0,message
:error-that-occured
} . This implies, that the changes or queries that were present earlier will be executed.To provide a robust mechanism, a few other ideas are :
What would the best option amongst these ?
@HarshCasper @aornugent @SanjaySinghRajpoot @YashKandalkar I would like to know your opinions