Javier Ramirez
Javier Ramirez

Reputation: 4032

Cannot DETACH partition using QuestDB REST API

I can run this query just fine from the web console or using psycopg from python

ALTER TABLE events DETACH PARTITION WHERE timestamp < dateadd('M', -8, date_trunc('day', now()))

But when I try invoking the API directly I get an error: method is not allowed

curl -X POST "http://questdb.default.svc.cluster.local:9000/exec" --data-urlencode "query=ALTER TABLE events DETACH PARTITION WHERE timestamp < dateadd('M', -8, date_trunc('day', now()))"

Upvotes: 0

Views: 8

Answers (1)

Javier Ramirez
Javier Ramirez

Reputation: 4032

This was an easy one! The /exec endpoint expects a GET request, unlike the imp endpoint which expects a POST.

curl -G "http://questdb.default.svc.cluster.local:9000/exec" --data-urlencode "query=ALTER TABLE events DETACH PARTITION WHERE timestamp < dateadd('M', -8, date_trunc('day', now()))"

Upvotes: 0

Related Questions