Skip to content

Commit 2f0667e

Browse files
committed
MongoDB DML
1 parent b798c39 commit 2f0667e

9 files changed

Lines changed: 844 additions & 32 deletions

File tree

core/src/mongodb.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ pub mod connection;
22
pub mod connection_pool;
33
pub mod table;
44
pub mod utils;
5+
pub mod write;
56

67
use crate::mongodb::connection_pool::MongoDBConnectionPool;
78
use crate::mongodb::table::MongoDBTable;
9+
use crate::mongodb::write::MongoDBTableWriter;
810
use arrow_schema::ArrowError;
911
use datafusion::datasource::TableProvider;
1012
use datafusion::sql::TableReference;
@@ -85,4 +87,16 @@ impl MongoDBTableFactory {
8587

8688
Ok(table_provider)
8789
}
90+
91+
pub async fn read_write_table_provider(
92+
&self,
93+
table_reference: TableReference,
94+
) -> Result<Arc<dyn TableProvider + 'static>, Box<dyn std::error::Error + Send + Sync>> {
95+
let read_provider = self.table_provider(table_reference.clone()).await?;
96+
Ok(MongoDBTableWriter::create(
97+
read_provider,
98+
Arc::clone(&self.pool),
99+
table_reference,
100+
))
101+
}
88102
}

0 commit comments

Comments
 (0)