1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* Hotdata API
*
* Powerful data platform API for datasets, queries, and analytics.
*
* The version of the OpenAPI document: 1.0.0
* Contact: developers@hotdata.dev
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// QueryResponse : Response body for POST /query Query results are returned immediately along with a `result_id` for later retrieval. The actual persistence to storage happens asynchronously in the background. To check if a result is ready for SQL queries, poll GET /results/{id} and check `status`: - `\"processing\"`: Persistence is still in progress - `\"ready\"`: Result is available for retrieval and SQL queries - `\"failed\"`: Persistence failed (check `error_message` for details)
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct QueryResponse {
#[serde(rename = "columns")]
pub columns: Vec<String>,
#[serde(rename = "execution_time_ms")]
pub execution_time_ms: i64,
/// Nullable flags for each column (parallel to columns vec). True if the column allows NULL values, false if NOT NULL.
#[serde(rename = "nullable")]
pub nullable: Vec<bool>,
/// Unique identifier for the query run record (qrun...).
#[serde(rename = "query_run_id")]
pub query_run_id: String,
/// Unique identifier for retrieving this result via GET /results/{id}. Null if catalog registration failed (see `warning` field for details). When non-null, the result is being persisted asynchronously.
#[serde(
rename = "result_id",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub result_id: Option<Option<String>>,
#[serde(rename = "row_count")]
pub row_count: i32,
/// Array of rows, where each row is an array of column values. Values can be strings, numbers, booleans, or null.
#[serde(rename = "rows")]
pub rows: Vec<Vec<serde_json::Value>>,
/// Warning message if result persistence could not be initiated. When present, `result_id` will be null and the result cannot be retrieved later. The query results are still returned in this response.
#[serde(
rename = "warning",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub warning: Option<Option<String>>,
}
impl QueryResponse {
/// Response body for POST /query Query results are returned immediately along with a `result_id` for later retrieval. The actual persistence to storage happens asynchronously in the background. To check if a result is ready for SQL queries, poll GET /results/{id} and check `status`: - `\"processing\"`: Persistence is still in progress - `\"ready\"`: Result is available for retrieval and SQL queries - `\"failed\"`: Persistence failed (check `error_message` for details)
pub fn new(
columns: Vec<String>,
execution_time_ms: i64,
nullable: Vec<bool>,
query_run_id: String,
row_count: i32,
rows: Vec<Vec<serde_json::Value>>,
) -> QueryResponse {
QueryResponse {
columns,
execution_time_ms,
nullable,
query_run_id,
result_id: None,
row_count,
rows,
warning: None,
}
}
}