6 ms·
> Where I assemble a SQL query string using string formatting and vanilla Python. You can just add various filter conditions to a dictionary, and then unpack t
by Alex3917 10y ago
> Where I assemble a SQL query string using string formatting and vanilla Python.
You can just add various filter conditions to a dictionary, and then unpack them into the filter as kwargs. That way you can still build up the dictionary using if/else blocks or however you would normally build up a SQL query string.
SQL isn't scary, but for simple queries the Django ORM usually a lot more legible if you take the time to learn the DSL.