Prepared statements
Prepared statements provide optimized query execution for online serving by pre-compiling and caching transformation logic. Access these procedures through REST or gRPC endpoints for maximum performance.
Create prepared statements
Prepared statements are based on existing features.
You need to create these other features first.
Then use an independant query to surface them as a prepared statement.
You can see the result of it using DESCRIBE.
Execute prepared statements
Testing and Development
Call the prepared statement with a REST api call to the online service.
For example from a python notebook:
import requests
import json
def call_prepared_statement(feature_name: str, inputs: dict[str, list[Any]]) -> str:
params_post = {
"statement": {
"id": feature_name,
"inputs": inputs
}
}
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
}
response = requests.post("http://localhost:10090/api/v1/featureql", json=params_post, headers=headers, timeout=30, verify=False)
if response.status_code == 200:
return response.json()
else:
print(f'A non HTTP 200 response occured: {response=}: {response.text}') python
or from a curl command:
curl -X POST "http://localhost:10090/api/v1/featureql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
--connect-timeout 30 \
--insecure \
-d '{
"statement": {
"id": "FEATURE_NAME_HERE",
"inputs": {
"key1": ["value1", "value2"],
"key2": ["value3"]
}
}
}' bash
Production Usage
Optimisation is key here and you can call prepared statements with HTTP, gRPC or Arrow Flight, or use our SDK libraries in different languages.
Coming soon
More details will be added soon.