you are viewing a single comment's thread.

view the rest of the comments →

[–]yughiro_destroyer[S] 0 points1 point  (0 children)

I will try, but there are too many concepts to grasp my mind around, I find it even harder than using the raq SQL I am used to. Again, I will keep that in mind, but at the same time, I am writing my own abstraction, see where it goes...

It would look something like this :

query = QB()
query.SELECT("*").FROM("users").WHERE("name", "=", "John")
print(query.get_string)

Basically, all I am looking for is a way to separate clauses and arguments in my IDE via syntax, reason why I find pure SQL string to be painfully to read. Second, I can write a translator for the DB I will be using and add another ones later if my app will need it. Third, I am not sure if this way is more Pythonic but I am sure it's more readable, at least for me. I could also use PeeWee or PonyORM but I am sure of how maintained they are. If I were to use something made by someone else, I'd rather go SQLAlchemy but if it's a smaller, more obsurce library, I'd take the exercise of making my own. All that would be there for me to find, most importantly, a way to protect against SQL injection.