Jaymon / prom

A PostgreSQL or SQLite orm for Python
MIT License
22 stars 4 forks source link

Add Query.where() that is like .raw() but only for the where portion #104

Closed Jaymon closed 1 year ago

Jaymon commented 4 years ago

It would be great to have a where portion that can intermix with everything else, so you could do something like:

Orm.query.is_foo_id(10).where("bar_id='<SOME_VALUE>'".format(some_value)).is_che("blah")

would result in a query like:

SELECT * FROM <table_name> WHERE foo_id=? AND bar_id='<SOME_VALUE>' AND che='?'

Bonus if you could also pass in args, so you could do the query like this also:

Orm.query.is_foo_id(10).where("bar_id=?", some_value).is_che("blah")

and you'd get the same result

Jaymon commented 2 years ago

https://github.com/Jaymon/prom/issues/120

Honestly, where and raw_field could be aliases of the same method