jayvynl / django-clickhouse-backend

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

Add missing function fix_format_for_duration_arithmetic #22

Closed filipp-tromzo closed 1 year ago

filipp-tromzo commented 1 year ago

Add this into operations.py

    def format_for_duration_arithmetic(self, sql):
        # https://clickhouse.com/docs/en/sql-reference/data-types/special-data-types/interval
        return "INTERVAL %s MICROSECOND" % sql

Without it our project crashing. And may be you could enable PRs? Planned to create PR but they are disabled.

jayvynl commented 1 year ago

You can folllow this post to open a PR. https://github.com/orgs/community/discussions/22665

jayvynl commented 1 year ago

Anyway, can you create an issue about the problem your project faced. Interval of clickhouse is a special type, so you can not use DurationField in you project. I am interested in what caused the problem.