readonly is not a valid Django DB connection.
See original GitHub issueThe documentation suggests the following settings:
EXPLORER_CONNECTIONS = { 'Default': 'readonly' }
EXPLORER_DEFAULT_CONNECTION = 'readonly'
However this results in an error:
django.core.exceptions.ImproperlyConfigured: EXPLORER_CONNECTIONS contains (Default, readonly), but readonly is not a valid Django DB connection.
From doing a quick search (https://github.com/groveco/django-sql-explorer/issues/306), it looks like the solution is changing the settings to:
EXPLORER_CONNECTIONS = { 'Default': 'default' }
EXPLORER_DEFAULT_CONNECTION = 'default'
Is this is the correct (safe) solution? If so, we should update the documentation.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Specifying Readonly access for Django.db connection object
What I'm trying to figure out is how I can define a read-only database connection that is specific to that command or connection...
Read more >readonly is not a valid Django DB connection.
The documentation suggests the following settings: EXPLORER_CONNECTIONS = { 'Default': 'readonly' } EXPLORER_DEFAULT_CONNECTION = 'readonly'.
Read more >django-db-readonly
A way to globally disable writes to your database. This works by inserting a cursor wrapper between Django's CursorWrapper and the database connection's...
Read more >Read-only connection to database. How to?
Hello there, Is it possible to force database access to be read-only when executing custom SQL? I want to make a simple admin...
Read more >Model field reference
Avoid using null on string-based fields such as CharField and TextField . If a string-based field has null=True , that means it has...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Actually the correct thing to do from a security standpoint is to add another read-only connection to your django settings. So beyond ‘default’ you’ll have a ‘readonly’ key to your
DATABASES
settings dictionary (that would connect with a user that has read-only access to the tables).However, the README definitely needs some updating because I can see the following phrase right after
EXPLORER_CONNECTIONS
is explained:this definitely has something missing and needs to be properly completed!
@zehawki I became a maintainer a few days ago to try to get things rolling, bring django 3 support etc.
We’re nearly there with thanks to a fair few people actively contributing. And @spapas has just updated the readme in #406 which I think closes this ticket.
Talking of docs, there is a branch with the very beginning of a sphinx setup. I think the README needs refactoring to be a bit more basic in itself with the vast majority of it’s details put into sphinx.