#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 , 5 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 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 , 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?
Here I mean: https://docs.djangoproject.com/en/2.2/ref/django-admin/#dbshell
follow-up: 6 comment:5 by , 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.
comment:6 by , 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.
comment:7 by , 5 years ago
Patch needs improvement: | set |
---|
comment:8 by , 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 , 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.
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 neardbshell
will make it better, right?Thanks for the help in advance. :joy: