jayvynl / django-clickhouse-backend

Django clickhouse database backend.
MIT License
130 stars 21 forks source link

support for "prewhere" #80

Closed Fleapse closed 5 months ago

Fleapse commented 8 months ago

hey, clickhouse lang has "prewhere" condition is there any way to set this condition using django-clickhouse-backend? and if there is no such method, is it possible to plan to add it for future releases?

jayvynl commented 8 months ago

To support this:

  1. Add prewhere attribute to clickhouse_backend.models.sql.query.Query as a container for prewhere clauses.
  2. Add prewhere method to clickhouse_backend.models.query.QuerySet which update clickhouse_backend.models.sql.query.Query.prewhere.
  3. Generate prewhere SQL in clickhouse_backend.models.sql.query.compiler.*Compiler.as_sql.

This may take some time to implement.