database - Cannot DETACH partition using QuestDB REST API - Stack Overflow

admin2025-04-17  4

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 ":9000/exec" --data-urlencode "query=ALTER TABLE events DETACH PARTITION WHERE timestamp < dateadd('M', -8, date_trunc('day', now()))"

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()))"
Share Improve this question asked Jan 30 at 17:18 Javier RamirezJavier Ramirez 4,0951 gold badge27 silver badges36 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

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()))"
转载请注明原文地址:http://anycun.com/QandA/1744902450a89240.html