kristijanhusak / vim-dadbod-completion

Database autocompletion powered by https://github.com/tpope/vim-dadbod

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Completion from multiple databases

bowmanjd opened this issue · comments

I am unsure if this is a feature request, or a need for better understanding on my part... Thus far, I only get completion of table names and columns from the database specified in the connection. But when I SELECT FROM OtherDatabase.dbo.OtherTable I do not see completion suggestions.

Is this by design, or am I doing something wrong?

I am using a sqlserver connection.

If this is by design, might you consider adding this feature? Or perhaps this would be a feature added to vim-dadbod?

It seems like there are three options: pulling in completions from all databases on a server, keeping multiple database connections to pull completions from, or switching the current database for the buffer.

The first one I think is obviously a bad idea.

The other two I think probably belong best in dadbod-ui (or maybe another small plugin that would support both dadbod and dodbod-ui?). Creating a function to switch the connection for the current buffer would probably be simple to implement though it would still require manual switching, which isn't perfect. Something like a workspace feature that could send vim-dadbod-completion multiple database connections to complete from should make completing from multiple databases seamless, but would require a good deal more work from both plugins.

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sounds like this issue is best solved over at dadbod-ui.

Dadbod-ui already allows for multiple active connections. I think to get multiple database completion working the changes need to be made here.

  • If not using dadbod-ui, no changes.
  • If using dadbod-ui get all active database connections for the same server that the current buffer is connected to
  • Add database key to the cache
  • Query each active database connection and for each add all schemas/tables/columns etc. to the cache

Am I missing anything big?