Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#14536 closed (fixed)

Incorrect syntax about using OPTIONS for changing the database engine

Reported by: denilsonsa Owned by: nobody
Component: Documentation Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Right here: http://docs.djangoproject.com/en/dev/ref/databases/#creating-your-tables

We have the following code:

OPTIONS = {
   "init_command": "SET storage_engine=INNODB",
}

Which is not using the dict syntax. The correct would be:

'OPTIONS': {
   'init_command': 'SET storage_engine=INNODB',
},

(as bonus, to avoid confusion, replaced double-quotes with single-quotes, as they are the type of quotation used by default in settings.py)

A little off-topic, but it says we should remove that line after we create the tables. Why? A little explanation would help. Why can't we just leave it there? (so it will work whenever we need to re-create the tables)

Change History (3)

comment:1 Changed 5 years ago by gabrielhurley

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

I presume the reason it's recommended to remove it is that you don't need (or want) it trying to set that option every time a database connection is made. It would just add overhead and inefficiency. I'm not a MySQL user, though, so I can't say for certain that there isn't another reason.

comment:2 Changed 5 years ago by ramiro

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

(In [14558]) Fixed #14536 -- Corrected DB connection OPTIONS examples in documentation. Thanks denilsonsa for reporting the error.

comment:3 Changed 5 years ago by ramiro

(In [14559]) Fixed #14536 -- Corrected DB connection OPTIONS examples in documentation. Thanks denilsonsa for reporting the error.

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