0

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.

Update

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.

Ivor Zhou
  • 1,241
  • 13
  • 22

1 Answers1

1

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.

Adam Johnson
  • 471
  • 1
  • 5
  • 11