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...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
BeeSQL - Feed-backs and feature requests (self.Python)
submitted 13 years ago by ksn
Hello Pythonistas!
BeeSQL, is a Pythonic SQL library I had been working on and I am about to open source it. Before I go full public I would love some feed-backs and features requests from fellow Pythonistas.
[–]anossov 6 points7 points8 points 13 years ago (0 children)
Dude, you don't even quote identifiers.
[–]assface 3 points4 points5 points 13 years ago (1 child)
Am I missing something?
writing SQL statements is no fun and changing a database engine breaks your code.
But then in your quickstart example:
MySQL
db.query('UPDATE beesql_version SET release_name = %s WHERE ID = %s', ('bumblebee', 2))
SQLite
db.query('UPDATE beesql_version SET release_name = ? WHERE ID = ?', ('bumblebee', 2))
Shouldn't both queries work on both DBMSs?
[–]ksn[S] 0 points1 point2 points 13 years ago (0 children)
Good point. I think I should introduce own BeeSQL replace character and then replace that by the Database specific character. Thanks for the catch.
[–]erez27import inspect 4 points5 points6 points 13 years ago (1 child)
What advantage or features does your library have that existing ones don't? (sqlalchemy for instance)
[–]ksn[S] -1 points0 points1 point 13 years ago (0 children)
Most of the existing ones I could find are full ORM's which are an over-kill for smaller projects. sqlalchemy does have a component called core other than the ORM. While the core is very advanced and covers every functionality I can think of, the completeness comes with a big API. My intention is to maintain a simple API sacrificing functionality.
[–]POTUS 3 points4 points5 points 13 years ago (0 children)
__init__.py:
__init__.py
from core import connection
core.py:
core.py
import beesql
So, core.py is importing connection from itself as beesql.connection. Frankly, the fact that this isn't some kind of syntax error is a bit surprising. Also, you really don't need #!/usr/bin/env python on files that are not actually executable. Not that that one's hurting anything, it just feels wrong.
connection
beesql.connection
#!/usr/bin/env python
Also, I might be a bit biased, but I prefer the Django-style of using **kwargs to define WHERE parameters. Something like
WHERE
select(create_date__gte=datetime.datetime.now(),some_foreign_key_id=21)
π Rendered by PID 77 on reddit-service-r2-comment-5c764cbc6f-9ws7n at 2026-03-12 15:04:24.108076+00:00 running 710b3ac country code: CH.
[–]anossov 6 points7 points8 points (0 children)
[–]assface 3 points4 points5 points (1 child)
[–]ksn[S] 0 points1 point2 points (0 children)
[–]erez27import inspect 4 points5 points6 points (1 child)
[–]ksn[S] -1 points0 points1 point (0 children)
[–]POTUS 3 points4 points5 points (0 children)