You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
trying to use db functions like from django.db.models.functions Trunc fails due to change in signature in Django 4.1
Problem
I have a Django 5.1 project using Trunc
Trying to use django-redshift backend fails with:
elif isinstance(self.output_field, DateField):
> sql, params = connection.ops.date_trunc_sql(
self.kind, sql, tuple(params), tzname
E TypeError: DatabaseOperations.date_trunc_sql() takes from 3 to 4 positional arguments but 5 were given
.venv/lib/python3.11/site-packages/django/db/models/functions/datetime.py:271: TypeError
But I understand that compatibility with Django > 4.0 is tenuous due to needing to use Django 4.0 code, due to needing to use psycopg2 lib for connecting to Redshift, as psycopg3 has issues.
Environment info
OS: macOS 14.6.1
Python version: 3.11
Django version: 5.1
Django-Redshift-Backend version: latest
The text was updated successfully, but these errors were encountered:
I see..., I hadn't considered that there would be an impact.
I'm sorry, but I don't have any short-term solutions at the moment. I think that advancing #167 is probably the most reliable solution.
I'm currently implementing an ad-hoc solution for supporting Django 4.2+, and I am aware that we need to re-implement it correctly.
Please refer to #167 for more information.
trying to use db functions like
from django.db.models.functions Trunc
fails due to change in signature in Django 4.1Problem
I have a Django 5.1 project using
Trunc
Trying to use django-redshift backend fails with:
signature of
date_trunc_sql
and many other functions changed in Django 4.1, to addparams
arg https://github.com/django/django/blob/4.1/django/db/backends/base/operations.py#L113making it incompatible with the Django 4.0 code in this project here:
django-redshift-backend/django_redshift_backend/_vendor/django40/db/backends/base/operations.py
Line 109 in 2d17a9c
DATE_TRUNC
itself is supported in Redshift https://docs.aws.amazon.com/redshift/latest/dg/r_DATE_TRUNC.html the problem is just in the Django layerExpected results
Badges advertise support for Django 4.2, 5.0, 5.1
But I understand that compatibility with Django > 4.0 is tenuous due to needing to use Django 4.0 code, due to needing to use psycopg2 lib for connecting to Redshift, as psycopg3 has issues.
Environment info
The text was updated successfully, but these errors were encountered: