Slackbot
01/23/2024, 12:25 PMMike Sherman
01/23/2024, 2:59 PMpydruid or druidis for interacting with Druid. These libraries can handle common error handling and serialization tasks, simplifying your workflow.Mike Sherman
01/23/2024, 3:00 PMpayload = {"key1": "value1", "key2": 2}
json_payload = json.dumps(payload)
response = <http://session.post|session.post>(url, data=json_payload)
especially given the HTTP 400 you're getting.Mike Sherman
01/23/2024, 3:01 PMGian Merlino
01/23/2024, 3:25 PMresponse.status, when you get an error, to see what it isGian Merlino
01/23/2024, 3:26 PM"stocks_intervals" and "__time" instead of 'stocks_intervals' and '__time'Mike Sherman
01/23/2024, 4:10 PMJohn Masvongo
01/24/2024, 12:57 PMJohn Masvongo
01/24/2024, 1:08 PMMike Sherman
01/24/2024, 1:13 PMquery_string = f"SELECT * FROM \"stocks_intervals\" WHERE \"symbol\" = '{ticker}' AND \"__time\" > TIMESTAMP '{interval}'"
should be:
query_string = f"SELECT * FROM \"stocks_intervals\" WHERE \"symbol\" = {ticker} AND \"__time\" > TIMESTAMP {interval}"
try printing query_string in your Python code or inspecting that variable in your debugger.John Masvongo
01/24/2024, 1:26 PMMike Sherman
01/24/2024, 1:31 PMMike Sherman
01/24/2024, 1:41 PMwikipedia
SELECT * FROM "wikipedia" WHERE "page" = 'Salo Toraut' AND "__time" > TIMESTAMP '2016-06-01'
and that seems to work, so not sure what error you might be seeing with your example.
I usually have POSTMAN set up to run queries and I heavily rely on the router to help with debugging, especially complex issues.
I try to get something working, then make changes to isolate an issue.John Masvongo
01/24/2024, 2:01 PMquery_string = f"SELECT * FROM \"stocks_intervals\" WHERE \"symbol\" = '{ticker}' AND \"__time\" > TIMESTAMP '{interval}'"Mike Sherman
01/24/2024, 3:18 PMJohn Masvongo
02/10/2024, 5:49 AM