v1a0 / sqllex

The most pythonic ORM (for SQLite and PostgreSQL). Seriously, try it out!
https://v1a0.github.io/sqllex
GNU General Public License v3.0
92 stars 8 forks source link

UPPERCASE args #5

Closed v1a0 closed 3 years ago

v1a0 commented 3 years ago

In python UPPERCASE usually used for to highlight constants, but here I guess it might be reasonable to change args like "or", "set" to "OR" and "SET"

It's much easier to read and understand for person who ever used SQL-like databases

Here some examples:


BEFORE:

def insert_balance(user_id: int, balance: int):
    db.insert(
        table='coins',
        or_=REPLACE,
        id=user_id, balance=balance
    )

AFTER:

def insert_balance(user_id: int, balance: int):
    db.insert(
        OR=REPLACE,
        TABLE='coins',
        id=user_id, balance=balance
    )

BEFORE:

def update_balance(user_id: int, balance: int):
    db.update(
        table='coins',
        set_={
            'balance': balance
        },
        where={
            'id': user_id,
        }
    )

AFTER:

def update_balance(user_id: int, balance: int):
    db.update(
        TABLE='coins',
        SET={
            'balance': balance
        },
        WHERE={
            'id': user_id,
        }
    )
Alehanter337 commented 3 years ago

SURE!!!! 🔥🔥🔥🔥

v1a0 commented 3 years ago

Accepted since Sqllex version 0.1.6