MCPcopy Create free account
hub / github.com/apache/paimon-rust / set_current_database

Method set_current_database

crates/integrations/datafusion/src/sql_context.rs:170–182  ·  view source on GitHub ↗

Sets the current database for unqualified table references.

(&self, database_name: &str)

Source from the content-addressed store, hash-verified

168
169 /// Sets the current database for unqualified table references.
170 pub async fn set_current_database(&self, database_name: &str) -> DFResult<()> {
171 if database_name.contains('\'') {
172 return Err(DataFusionError::Plan(
173 "Database name must not contain single quotes".to_string(),
174 ));
175 }
176 self.ctx
177 .sql(&format!(
178 "SET datafusion.catalog.default_schema = '{database_name}'"
179 ))
180 .await?;
181 Ok(())
182 }
183
184 /// Returns a reference to the inner [`SessionContext`].
185 pub fn ctx(&self) -> &SessionContext {

Calls 3

containsMethod · 0.80
PlanClass · 0.50
sqlMethod · 0.45