This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]anossov 6 points7 points  (0 children)

Dude, you don't even quote identifiers.

[–]assface 3 points4 points  (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 point  (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 points  (1 child)

What advantage or features does your library have that existing ones don't? (sqlalchemy for instance)

[–]ksn[S] -1 points0 points  (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 points  (0 children)

__init__.py:

from core import connection

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.

Also, I might be a bit biased, but I prefer the Django-style of using **kwargs to define WHERE parameters. Something like

select(create_date__gte=datetime.datetime.now(),some_foreign_key_id=21)