Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#30865 closed Cleanup/optimization (fixed)

Document that some DATABASES['OPTIONS'] are not passed to dbshell database shell.

Reported by: Simon Charette Owned by: Farhaan Bukhsh
Component: Documentation Version: dev
Severity: Normal Keywords: dbshell database options
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: yes UI/UX: no

Description

Some of DATABASES['OPTIONS'] (e.g. isolation_level) are not passed to the the underlying shell.

In the long run I think we should try to add support for as many as of them as possible but since this will likely require and some time and discussion we should at least document the limitation.

For context, we spent a good amount of trying to figure out why SELECT @@TX_ISOLATION was returning a REPEATABLE-READ while we had set isolation_level = 'read committed' in our OPTIONS.

I think it might be more discoverable if the a note was added beside DATABASES['OPTIONS'] instead of dbshell` as that's where we initially looked but that's just anecdotal evidence.

Change History (12)

comment:1 by Carlton Gibson, 5 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Farhaan Bukhsh, 5 years ago

Owner: changed from nobody to Farhaan Bukhsh
Status: newassigned

Hey, I would like to work on this issue. I might need some clarification since I am a new contributor. Let me know if I am doing this right, adding documentation saying some options might not be available around DATABASES['OPTIONS'] instead near dbshell will make it better, right?

Thanks for the help in advance. :joy:

comment:3 by Simon Charette, 5 years ago

Hello Farhaan, thanks for giving a shot at this ticket!

I'm not sure where of the best place is for the documentation to live but I have a slight preference for dbshell since I can't think of another place where we special case connection creation and that was I looked for when trying to figure out what was happening.

I guess a ..note pointing to DATABASE_OPTIONS mentioning some options will be ignored because should do.

comment:4 by Farhaan Bukhsh, 5 years ago

Hey Simon, thanks for replying :) I was thinking something similar may be a list of all options which is not passed near the dbshell documentation. What do you think?

Version 0, edited 5 years ago by Farhaan Bukhsh (next)

comment:5 by Simon Charette, 5 years ago

I was thinking something similar may be a list of all options which is not passed near the dbshell documentation. What do you think?

I think it will be hard to come up with this list for all backends and maintain it over time as some of them are directly passed to the underlying connector.

in reply to:  5 comment:6 by Farhaan Bukhsh, 5 years ago

Replying to Simon Charette:

I was thinking something similar may be a list of all options which is not passed near the dbshell documentation. What do you think?

I think it will be hard to come up with this list for all backends and maintain it over time as some of them are directly passed to the underlying connector.

So I can just link dbshell with DATABASE_OPTIONS pointing out that some options might be ignored, I will open a PR for this.

Last edited 5 years ago by Farhaan Bukhsh (previous) (diff)

comment:7 by Johannes Maron, 5 years ago

Patch needs improvement: set

comment:8 by Farhaan Bukhsh, 5 years ago

Hey Simon according to the documentation https://docs.djangoproject.com/en/2.2/ref/databases/#isolation-level%20isolation_level the default is READ COMMITTED so the behaviour you should have got by default in dbshell should be READ COMMITTED, do you think this is another bug or am I missing something?

comment:9 by Simon Charette, 5 years ago

The MySQL server we were connecting to doesn't default to READ COMMITTED hence why we used DATABASES['OPTIONS']['isolation_level'] = 'read committed' to make sure connections managed by Django have their isolation level set to the right value.

This option is ignored by dbshell which is the reason for this ticket's existence.

comment:10 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

Resolution: fixed
Status: assignedclosed

In cc5622ec:

Fixed #30865 -- Doc'd that not all DATABASESOPTIONS are passed to command-line client.

comment:11 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

In 64b01e38:

[3.0.x] Fixed #30865 -- Doc'd that not all DATABASESOPTIONS are passed to command-line client.

Backport of cc5622ec8c260535c63279cf6eb293f2b5a742f0 from master

comment:12 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

In 398a9f42:

[2.2.x] Fixed #30865 -- Doc'd that not all DATABASESOPTIONS are passed to command-line client.

Backport of cc5622ec8c260535c63279cf6eb293f2b5a742f0 from master

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