DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "tmp",
"TEST": {
"NAME": "tmp"
}
},
"TestSQLite2": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "tmp2",
"TEST": {
"NAME": "tmp2"
}
}
}
EXPLORER_CONNECTIONS = {
"Primary": "default",
"TestSQLite2": "TestSQLite2",
}
EXPLORER_DEFAULT_CONNECTION = "TestSQLite2"
EXPLORER_SQL_BLACKLIST = []
What's the issue
As a developer hosting a site using SQL Explorer, for security purposes, I want to use a Read/write database connection for my django app, but I want to only use a Read only database connection for SQL Explorer. In my experience so far, there is no functioning way to do this. Specifically, if I delete the default connection, the query detail pages doesn't allow me to choose another connection.
If I try to rename the default connection (or any other connection?) for the view in the UI via EXPLORER_CONNECTIONS, it doesn't seem to do anything. You can play with that pretty easily by modifying the values of that dictionary with the app running, so I didn't provide an example here.
How to reproduce the issue:
clone repo
edit test_app/settings.py:
Also Modify
EXPLORER_CHARTS_ENABLED = False(because it errored out on my machine)terminal 1:
terminal 2:
browser:
save and run
modify query to:
INSERT INTO table_name values (1,1,1,1),(2,2,2,2),(3,3,3,3);save and run
modify query to
select * from table_name;save and run
go to connections page, delete default connection
go back to /explorer/
the default query /explorer/1/ doesn't load (because the connection is gone)
the new query /explorer/2/ loads, but you can't hit save and run, and you can't select because the dropdown for connections does not function correctly.