Datagrip plugin SDK

Looking for guidance on creating a plugin for Datagrip, it looks like somethings don't quite work the same.

- Getting the selected table(s): 

    In Intellij, I might put something like the following in an Action: 

    VirtualFile[] files = LangDataKeys.VIRTUAL_FILE_ARRAY.getData(e.getDataContext());

    But this just returns null in DG.  How do I get the tables that have been selected by the user?

- Guidance on using the DasTable class to execute queries against the Project DB?  Intefaces and implementations that should be used?

- Action placement/grouping doesn't seem to correspond to the equivalent menus. What action group is used to create the menu that appears when you right click on a table? It doesn't seem to be the EditorMenu group.



- Selected tables are PSI, so they are available through:

- Group is DatabaseViewPopupMenu. More groups to hook on can be found in <DG path>/lib/datagrip.jar!/META-INF/DatabasePlugin.xml

Digging through the API...I don't see any <obvious> way of executing SQL against the project data source....Everything seems to be covered by the API helper functions.  I was hoping to get at the extended properties that can be set on mssql db's.  Should I write my own db connector object or is there something I'm overlooking?



Hey Stryder, how's it going? Just getting into DataGrip myself and saw this post.




I'm writing an app, which generates SQL code from some other query language (eDSL in Kotlin).

For easier debugging of queries I'd like to create an IntelliJ plugin (Run Configuration), which will produce an SQL Query (compile the Kotlin code, execute the proper function, collect output as a SQL statement) and send the query to DB Plugin for immediate execution (ideally in a full-screen editor tab), to one of the active Consoles.

Is there a way to integrate with the plugin?

I've found `database-openapi.jar` in the plugin folder - it is documented anywhere? Are there examples of a similar use?



Look for `lib/src/` file in IntelliJ IDEA Ultimate distribution. That is a complete source code for database and SQL APIs. We'll provide API for running a query when it become more stable.