kndndrj / nvim-dbee

Interactive database client for neovim
GNU General Public License v3.0
710 stars 48 forks source link

DuckDB error #25

Closed johnallen3d closed 1 year ago

johnallen3d commented 1 year ago

I have the following setup (lazy.nvim).

return {
    "kndndrj/nvim-dbee",
    ft = "sql",
    dependencies = {
        "MunifTanjim/nui.nvim",
    },
    build = function()
        require("dbee").install()
    end,
    config = function()
        require("dbee").setup({
            sources = {
                require("dbee.sources").MemorySource:new({
                    {
                        id = "duck-in-memory",
                        name = "duck-in-memory",
                        type = "duck",
                        url = "file::memory:",
                    },
                }),
            },
        })
    end,
}

After Lazy sync all is well, however when I open a .sql file I get the following error.

Error detected while processing BufReadPost Autocommands for "*":                                                                                                       
Error executing lua callback: ...en/.tea/neovim.io/v0.9.1/share/nvim/runtime/filetype.lua:21: Error executing lua: ...en/.tea/neovim.io/v0.9.1/share/nvim/runtime/filety
pe.lua:22: BufReadPost Autocommands for "*"..FileType Autocommands for "sql": Vim(append):[handler]: BufReadPost Autocommands for "*"..FileType Autocommands for "sql"..
function Dbee_register_connection[1]..remote#define#request, line 2: Vim(let):unable to connect to duckdb database: could not open database: IO Error: Extension "/Users
/john.allen/.duckdb/extensions/v0.8.0/osx_arm64/file.duckdb_extension" not found.                                                                                       
stack traceback:                                                                                                                                                        
        [C]: in function 'nvim_cmd'                                                                                                                                     
        ...en/.tea/neovim.io/v0.9.1/share/nvim/runtime/filetype.lua:22: in function <...en/.tea/neovim.io/v0.9.1/share/nvim/runtime/filetype.lua:21>                    
        [C]: in function 'nvim_buf_call'                                                                                                                                
        ...en/.tea/neovim.io/v0.9.1/share/nvim/runtime/filetype.lua:21: in function <...en/.tea/neovim.io/v0.9.1/share/nvim/runtime/filetype.lua:10>                    
stack traceback:                                                                                                                                                        
        [C]: in function 'nvim_buf_call'                                                                                                                                
        ...en/.tea/neovim.io/v0.9.1/share/nvim/runtime/filetype.lua:21: in function <...en/.tea/neovim.io/v0.9.1/share/nvim/runtime/filetype.lua:10> 

Looks like a version mismatch.

~/.duckdb/extensions
❯ ll
 .
 ..
 17ec2ab20
 v0.7.1
 v0.8.1

FWIW — I didn't have v0.8.1 installed prior to installing dbee. I did a brew install duckdb after first error but current HomeBrew version seems to be v0.8.1.

kndndrj commented 1 year ago

@johnallen3d

hmm, that's strange. It could really be something like a version mismatch - I got a similar error when I was implementing it - it said something along the lines of "new versions can't read old ones and vice versa until we have a v1.0 release"

Unfortunately, duckdb (especially go driver) is kinda finicky, so it's really hard to tell.

In the mean time, can you try it with different url strings? for example with "" and /tmp/duck.db?

Thanks for reporting the issue!

kndndrj commented 1 year ago

@johnallen3d After a quick test with url set to file::memory:, I get a similar error as you:

unable to connect to duckdb database: could not open database: IO Error: Extension "/Users/andrej/.duckdb/extensions/v0.8.0/osx_arm64/file.duckdb_extension" not found.

Candidate extensions: "inet", "icu", "fts"

so for in-memory, try using empty url string ("")

johnallen3d commented 1 year ago

OK, I've switched to empty string ("") and am in business. Thanks again!

CleanShot 2023-06-15 at 07 15 25@2x