We're trying to follow the PEP8 guidelines for formatting our Python code and staying below 80 characters per line.
Our SQLAlchemy lines are particularly troublesome, having lots of chained methods and tons of complex parameters, logic, and nested functions.
Are there any particular best practices for formatting Python SQLAlchemy with the constraints of PEP8?
The closest answer I've found is here, but the code I'm dealing with is far, far more complicated.
Came here hoping for a better solution, but I think I prefer the parentheses wrapping style:
subkeyword = ( Session.query( Subkeyword.subkeyword_id, Subkeyword.subkeyword_word ) .filter_by(subkeyword_company_id=self.e_company_id) .filter_by(subkeyword_word=subkeyword_word) .filter_by(subkeyword_active=True) .one() )
This is nice and clear, and avoids the dreaded backslash.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With