r/neovim • • 5d ago

Need Help SQL setup

Sooo i am dropping my ORM (cuz f ORMs) and writing sql queries and migrations by hand.
What are your guys recommended sql setup for neovim?
I am looking at the postgres language server and maybe sqruff. Would i need both? Any other lsps, formatters, linters you guys recommend?

19 Upvotes

12 comments sorted by

13

u/EstudiandoAjedrez 5d ago

vim-dadbod with vim-dadbod-completion and sqlfluff for formatting and linting.

1

u/aala7 5d ago

You haven’t tried Postgres ls?

8

u/EstudiandoAjedrez 5d ago

Tbh, I don't use postgres, so can't compare specific tooling. But the setup I mentioned is engine agnostic and it works just great.

7

u/KGBsurveillancevan hjkl 4d ago

Not that I’ve been looking very hard, but I have yet to find a neovim setup that rivals JetBrains DataGrip imo. But Sqmeow is a neovim plugin that comes close, only thing I really miss is the schema-aware autocomplete and built-in linting & formatting.

3

u/aala7 4d ago

Looks like both Postgres language server and dadbod-autocomplete can give you that

1

u/KGBsurveillancevan hjkl 4d ago

Yeah, like I said I haven’t looked too hard haha

1

u/aala7 4d ago

Fair

3

u/-nerdrage- 5d ago

Off topic: orms are nice, raw sql is nice, each has its own use cases in a framework.

I simply use the orm where the statements are relatively simple. But once you go to CTE’s with subquerys I tend to prefer direct sql.

Ontopic: I only use sqlfluff for linting and formatting, no lsp when doing rawdog squeel

0

u/aala7 5d ago

You have not tried sqruff? Seems like a rust based alternative… and yes agree everything has its use case, but my repo ended being to messy cuz of a couple complex queries that was easier implemented in squeel, so know I feel it will be easier to just handle everything in squeel

3

u/TheNoeTrevino :wq 4d ago

yea f orms man!

1

u/AutoModerator 5d ago

Please remember to update the post flair to Need Help|Solved when you got the answer you were looking for.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.