fix(dameng): separate materialized view metadata
This commit is contained in:
1 parent
ff810f3058
commit
73120883b6
15 files changed
+475
-58
No files matched your search
@@ -608,8 +608,21 @@ impl AgentDriverClient {
|
||||
schema: &str,
|
||||
timeout_duration: Option<Duration>,
|
||||
) -> Result<T, String> {
|
||||
self.call_method_with_timeout(AgentMethod::ListTables, agent_schema_params(database, schema), timeout_duration)
|
||||
.await
|
||||
self.list_tables_filtered(database, schema, None, timeout_duration).await
|
||||
}
|
||||
|
||||
pub async fn list_tables_filtered<T: DeserializeOwned + Send + 'static>(
|
||||
&mut self,
|
||||
database: &str,
|
||||
schema: &str,
|
||||
object_types: Option<&[String]>,
|
||||
timeout_duration: Option<Duration>,
|
||||
) -> Result<T, String> {
|
||||
let mut params = agent_schema_params(database, schema);
|
||||
if let Some(object_types) = object_types {
|
||||
params["object_types"] = serde_json::json!(object_types);
|
||||
}
|
||||
self.call_method_with_timeout(AgentMethod::ListTables, params, timeout_duration).await
|
||||
}
|
||||
|
||||
pub async fn list_objects<T: DeserializeOwned + Send + 'static>(
|
||||
|
||||
@@ -999,7 +999,12 @@ async fn list_tables_once(
|
||||
drop(connections);
|
||||
let mut client = client.lock().await;
|
||||
match client
|
||||
.list_tables::<Vec<db::TableInfo>>(database, schema, agent_metadata_timeout(db_config.as_ref()))
|
||||
.list_tables_filtered::<Vec<db::TableInfo>>(
|
||||
database,
|
||||
schema,
|
||||
object_types,
|
||||
agent_metadata_timeout(db_config.as_ref()),
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(tables) if !tables.is_empty() => {
|
||||
@@ -2834,6 +2839,18 @@ pub async fn get_table_ddl_core(
|
||||
source: source.source,
|
||||
}));
|
||||
}
|
||||
if matches!(object_type, Some(db::ObjectSourceKind::MaterializedView)) {
|
||||
let source = get_object_source_core(
|
||||
state,
|
||||
connection_id,
|
||||
database,
|
||||
schema,
|
||||
table,
|
||||
db::ObjectSourceKind::MaterializedView,
|
||||
)
|
||||
.await?;
|
||||
return Ok(source.source);
|
||||
}
|
||||
|
||||
let pool_key = state.get_or_create_pool(connection_id, Some(database)).await?;
|
||||
let db_config = connection_config(state, connection_id).await;
|
||||
|
||||
Reference in new issue
Block a user