Reputation: 1273
Is there any way we can include multiple statements inside on raw queries.
My use case would be I need to run
SET @@group_concat_max_len=100000;
before the select statement.
For my specific problem, I solved by adding a init_command for the MySQL configuration in my settings.py.
"OPTIONS": {
"init_command": "SET SESSION group_concat_max_len = 1000000;"
}
However, I am still looking for solutions directly solved my initial problem.
Upvotes: 0
Views: 782
Reputation: 531
Django does not support multiple statements in a QuerySet. Anyway for variables such as group_concat_max_len
, you are much better putting them in init_command
, or if you have enough control on your database server, setting them globally as an admin account and storing the value in my.cnf
.
Upvotes: 1