Open Photonios opened 5 years ago
Is there any interest in getting this merged? I'd like to be able to generate Postgres array literals using jinjasql
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.
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!
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
.