Opened 12 years ago

Closed 8 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: no UI/UX: no


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 12 years ago.
SQL file that fails

Download all attachments as: .zip

Change History (11)

Changed 12 years ago by anonymous

Attachment: cadet.sql added

SQL file that fails

comment:1 Changed 12 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 12 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 12 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 12 years ago by Simon G. <dev@…>

Triage Stage: UnreviewedAccepted

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 12 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 12 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 11 years ago by Adrian Holovaty


comment:8 Changed 9 years ago by anonymous

Version: 0.95SVN

comment:9 Changed 9 years ago by anonymous

Version: SVN0.95

comment:10 Changed 8 years ago by Russell Keith-Magee

Resolution: wontfix
Status: newclosed

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

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