peps icon indicating copy to clipboard operation
peps copied to clipboard

PEP 8 - Maximum Line Length (79 characters) for SQL queries

Open ivanleoncz opened this issue 8 years ago • 2 comments

How can I respect PEP 8 - Maximum Line Length (79 characters) for SQL queries, without causing issues to my code?

I read the entire section and searched for any other mentions on the document, but it seems that there's nothing specific regarding SQL queries.

Should it have an specific example for SQL queries? If not, what could be proper formatting for respecting the 79 characters mentioned on the Maximum Line Length section of PEP8, regarding SQL queries?

Thanks.

ivanleoncz avatar Feb 10 '18 21:02 ivanleoncz

Considering that most (all?) database engines are quite happy to have newlines in the middles of queries, you could use a triple-quoted string and lay out the query across multiple lines easily.

Questions like this are best directed to python-list rather than this repository.

Rosuav avatar Feb 10 '18 21:02 Rosuav

Ok. Thanks for the explanation and the for the advice, @Rosuav :+1:

ivanleoncz avatar Feb 10 '18 22:02 ivanleoncz