Django SQL Explorer provides a delightful SQL editor and interface for writing and sharing SQL queries directly within a Django admin-like environment. It allows users to quickly generate reports, download data, and visualize results, with recent versions (like 5.3) adding AI assistance for query generation. It is actively maintained, with new releases often coinciding with major Django version compatibility updates.
pip install django-sql-explorerVerified import paths — ran on the pinned version, not inferred.
To set up Django SQL Explorer, first ensure you have Django installed. Then, install `django-sql-explorer` via pip. Add `'explorer'` to your `INSTALLED_APPS` in `settings.py` and include `explorer.urls` in your project's `urls.py`. Run `python manage.py migrate` to create Explorer's database tables. Access is typically restricted to staff or superusers by default. Navigate to `/explorer/` after running the development server and log in with an appropriate user.
Upgrade `django-sql-explorer` to the latest version (`pip install --upgrade django-sql-explorer`) to ensure compatibility with recent Django releases. If specific compatibility is needed, consult the release notes.
Explicitly define `EXPLORER_PERMISSION_VIEW` and `EXPLORER_PERMISSION_CHANGE` in `settings.py` to match your organization's security policies. For example, `EXPLORER_PERMISSION_VIEW = lambda request: request.user.groups.filter(name='Data Analysts').exists()`.
If querying a specific non-default database is required, consider configuring that database as the 'default' for a separate explorer instance, or use Django's database routing feature to direct `explorer`'s queries to a specific database if you have custom logic.
Ensure you are using `path('explorer/', include('explorer.urls'))` in your project's `urls.py`. Always refer to the official documentation for the version you are using for the correct URL configuration.