Data Grip - how do I perform a simple SQL formatting (the same way ctrl+shift+F does in DBeaver)?
Asked Answered
A

2

11

I'm using Data Grip and writing queries for use with Presto. How can I get Data Grip to format my queries so they will be neat and easy to read?

enter image description here

enter image description here

Abagail answered 30/9, 2020 at 7:5 Comment(0)
S
10

Ctrl/Cmd+Alt+L formats your code.

Settings | Editor | Code Style | SQL to adjust.

Sporty answered 1/10, 2020 at 13:59 Comment(7)
Hi @Sporty I've tried that and it does absolutely nothing! It will say "No lines changed: content is already properly formatted" even when the code is not formatted! any ideas?Abagail
@Abagail That means that your code is formatted according to defined code style. You need to set up code style to match you expectationsFrightened
@Frightened I've set up code style, and yet nothing happens. I can write a super-long line and then press Ctrl+Alt+L and it won't even wrap the text. Any ideas?Abagail
Hm, are you editing the SQL file or a console? What dialect do you use? A screencast will be useful hereSporty
Hi @moscas, I've added two screenshots, hope that's helpful. I'm writing in Presto which should be general SQL. Appreciate your help here.Abagail
Got it! The formatter doesn't wok for the dialects which are not supported. It will be fixed in 2020.3Sporty
Mac: Cmd + Option + LShalon
S
6

For macOS:

Command + Option + L

Sanitarian answered 27/11, 2021 at 19:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.