Do you want to drop table just with the help of json. Now you can do that , recently I have added drop table functionality with json_server plugin.
HTTP Response.
Send a HTTP request for "DROP TABLE IF_EXISTS [TABLE_NAME]"
Response should be:
If you check with Drop table syntax in SQL. You can use drop table in various ways:
- Drop Table.
- Drop Table If_exists.
- Drop Temporary Table.
Json Server allows to drop table in first two ways only.
How you can drop a table?
Its really simple, just start drizzled server with json_server plugin enabled.And then send a curl request to drop a table.
Here is a demo version:
- Create a schema name as "json" and a table "test" in drizzle database.
- Now send a HTTP request to drizzle server.
curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"query":{"schema_name":"json","table_name":"test"}}' 'http://localhost:8086/json/ddl/table/drop'
{
"sql_state" : "00000"
}
curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"query":{"schema_name":"json","table_name":"test","if_exists":"true"}}' 'http://localhost:8086/json/ddl/table/drop'
{
"sql_state" : "00000"
}
Drizzle internals doesn't allow identifier::Table to drop a table, they use TableList. So Overload a function with identifier::Table as parameter works for me.
Branch related to this work: lp:~mohyt/drizzle/json_server_table
Branch related to this work: lp:~mohyt/drizzle/json_server_table