Open simonw opened 2 years ago
Basic version of this allows you to rename a table:
POST /db/table/-/rename
{
"name": "new_table_name"
}
If a table with that new name already exists you will get an error - unless you pass "replace": true
in which case that table will be dropped and replaced by the new one.
POST /db/table/-/rename
{
"name": "new_table_name",
"replace": true
}
This is useful because it allows for that atomic replacement operation: upload brand new data into a _tmp_name
table, then atomic rename and replace after the upload has completed.
Originally posted by @simonw in https://github.com/simonw/datasette/issues/1866#issuecomment-1293893789