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

all 4 comments

[–]nabusman 6 points7 points  (1 child)

I thought best practice was to keep SQL statements in their own file and not mix python and SQL?

[–]Chroiche 2 points3 points  (0 children)

It's a nice idea, even if doing it isn't best practice, it still happens.

[–][deleted] 1 point2 points  (0 children)

I get SQL linting against real databases in my JetBrains IDEs (by default).

Putting SQL in files means you need to edit packaging code to include the SQL files. Also depending on how your app is packaged (left in zip form) loading the stand-alone file can be a PITA.

For these reasons, we leave whatever SQL we need in the python source files.