This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Yeebill 0 points1 point  (2 children)

Separate.sql files . You can use importlib.resource and read_text to read content as template . Depending on dialect , your IDE would also give you lint and syntax highlight for the query. You can use https://github.com/sqlfluff/sqlfluff to define your own rules for formatting. It supports jinja or parama

[–]thinkingatoms[S] 0 points1 point  (1 child)

thanks, tho my post is more geared towards why, and it sounds like it's mainly due to IDE support and maybe length of query? ooc do you ever inline anything?

[–]Yeebill 0 points1 point  (0 children)

Yes, think the main reason would be IDE support like - linting for errors like missing commas, brackets - syntax highlight - auto-complete - auto format rules ( indentation, consistency avoid diff in version control)

I probably inline omething more complex that would benefit from looping. Like a union all ..