Yeah so this MWE
shows the issue
- On macOS 15.2
- Julia 1.11.3
If you execute this code in Julia REPL and keep the REPL running once the code is executed. And then try to access the datafile from another CLI you should see the following error message.
> duckdb duckdata.db
Error: unable to open database "duckdata.db": IO Error: Could not set lock on file "duckdata.db": Conflicting lock is held in /Users/abisen/.julia/juliaup/julia-1.11.3+0.aarch64.apple.darwin14/bin/julia (PID 56404) by user abisen. See also https://duckdb.org/docs/connect/concurrency
Code:
using DuckDB
import DBInterface: execute, connect, close!
"""write_data(dbfile::String)"""
function write_data(dbfile::String)
db = DuckDB.DB(dbfile)
conn = connect(db)
execute(conn, "CREATE OR REPLACE TABLE test (a INTEGER, b INTEGER);")
execute(conn, "INSERT INTO test VALUES (1, 2);")
close!(conn)
DuckDB.close_database(db)
return true
end
file_name = "duckdata.db"
write_data(file_name)