simonw / simonw/datasette

Allow to hide some queries in metadata.yml

Open
#1,968 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
11.5k
Forks
904
Avg merge
4d 17h
Merged PRs (30d)
18

Description

By default all queries are displayed.

But there are many cases where it would be interesting to hide the queries by default:

  • the website is targeting non-tech people
  • the query is veeeeeery long (eg.)
  • reading the query is not important for the users, they only want to see the result

Of course, the user still could have the option to see the query.

It could be an option in the metadata file:

databases:
  awesome_db:
    tables:
      products:
        hide_sql: true
    queries:
      great_query:
        hide_sql: true
        sql: select * from products where code = :barcode

The priority could be:

  • no option in the metadata and nothing in the URL: query displayed
  • hide_sql in the metadata and nothing in the URL: query displayed as asked in the metadata
  • hide_sql in the metadata and &_hide_sql= in the URL: query as asked in the URL

See also: #1824

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how query definitions from metadata.yml are rendered and how the URL’s _hide_sql option is handled. Review the related discussion in #1824 and verify the requested precedence, including a way for users to reveal a hidden query; done means metadata-defined visibility works for both tables and queries.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sql
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.