django-sql-explorer icon indicating copy to clipboard operation
django-sql-explorer copied to clipboard

Dynamic DB connections

Open sdether opened this issue 3 years ago • 3 comments

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.

sdether avatar Aug 21 '21 01:08 sdether

Hi @sdether

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

marksweb avatar Aug 21 '21 13:08 marksweb

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.

sdether avatar Aug 21 '21 16:08 sdether

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

marksweb avatar Aug 21 '21 20:08 marksweb