MK22
MK22

Reputation: 91

How to delete/clear data from a Kusto table from a python script?

Can we delete data from a Kusto table using purge or clear in a python script using Azure Data Explorer Python SDK?

I'm unable to achieve the data deletion using azure-kusto-data or azure-kusto-ingest packages. Is there a way to achieve this?

Upvotes: 1

Views: 1591

Answers (2)

Ohad Bitton
Ohad Bitton

Reputation: 515

Its important to note that its not recommended to use the purge command if other options suits you. Try to achieve records deletion with retention policy is the best practice. Another option you can consider is using extents tags. Read here for our full disclaimer for using purge https://learn.microsoft.com/en-us/azure/data-explorer/kusto/concepts/data-purge

Upvotes: 0

sheldonzy
sheldonzy

Reputation: 5971

You'll have to run a purge query with azure-kusto-data using KQL.

kusto_client.execute(DB_NAME, purge_query)

Upvotes: 1

Related Questions