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

Method create_database

crates/paimon/src/catalog/filesystem.rs:212–239  ·  view source on GitHub ↗
(
        &self,
        name: &str,
        ignore_if_exists: bool,
        properties: HashMap<String, String>,
    )

Source from the content-addressed store, hash-verified

210 }
211
212 async fn create_database(
213 &self,
214 name: &str,
215 ignore_if_exists: bool,
216 properties: HashMap<String, String>,
217 ) -> Result<()> {
218 if properties.contains_key(DB_LOCATION_PROP) {
219 return Err(Error::ConfigInvalid {
220 message: "Cannot specify location for a database when using fileSystem catalog."
221 .to_string(),
222 });
223 }
224
225 let path = self.database_path(name);
226 let database_exists = self.database_exists(name).await?;
227
228 if !ignore_if_exists && database_exists {
229 return Err(Error::DatabaseAlreadyExist {
230 database: name.to_string(),
231 });
232 }
233
234 if !database_exists {
235 self.file_io.mkdirs(&path).await?;
236 }
237
238 Ok(())
239 }
240
241 async fn get_database(&self, name: &str) -> Result<Database> {
242 if !self.database_exists(name).await? {

Calls 3

database_pathMethod · 0.80
database_existsMethod · 0.80
mkdirsMethod · 0.80