Local MindsDB
This example shows how to execute SQL statements, either raw or parametrized, on MindsDB via REST APIs.params parameter, or send a parametrized SQL in the query parameter and provide the params parameter that defines the values.import requests
# connect
url = 'http://127.0.0.1:47334/api/sql/query'
# query
resp = requests.post(url, json={
"query": "select * from my_datasource.my_table where name = :name and age = :age",
"params": {"name": "acme", "age": 1},
})
# response
print(resp.text) # alternative: print(resp.json())
params parameter, or send a parametrized SQL in the query parameter and provide the params parameter that defines the values.Was this page helpful?