django-snowflake icon indicating copy to clipboard operation
django-snowflake copied to clipboard

Add support for INTERVAL math where the interval is a column

Open timgraham opened this issue 3 years ago • 0 comments

A queryset like:

Experiment.objects.filter(start=F('start') + F('estimated_time')

where estimated_time is a DurationField, generates SQL:

WHERE "experiment"."start" = ("experiment"."start" + INTERVAL '"expressions_ExPeRiMeNt"."estimated_time" MICROSECONDS')

but INTERVAL doesn't support column names. (SQL compilation error: syntax error line 1 at position 0 unexpected '"experiment"'.)

Perhaps Snowflake could add support for this. For example, MySQL allows:

INTERVAL `experiment`.`estimated_time` MICROSECOND

timgraham avatar Nov 25 '21 01:11 timgraham