kyma_graph/executor.rs
1//! The seam that lets the stored-graph provider run SQL over node/edge tables
2//! without `kyma-graph` depending on the engine. `kyma-server` implements this
3//! over its DataFusion query path.
4
5use async_trait::async_trait;
6
7/// One result row: column name -> JSON value.
8pub type JsonRow = serde_json::Map<String, serde_json::Value>;
9
10#[async_trait]
11pub trait GraphQueryExecutor: Send + Sync {
12 /// Run `sql` against `database`'s tables, returning rows as JSON objects.
13 async fn query(&self, database: &str, sql: String) -> anyhow::Result<Vec<JsonRow>>;
14}
15
16/// Column roles + table names for a registered graph (decoupled mirror of the
17/// catalog's `GraphRegistration`). The server maps registration → this.
18#[derive(Debug, Clone)]
19pub struct StoredGraphConfig {
20 pub database: String,
21 pub node_table: String,
22 pub edge_table: String,
23 pub id_col: String,
24 pub label_col: String,
25 pub src_col: String,
26 pub dst_col: String,
27 pub type_col: String,
28 pub realm_col: Option<String>,
29}