Using Postgres PSQL CLI in DataGrip
I have seen in the pgAdmin the very convenient way to use psql with right click context in a database. I can't find a way in the datagrip and it is very annoying to have always open the pgAdmin for that reason. I have used the External Tools way but it doesn't work as I want. It is appeared in main tool bar and it doesn't work with argument macros like -h $DS_HOST$ -p $DS_PORT$ -U $DS_USER$ -d $DS_DATABASE$
请先登录再写评论。
That's correct. You need to set up psql as External Tool and use the macros available in our IDE:
https://www.jetbrains.com/help/datagrip/built-in-macros.html
The specific arguments you mentioned are not listed, so you have to add your own custom macros. May I know what your use case is?
Thank you for your response but about “May I know what your use case is?” I think that I was very clear! Nevertheless it looks like rocket science in compare to the FREE pgAdmin.
DataGrip doesn’t have a native “Open psql here” feature like pgAdmin. The best workaround is an External Tool opened from the Database context menu using macros like
$Host$,$Port$,$User$, and$Database$instead of$DS_*. That works much more reliably in newer versions.https://youtrack.jetbrains.com/issue/DBE-13452/Open-psql-terminal-session-from-connection