kndndrj / nvim-dbee

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

Feature request: database helpers #66

Open willruggiano opened 6 months ago

willruggiano commented 6 months ago

I have several queries I like to run periodically which are not specific to any table, but rather the database as a whole, e.g. for "active queries"

SELECT
    pid,
    usename,
    age(clock_timestamp(), query_start) AS started_at,
    query
FROM pg_stat_activity
WHERE state = 'active' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start DESC;

It would be nice to have an extra_helpers configuration option at the database level rather than the table level

kndndrj commented 6 months ago

The way I see it, that's what local notes are for -- same as in other database clients. If you really want to have the same sort of ui-select functionality, I suggest you look at the dbee api and try creating something on your own. I'll leave the issue open for a bit longer in case more people are interested in this feature.

I'll provide you with a sample code snippet once I get arond to my pc if you want.

I guess a wiki for these sorts of use cases would be a good idea :D