Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically include documentation for tables and/or columns from Django model metadata #116

Open
toolness opened this issue May 20, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@toolness
Copy link
Contributor

Since a lot of the tables in a django-sql-dashboard ultimately come from Django models, I thought it would be helpful if the dashboard automatically surfaced the help_text for model fields, and perhaps even the docstring for models themselves, when applicable. This way someone new to the database schema could easily be onboarded.

One easy way to do this without disrupting the current design would be to just add a title attribute to column names that's set to the help_text of the relevant column. However, this would only surface on devices with mice, and wouldn't be accessible to keyboard-only users or screen readers. A more accessible alternative might be to add an information widget (perhaps the unicode character ℹ or an icon of an "i" with a circle around it) that displayed the tooltip on click or enter/space keypress.

@simonw
Copy link
Owner

simonw commented May 24, 2021

This is a really interesting idea. The current database documentation (recently much improved) looks like this:

SQL_Dashboard

@simonw simonw added the enhancement New feature or request label May 24, 2021
@simonw
Copy link
Owner

simonw commented May 24, 2021

I've been thinking about ways of adding optional extra metadata to tables and columns - maybe with some kind of YAML configuration - but I have to admit I hadn't thought to use the existing Django metadata for that!

@simonw
Copy link
Owner

simonw commented May 25, 2021

An interesting opportunity here is that PostgreSQL gives us enough information in cursor.description to tell which table and column the results in an arbitrary query came from - so no matter the query, if a column comes from a specific table we can add extra contextual information to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants