kndndrj / nvim-dbee

Interactive database client for neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unknown function: Dbee_register_connection

napisani opened this issue · comments

Hi there!

I'm really looking forward to trying out this plugin. Also, I'm really fascinated to read through your code and see how the go-lua interop works.

When I first attempted to setup a connection to my local db, I started getting this error on startup and all subsequent execution commands seemed to fail as well.

Here is a screenshot of the error
Screenshot 2023-05-14 at 10 15 05 PM

Here is my configuration:

Packer:

  use ({
  "kndndrj/nvim-dbee",
  requires = {
    "MunifTanjim/nui.nvim",
  },
  build = function()
    -- Install tries to automatically detect the install method.
    -- if it fails, try calling it with one of these parameters:
    --    "curl", "wget", "bitsadmin", "go"
    require("dbee").install()
  end,
  run = function()
    -- Install tries to automatically detect the install method.
    -- if it fails, try calling it with one of these parameters:
    --    "curl", "wget", "bitsadmin", "go"
    require("dbee").install()
  end,
})

here is my config function called from my init.vim file:

local status_ok, dbee = pcall(require, "dbee")
if not status_ok then
	vim.notify("dbee not found ")
	return
end
dbee.setup({
 connections = {
    {
      name = "examplemysql",
      type = "mysql",
      url = "mysql://root:redacted@localhost:3306/db1",
    },
  }
})

Is there a mistake that I made in the config?
Thanks in advance,
~Nick

Hey @napisani, thanks for trying out the plugin.

I probably won't be able to check anything with my pc thia week, but nonetheless, lets try some things:
I see you aren't calling the setup function from packer (e.g. you aren't lazy loading the plugin) For some reason nvim has some trouble running go commands on startup. Try putting lazy = true in your config, so the setup looks like this:

dbee.setup({
  lazy = true,
 connections = {
    {
      name = "examplemysql",
      type = "mysql",
      url = "mysql://root:redacted@localhost:3306/db1",
    },
  }
})

Please let me know if it works!

Thank you, I think I'm one step closer now.
Although now I'm running to this error after running the following command

Cmd:

lua require("dbee").execute("select * from person")

Error:

connection with id examplemysqlmysql not registered

Sorry to be a pain, but I appreciate your help

Hey, can you try that again and then run :mes and paste the output here?
Also, can you paste the contents of ~/.cache/nvim/dbee/dbee.log?
It would be helpful to have some sort of logs

P.S. don't worry I value this kind of feedback :D

Sure thing, tried it again, followed by the :mes command. However there were no messages to be found in the messages panel

here is what the dbee.log file contained after doing those two commands:

~ ❯ cat ~/.cache/nvim/dbee/dbee.log
2023/05/15 11:59:50 [DebugLevel]: calling Dbee_register_connection
2023/05/15 11:59:50 [ErrorLevel]: Unable to connect to database: default addr for network 'localhost:3306' unknown
2023/05/15 11:59:50 [DebugLevel]: calling Dbee_set_results_buf
2023/05/15 11:59:50 [DebugLevel]: Dbee_set_results_buf returned successfully
2023/05/15 11:59:50 [DebugLevel]: calling Dbee_execute
2023/05/15 11:59:50 [ErrorLevel]: connection with id examplemysqlmysql not registered

I hope you didnt spent too much time racking your brain on this one. I was able to finally get it working by changing my connection string to this format:

dbee.setup({
	lazy = true,
	connections = {
		{
			name = "examplemysql",
			type = "mysql",
			url = "root:password@(localhost:3306)/db1",
		},
	},
})

Thanks again for your help!