Opened 9 years ago

Closed 5 years ago

#3233 closed defect (wontfix) reset fails to handle valid sql file

Reported by: chris_brand@… Owned by: nobody
Component: Core (Management commands) Version: 0.95
Severity: normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


I've got an SQL file to populate the database in my camps/sql directory.

Using "python dbshell", I can then source this sql file and it runs fine, correctly populating the database.

If I run "python reset camps", though, I get this error :
Error: camps couldn't be installed. Possible reasons:

  • The database isn't running or isn't configured correctly.
  • At least one of the database tables already exists.
  • The SQL was invalid.

Hint: Look at the output of ' sqlreset camps'. That's the SQL this command wasn't able to run.
The full error: not enough arguments for format string

It looks like the final "INSERT INTO..." statement is not being parsed correctly somewhere, I think...

"python sqlreset camps" runs ok and produces a stack of SQL.

I can provide the sql file, but there doesn't seem to be any way to attach it to this ticket, and it's fairly large (>3000 lines).

Attachments (1)

cadet.sql (67.6 KB) - added by anonymous 9 years ago.
SQL file that fails

Download all attachments as: .zip

Change History (11)

Changed 9 years ago by anonymous

SQL file that fails

comment:1 Changed 9 years ago by dev@…

  • Keywords added

Hmm.. does it sound like this? - this was a problem on SQLite (I must have forgotten to submit it as a ticket).

comment:2 Changed 9 years ago by chris_brand@…

I'm using MySQL as the backend, and I don't believe there are any '%'s in my data, so it doesn't sound like exactly the same thing...

comment:3 Changed 9 years ago by chris_brand@…

BTW, I discovered when trying to cut the file down to make a more manageable test case that cutting most of the content in the third, and final, INSERT makes the problem go away.

comment:4 Changed 9 years ago by Simon G. <dev@…>

  • Triage Stage changed from Unreviewed to Accepted

Hmm.. could this be overloading MySQL's max_allowed_packet size (e.g. I believe that it's 1mb by default, but it may be something to do with all those subselects in your SQL file as well.

comment:5 Changed 9 years ago by chris_brand@…

If it was running into a MySQL limit, would this :

Using "python dbshell", I can then source this sql file and it runs fine, correctly populating the database.

(my current work-around)
be true ?

comment:6 Changed 9 years ago by Marc Fargas <telenieko@…>

It's possible that the max_allowed_packet for MySQLdb is not enough to load your file while the one for the mysql client is larger enough. This setting has to be enough on the server and the client and reset uses the python mysql module to load your file, while dbshell drop you into the mysql client itself.

I tried to read about that on the MySQLdb site but it's down so I cannot confirm that. But it's a possibility. Another possible cause is the way reset sends the file to the server and how the mysql client does (maybe one splits the file into statements and the other sends the file as a whole?)

Just some ideas on where could the problem be.

comment:7 Changed 7 years ago by adrian

  • Component changed from Tools to

comment:8 Changed 6 years ago by anonymous

  • Version changed from 0.95 to SVN

comment:9 Changed 6 years ago by anonymous

  • Version changed from SVN to 0.95

comment:10 Changed 5 years ago by russellm

  • Resolution set to wontfix
  • Status changed from new to closed

As per #14268, we're deprecating sqlreset and family.

Note: See TracTickets for help on using tickets.
Back to Top