Skip to content

Commit

Permalink
fix: open duckdb and sqlite in read and write mode
Browse files Browse the repository at this point in the history
  • Loading branch information
frectonz committed Jul 3, 2024
1 parent f4313f7 commit ff5855f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ mod sqlite {

impl Db {
pub async fn open(path: String, query_timeout: Duration) -> color_eyre::Result<Self> {
let conn = Connection::open_with_flags(&path, OpenFlags::SQLITE_OPEN_READ_ONLY).await?;
let conn =
Connection::open_with_flags(&path, OpenFlags::SQLITE_OPEN_READ_WRITE).await?;

// This is meant to test if the file at path is actually a DB.
let tables = conn
Expand Down Expand Up @@ -2018,7 +2019,7 @@ mod duckdb {
pub async fn open(path: String, query_timeout: Duration) -> color_eyre::Result<Self> {
let p = path.to_owned();
let conn = tokio::task::spawn_blocking(move || {
let config = Config::default().access_mode(duckdb::AccessMode::ReadOnly)?;
let config = Config::default().access_mode(duckdb::AccessMode::ReadWrite)?;
let conn = Connection::open_with_flags(p, config)?;

eyre::Ok(conn)
Expand Down

0 comments on commit ff5855f

Please sign in to comment.