jazzband / django-redshift-backend

Redshift database backend for Django
Apache License 2.0
83 stars 47 forks source link

SELECT DISTINCT ON is not supported #14

Closed jredd closed 7 years ago

jredd commented 7 years ago

In one of my views I need to call distinct on my query but I'm receiving this when I hit the django end point

Exception Type: NotSupportedError
Exception Value:  SELECT DISTINCT ON is not supported
arpitremarkable commented 7 years ago

It is not supported by redshift itself, maybe you can use DISTINCT with a nested query to achieve what you want.

emyller commented 7 years ago

This doesn't seem to be an issue with django-redshift-backend and it's also not viable -- or even possible -- to interpret distinct on into distinct + subquery. 😞

shimizukawa commented 7 years ago

postgres backend on Django supports "SELECT DISTINCT ON" and other backends don't.

I couldn't find information that "DISTINCT ON" is not supported, but it seems that it doesn't actually support it. http://docs.aws.amazon.com/redshift/latest/dg/c_unsupported-postgresql-features.html

For this reason I will explicitly implement unsupported with django redshift backend.

GnanaShekhar commented 5 years ago

It is not supported by redshift itself, maybe you can use DISTINCT with a nested query to achieve what you want.

No its possible for multiple columns.

jredd commented 5 years ago

I could have sworn that distinct was possible...

https://docs.aws.amazon.com/redshift/latest/dg/r_DISTINCT_examples.html