[Answered ]-Django RawQuerySet.__repr__ : not enough arguments for format string

2👍

I eventually found the explanation. I’m not sure this will be of much help to others, but anyways.

The problem came from the fact that params in the call was a list. It appears you can use a list to instantiate a RawQuerySet, but it is not converted into a tuple so you can’t use it for string-formatting later on.

Conclusion I’ll use MyModel.objects.raw(SQL, tuple(params)).

Leave a comment