fix(postgres): ignore non-select queries by houqp · Pull Request #252 · roapi/roapi
| let query = statement.to_string(); | ||
| let df = self.ctx.sql_to_df(&query).await.map_err(df_err_to_sql)?; | ||
| Ok(DataFusionPortal { df }) | ||
| if RoapiContextEngine::<H>::ignored_statement(statement) { |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[minor] will following cleaner if modify slightly?
let query = if RoapiContextEngine::<H>::ignored_statement(statement) {
"SELECT 1 WHERE 1 = 2".to_string()
} else {
statement.to_string()
};
let df = self.ctx.sql_to_df(&query).await.map_err(df_err_to_sql)?;
Ok(DataFusionPortal { df })
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah i agree. I think ideally, we create an empty dataframe in the ignore branch instead of using a workaround query to avoid unnecessary query parsing and execution.