Jaymon / prom

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

interface.base.SQLInterface.get_SQL options #103

Closed Jaymon closed 10 months ago

Jaymon commented 4 years ago

the get_SQL() method takes a few kwargs options:

count_query -- boolean -- true if this is a count query SELECT
only_where_clause -- boolean -- true to only return after WHERE ...

It might make it easier to fully support subqueries if these options were on the Query instance and this method didn't take any defined options. Something like:

q = Query()
q.is_count = True
q.only_where = True # q.is_where?
Jaymon commented 1 year ago
q.count_query = True
q.where_query = True

I have to be careful of the names so they don't interfere with actually doing a query. Although I think is_count and is_where would work because both count and where are SQL keywords

Jaymon commented 10 months ago

get_SQL was broken into multiple methods sometime in the last 3 years, and render_select_sql and render_where_sql kind of handle this so I'm not sure it's worth adding more things to the Query class anymore.