explorerhq / sql-explorer

SQL reporting that Just Works. Fast, simple, and confusion-free. Write and share queries in a delightful SQL editor, with AI assistance.
https://www.sqlexplorer.io
Other
2.76k stars 366 forks source link

Dynamic DB connections #455

Open sdether opened 3 years ago

sdether commented 3 years ago

My use case requires dynamic database connections to databases not managed by django. These databases are created on on demand, so i can't enumerate them in settings.

I know this scenario likely falls outside the scope of django-sql-explorer, but maybe there is a way to override get_valid_connection() that I haven't thought of, so that I can populate the connection information on lookup miss.

marksweb commented 3 years ago

Hi @sdether

So you're looking for the ability to query arbitrary databases outside the scope of Django itself?

sdether commented 3 years ago

Correct. We have our django database for the application, but we generate customer specific warehouse databases via some ETL processes dynamically and django-sql-explorer would be an ideal tool to let customers explore these databases. From my reading of the code get_valid_connection() is the proxy for fetching connections from django allowed for the explorer.

If there is a hook to override its behavior, I could populate the connection information on lookup miss of alias. If there isn't a hook, I could prepare a PR to provide one, unless this goes counter to the mission of this project.

marksweb commented 3 years ago

@sdether I'm all for extending features/functionality, so a PR to make this an option would be good 👍