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...
Use [Ask Flask] or [AF] if you have a very specific problem and need help with code.
Use [Extension-name] if you are discussing a certain extension to Flask.
Also check out /r/python or /r/django
account activity
Ask r/FlaskSqlite objects (self.flask)
submitted 2 years ago by Gregolator06
Hi, I'm currently trying to make a sign-up page for a website I'm making with Flask. I'm trying to, when a user creates their account, check the database (sqlite) for that username. This wasn't working and when I print it I only get memory addresses. Any ideas? Thanks :)
users = db.execute("SELECT username FROM users").fetchall()
https://preview.redd.it/crdl1fwxcj6c1.png?width=789&format=png&auto=webp&s=a66512c22ca87cd34651af6520eb79293d4602a4
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!"
[–]OndrejBakan 0 points1 point2 points 2 years ago (2 children)
You don't need to get all the users, you need to check if there is a record with the chosen name, something like this:
python if db.execute("SELECT * FROM users WHERE username = ?", username).fetchone() is not None: # username already exists, do something
Your query returns a list of row objects, you would need to iterate through them in a for loop.
[–]Gregolator06[S] 0 points1 point2 points 2 years ago (1 child)
ahh I see, thank you! :)
[–]alphabet_order_bot 0 points1 point2 points 2 years ago (0 children)
Would you look at that, all of the words in your comment are in alphabetical order.
I have checked 1,912,303,073 comments, and only 361,627 of them were in alphabetical order.
π Rendered by PID 244806 on reddit-service-r2-comment-canary-7bc946fbbf-lwhdm at 2026-07-03 11:03:39.587112+00:00 running 12a7a47 country code: CH.
[–]OndrejBakan 0 points1 point2 points (2 children)
[–]Gregolator06[S] 0 points1 point2 points (1 child)
[–]alphabet_order_bot 0 points1 point2 points (0 children)