jinjasql icon indicating copy to clipboard operation
jinjasql copied to clipboard

Extended array support

Open Photonios opened this issue 4 years ago • 3 comments

JinjaSQL makes the assumption that any iterable is going to be used in a IN clause. PostgreSQL has an array data type and arrays can actually be binded.

This PR adds a flag to disable the existing behaviour of raising MissingInClauseException when using an array as a value without |inclause.

Photonios avatar Sep 22 '19 11:09 Photonios

Is there any interest in getting this merged? I'd like to be able to generate Postgres array literals using jinjasql

bjmc avatar Apr 06 '21 12:04 bjmc

Perhaps it would be preferable to keep the existing behavior when using an array as a value without a filter, but add a new filter like |array to make this more explicit and simpler to merge.

clayadavis avatar Apr 30 '21 17:04 clayadavis

I pushed a fix for this issue with commit 2dee6577a1f83396be5b6fa8192597ef328b11d8

I feel that the old behaviour is incorrect. Making an assumption about the type of bind parameter is not the job of JinjaSQL.

Instead of adding another filter like @clayadavis suggested, or adding another constructor flag like @Photonios suggested in the PR - I am going ahead and removing the MissingClauseException check altogether.

This is a backwards incompatible change, although a very minor one. As a result, I will bump the version major number to indicate a breaking change.

Thanks for all the help on this ticket!

sripathikrishnan avatar Dec 29 '21 09:12 sripathikrishnan