InfluxDB.Client.Net icon indicating copy to clipboard operation
InfluxDB.Client.Net copied to clipboard

Is there anyway to delete an existing database?

Open Gothic-X opened this issue 7 years ago • 3 comments

Is there any native support for deleting a database?

If not, is the best solution to use QueryMultiSeriesAsync with the following query syntax: DROP DATABASE <database_name>

Gothic-X avatar Jul 07 '19 01:07 Gothic-X

yeah, no native methods yet. Influx recently responds with an error response (http 200, with a message) for DML in Get (which is used in QueryMultiSeriesAsync). Can you give it a shot and confirm it works? if not I will try to add a native method.

mvadu avatar Jul 07 '19 22:07 mvadu

Will do. I'll let you know the outcome

Gothic-X avatar Jul 07 '19 22:07 Gothic-X

@mvadu - I was able to drop the database using the following code.

// Delete the data source
await client.QueryMultiSeriesAsync(database, $"DROP DATABASE {database}");

Gothic-X avatar Jul 17 '19 19:07 Gothic-X