# Is it hard to support Julia UDFs in DuckDB?

**URL:** <https://discourse.julialang.org/t/is-it-hard-to-support-julia-udfs-in-duckdb/118509>\
**Category:** Data\
**Created:** [August 23, 2024, 12:11am UTC](https://discourse.julialang.org/t/is-it-hard-to-support-julia-udfs-in-duckdb/118509 "2024-08-23T00:11:59Z")\
**Posts on this page:** 1\
**Showing post:** 38

<div class="post-metadata">

**Author:** ![asbisen](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@asbisen](https://discourse.julialang.org/u/asbisen)\
**Post date:** [February 2, 2025, 8:52pm UTC](https://discourse.julialang.org/t/is-it-hard-to-support-julia-udfs-in-duckdb/118509/38 "2025-02-02T20:52:13Z")

</div>

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.

```julia
> 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:

```julia
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)

```

---

_[View the full topic](https://discourse.julialang.org/t/is-it-hard-to-support-julia-udfs-in-duckdb/118509)._
