1#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct SqlServiceQueryRequest {
4 #[prost(string, tag = "1")]
5 pub query: ::prost::alloc::string::String,
6 #[prost(int32, optional, tag = "2")]
7 pub max_rows: ::core::option::Option<i32>,
8 #[prost(string, tag = "3")]
9 pub workspace_rid: ::prost::alloc::string::String,
10}
11#[derive(Clone, PartialEq, ::prost::Message)]
12pub struct SqlServiceQueryResponse {
13 #[prost(bytes = "vec", tag = "1")]
14 pub arrow_payload: ::prost::alloc::vec::Vec<u8>,
15 #[prost(string, tag = "2")]
16 pub query_id: ::prost::alloc::string::String,
17}
18#[derive(Clone, PartialEq, ::prost::Message)]
19pub struct SqlServiceExportRequest {
20 #[prost(string, tag = "1")]
21 pub query: ::prost::alloc::string::String,
22 #[prost(string, tag = "2")]
23 pub workspace_rid: ::prost::alloc::string::String,
24}
25#[derive(Clone, PartialEq, ::prost::Message)]
26pub struct SqlServiceExportResponse {
27 #[prost(string, tag = "1")]
28 pub presigned_url: ::prost::alloc::string::String,
29 #[prost(string, tag = "2")]
30 pub query_id: ::prost::alloc::string::String,
31}
32#[derive(Clone, Copy, PartialEq, ::prost::Message)]
33pub struct GetSqlCatalogRequest {}
34#[derive(Clone, PartialEq, ::prost::Message)]
35pub struct SqlCatalogColumn {
36 #[prost(string, tag = "1")]
37 pub name: ::prost::alloc::string::String,
38 #[prost(string, tag = "2")]
39 pub r#type: ::prost::alloc::string::String,
40 #[prost(bool, tag = "3")]
41 pub nullable: bool,
42}
43#[derive(Clone, PartialEq, ::prost::Message)]
44pub struct SqlCatalogTable {
45 #[prost(string, tag = "1")]
46 pub name: ::prost::alloc::string::String,
47 #[prost(message, repeated, tag = "2")]
48 pub columns: ::prost::alloc::vec::Vec<SqlCatalogColumn>,
49}
50#[derive(Clone, PartialEq, ::prost::Message)]
51pub struct SqlCatalogFunction {
52 #[prost(string, tag = "1")]
53 pub name: ::prost::alloc::string::String,
54}
55#[derive(Clone, PartialEq, ::prost::Message)]
56pub struct SqlCatalog {
57 #[prost(message, repeated, tag = "1")]
58 pub tables: ::prost::alloc::vec::Vec<SqlCatalogTable>,
59 #[prost(message, repeated, tag = "2")]
60 pub functions: ::prost::alloc::vec::Vec<SqlCatalogFunction>,
61}
62#[derive(Clone, PartialEq, ::prost::Message)]
63pub struct GetSqlCatalogResponse {
64 #[prost(message, optional, tag = "1")]
65 pub sql_catalog: ::core::option::Option<SqlCatalog>,
66}
67#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
68#[repr(i32)]
69pub enum SqlError {
70 Unspecified = 0,
71 InvalidQuery = 1,
72 DatasetsNotFound = 2,
73 ExecutionFailed = 3,
74 ExportNotSupportedForBackend = 4,
75 ExportNotConfigured = 5,
76 QueryTimeout = 6,
77 ResourceExhausted = 7,
78 DatasetStorageTypeNotSupported = 8,
79}
80impl SqlError {
81 pub fn as_str_name(&self) -> &'static str {
86 match self {
87 Self::Unspecified => "SQL_ERROR_UNSPECIFIED",
88 Self::InvalidQuery => "SQL_ERROR_INVALID_QUERY",
89 Self::DatasetsNotFound => "SQL_ERROR_DATASETS_NOT_FOUND",
90 Self::ExecutionFailed => "SQL_ERROR_EXECUTION_FAILED",
91 Self::ExportNotSupportedForBackend => {
92 "SQL_ERROR_EXPORT_NOT_SUPPORTED_FOR_BACKEND"
93 }
94 Self::ExportNotConfigured => "SQL_ERROR_EXPORT_NOT_CONFIGURED",
95 Self::QueryTimeout => "SQL_ERROR_QUERY_TIMEOUT",
96 Self::ResourceExhausted => "SQL_ERROR_RESOURCE_EXHAUSTED",
97 Self::DatasetStorageTypeNotSupported => {
98 "SQL_ERROR_DATASET_STORAGE_TYPE_NOT_SUPPORTED"
99 }
100 }
101 }
102 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
104 match value {
105 "SQL_ERROR_UNSPECIFIED" => Some(Self::Unspecified),
106 "SQL_ERROR_INVALID_QUERY" => Some(Self::InvalidQuery),
107 "SQL_ERROR_DATASETS_NOT_FOUND" => Some(Self::DatasetsNotFound),
108 "SQL_ERROR_EXECUTION_FAILED" => Some(Self::ExecutionFailed),
109 "SQL_ERROR_EXPORT_NOT_SUPPORTED_FOR_BACKEND" => {
110 Some(Self::ExportNotSupportedForBackend)
111 }
112 "SQL_ERROR_EXPORT_NOT_CONFIGURED" => Some(Self::ExportNotConfigured),
113 "SQL_ERROR_QUERY_TIMEOUT" => Some(Self::QueryTimeout),
114 "SQL_ERROR_RESOURCE_EXHAUSTED" => Some(Self::ResourceExhausted),
115 "SQL_ERROR_DATASET_STORAGE_TYPE_NOT_SUPPORTED" => {
116 Some(Self::DatasetStorageTypeNotSupported)
117 }
118 _ => None,
119 }
120 }
121}
122pub mod sql_service_client {
124 #![allow(
125 unused_variables,
126 dead_code,
127 missing_docs,
128 clippy::wildcard_imports,
129 clippy::let_unit_value,
130 )]
131 use tonic::codegen::*;
132 use tonic::codegen::http::Uri;
133 #[derive(Debug, Clone)]
134 pub struct SqlServiceClient<T> {
135 inner: tonic::client::Grpc<T>,
136 }
137 impl SqlServiceClient<tonic::transport::Channel> {
138 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
140 where
141 D: TryInto<tonic::transport::Endpoint>,
142 D::Error: Into<StdError>,
143 {
144 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
145 Ok(Self::new(conn))
146 }
147 }
148 impl<T> SqlServiceClient<T>
149 where
150 T: tonic::client::GrpcService<tonic::body::Body>,
151 T::Error: Into<StdError>,
152 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
153 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
154 {
155 pub fn new(inner: T) -> Self {
156 let inner = tonic::client::Grpc::new(inner);
157 Self { inner }
158 }
159 pub fn with_origin(inner: T, origin: Uri) -> Self {
160 let inner = tonic::client::Grpc::with_origin(inner, origin);
161 Self { inner }
162 }
163 pub fn with_interceptor<F>(
164 inner: T,
165 interceptor: F,
166 ) -> SqlServiceClient<InterceptedService<T, F>>
167 where
168 F: tonic::service::Interceptor,
169 T::ResponseBody: Default,
170 T: tonic::codegen::Service<
171 http::Request<tonic::body::Body>,
172 Response = http::Response<
173 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
174 >,
175 >,
176 <T as tonic::codegen::Service<
177 http::Request<tonic::body::Body>,
178 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
179 {
180 SqlServiceClient::new(InterceptedService::new(inner, interceptor))
181 }
182 #[must_use]
187 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
188 self.inner = self.inner.send_compressed(encoding);
189 self
190 }
191 #[must_use]
193 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
194 self.inner = self.inner.accept_compressed(encoding);
195 self
196 }
197 #[must_use]
201 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
202 self.inner = self.inner.max_decoding_message_size(limit);
203 self
204 }
205 #[must_use]
209 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
210 self.inner = self.inner.max_encoding_message_size(limit);
211 self
212 }
213 pub async fn query(
214 &mut self,
215 request: impl tonic::IntoRequest<super::SqlServiceQueryRequest>,
216 ) -> std::result::Result<
217 tonic::Response<super::SqlServiceQueryResponse>,
218 tonic::Status,
219 > {
220 self.inner
221 .ready()
222 .await
223 .map_err(|e| {
224 tonic::Status::unknown(
225 format!("Service was not ready: {}", e.into()),
226 )
227 })?;
228 let codec = tonic::codec::ProstCodec::default();
229 let path = http::uri::PathAndQuery::from_static(
230 "/nominal.sql.v1.SqlService/Query",
231 );
232 let mut req = request.into_request();
233 req.extensions_mut()
234 .insert(GrpcMethod::new("nominal.sql.v1.SqlService", "Query"));
235 self.inner.unary(req, path, codec).await
236 }
237 pub async fn export(
238 &mut self,
239 request: impl tonic::IntoRequest<super::SqlServiceExportRequest>,
240 ) -> std::result::Result<
241 tonic::Response<super::SqlServiceExportResponse>,
242 tonic::Status,
243 > {
244 self.inner
245 .ready()
246 .await
247 .map_err(|e| {
248 tonic::Status::unknown(
249 format!("Service was not ready: {}", e.into()),
250 )
251 })?;
252 let codec = tonic::codec::ProstCodec::default();
253 let path = http::uri::PathAndQuery::from_static(
254 "/nominal.sql.v1.SqlService/Export",
255 );
256 let mut req = request.into_request();
257 req.extensions_mut()
258 .insert(GrpcMethod::new("nominal.sql.v1.SqlService", "Export"));
259 self.inner.unary(req, path, codec).await
260 }
261 pub async fn get_sql_catalog(
262 &mut self,
263 request: impl tonic::IntoRequest<super::GetSqlCatalogRequest>,
264 ) -> std::result::Result<
265 tonic::Response<super::GetSqlCatalogResponse>,
266 tonic::Status,
267 > {
268 self.inner
269 .ready()
270 .await
271 .map_err(|e| {
272 tonic::Status::unknown(
273 format!("Service was not ready: {}", e.into()),
274 )
275 })?;
276 let codec = tonic::codec::ProstCodec::default();
277 let path = http::uri::PathAndQuery::from_static(
278 "/nominal.sql.v1.SqlService/GetSqlCatalog",
279 );
280 let mut req = request.into_request();
281 req.extensions_mut()
282 .insert(GrpcMethod::new("nominal.sql.v1.SqlService", "GetSqlCatalog"));
283 self.inner.unary(req, path, codec).await
284 }
285 }
286}