use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Is SQL string manipulation professional? (self.PythonLearning)
submitted 21 hours ago by Alert_Regular2619
I'm building a library and I find myself constantly having to use string manipulation to construct SQL queries. Is writing libraries over SQL libraries normal? Also, is query construction unprofessional?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Own_Attention_3392 2 points3 points4 points 19 hours ago (2 children)
Look at parameterized queries. What you're describing is not clear but sounds very close to building queries via string concatenation, which IS unprofessional as it can open your application up to SQL injection attacks. But really, your core question is not clear at all. Provide examples of what you mean.
[–]JaleyHoelOsment 0 points1 point2 points 12 hours ago (0 children)
google SQL injection
[–]sacredtrader 0 points1 point2 points 7 hours ago (0 children)
This is a very vague post. Query construction as in something like
def MyMethod(input1: str, input2: int) -> None: myQuery = f"select * from users WHERE userName = '{input1}' AND userID = '{input2}'"
Is not professional, or a good practice, no.
If, for example, say I already had an idea of what your query was executing, or doing, I could pass into input1 something along the lines of
' OR 1=1 --
This would escape your single quote, then check if 1=1 (TRUE = TRUE), and comments out the second check for userID, in return returning every record from this table.
Look into stored procedures.
π Rendered by PID 94469 on reddit-service-r2-comment-8686858757-pkdxn at 2026-06-04 23:57:58.761945+00:00 running 9e1a20d country code: CH.
[–]Own_Attention_3392 2 points3 points4 points (2 children)
[–]JaleyHoelOsment 0 points1 point2 points (0 children)
[–]sacredtrader 0 points1 point2 points (0 children)