explorerhq / explorerhq/sql-explorer
configuring read only connection still uses default connection
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 373
- PR merge metrics
- No merged PRs in 30d
Description
Hi, I am using sql-explorer in a project, at first decided to use the default django connection and everything worked as expected, later on I decided to create a new database user with read only permissions for sql-explorer as your documentation suggests.
Unfortunately, after this change each of the queries I had in there was throwing me a 500 error, in detail, it was throwing:
> InvalidExplorerConnectionException: Attempted to access connection default, but that is not a registered Explorer connection.
After getting really mad and check the code I found what was the problem, the connection used for every query is somehow stored in the Query django model you guys have (which I don't know why) which of course it was still pointing to the default connection and not the new one, had to manually update all the `connection` fields of this Query model to point to the new connection like this:
> Query.objects.all().update(connection="sql_explorer")
after this everything is working fine again with the new connection, not sure why you guys want to store the connection but I think we are missing a mechanism to update those if you change EXPLORER_CONNECTIONS in settings.py at least.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.