Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add new stored procedures to mysql in DataGrip?

I just downloaded DataGrip from JerBrains How to add new stored procedures to MySQL in DataGrip?

like image 735
Jim_dddd Avatar asked Mar 01 '17 08:03

Jim_dddd


People also ask

Where are stored procedures in DataGrip?

In toolbar navigate to View -> Tool Windows -> Database or press Alt + 1 key combination. In opened explorer expand [your database], [your schema] and routines branch. Find interesting procedure/function, than right click on it and select SQL Scripts.

How can we add stored procedure?

"ADD" ( out c int) as begin declare a int := 5; declare b int := 6 ; c = :a + :b; end; sql.

How do I add a database to DataGrip?

In the Database Explorer, select a schema and navigate to File | New | Table. Alternatively, right-click the schema or database node and select New | Table.


2 Answers

  • Configure a connection
  • Then open new console for that data source.
  • In console press Alt+Insert that will suggest you to generate code for different objects.
  • After filling template, press Ctrl + Enter to execute

Done!

like image 125
kassak Avatar answered Oct 31 '22 22:10

kassak


It is very poor in managing stored procedures or functions in Data Grip, for Mac Users:

  • Shift+Cmd+F10 to open a new console where you can write a script and create a new object (SP, view, function ..etc)

Also, To change or alter a Stored procedure, you can generate a SQL script for your data source, Right click on data source, then from SQL Scripts menu click Generate DDL to console

  • Opt+Shift+Cmd+B to generate DDL to console

  • Cmd+Opt+G to generate all SQL scripts for the selected datasource

  • Cmd+Enter to execute your script

like image 34
Muhammad Soliman Avatar answered Oct 31 '22 22:10

Muhammad Soliman