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

BUG | Different sorting order for different columns (ASC, DESC) #59

Closed v1a0 closed 2 years ago

v1a0 commented 2 years ago

Not supporting different sorting order for different columns.

Example log:

expected = self.db.execute('SELECT id, firstName FROM "employee" ORDER BY firstName ASC, surname DESC')

        self.assertEqual(
            expected,
            self.db['employee'].select(
                SELECT=['id', 'firstName'],
                ORDER_BY=['firstName', 'ASC', 'surname', 'DESC']
            )
        )

# sqlite3.OperationalError: no such column: ASC

Generated script

SELECT id, firstName FROM "employee"  ORDER BY firstName, ASC, surname, DESC
                                                        ^             ^
                                                       [!]           [!]

How script have to look like

SELECT id, firstName FROM "employee"  ORDER BY firstName ASC, surname DESC

Version:

sqllex v0.2.0.5

v1a0 commented 2 years ago

Fixed since v0.2.0.6