Basic "macro" functionality
I have been playing around with macros in 0xDBE, but haven't yet figured out how to make them work in a simple and convenient way. Let's say I have this very simple (dummy) Postgres query:
SELECT d.datname, ts.spcname FROM pg_database d JOIN pg_tablespace ts ON ts.oid = d.dattablespace LIMIT 100;
In tools like pgAdmin or SQL Server Management Studio, it is trivial to map keyboard bindings such that I could highlight one of the table names (e.g. pg_database), hit a keyboard shortcut, and automatically see the first 100 rows in the table, view the table definition, or whatever other useful information I care to bind.
As an explicit example, I have the following binding in pgAdmin:
Ctrl-4 => "SELECT * FROM $SELECTION$ LIMIT 100;"
Pressing Ctrl-4 then automatically executes "SELECT * FROM pg_database LIMIT 100;" against the current connection, shows the results, and does not require me to modify the query text or perform any additional typing. This is extremely powerful, especially given that one can write and bind arbitrarily complex stored procedures to these mappings, which is much simpler than recording and maintaining a long macro of keyboard actions (like I was able to find in 0xDBE right now).
Is there a way to do this in 0xDBE? Or is there somehwere I should submit this post as a new feature request? The functionality described above is something I often use hundreds of times per day in other editors, so it would be great functionality to be able to use within 0xDBE.
Thanks!
Please sign in to leave a comment.
The best thing I could find was creating a Surround Live Template, which modifies the query inline.
Having a macro/hotkey functionality like this would be awesome. I'd suggest making a feature request on their youtrack page: http://youtrack.jetbrains.com/issues/DBE
The live templates are an interesting feature, thanks for pointing that out. I think they could be helpful for some use cases, but it is a little frustrating that it edits the query line, you have to manually select and execute the query (not to mention copy to the console if you are on the SQL editor), and your command stack (for undo / redo) is also affected by the templates.
I filed the issue here for the improved macro / hotkey functionality described above: http://youtrack.jetbrains.com/issue/DBE-177
I voted it up. There seems to be a lot of requests for macro / automation / extensibility, already. I'm hoping we get it!
This feature would be great to have. Currently I am solving this by executing the selected query but with this feature a lot of step would be ommited and it could be used in insert statements as well.