evidence icon indicating copy to clipboard operation
evidence copied to clipboard

View source query SQL on the page

Open mmr-crexi opened this issue 2 years ago • 3 comments

Feature Description

With the addition of USQL, I can no longer see the query that was used to hit my source db, but instead am seeing the query to hit the local duckdb. I would like to see that original query.

Goal of Feature

Displaying source queries is one of the big feature draws for using evidence in a technical context. To be honest, this feature request feels like it could be a bug fix request, since the loss of previously displayable queries feels like a functional regression.

Current Solution / Workarounds

Have people look at github source, which is not great, especially since it requires that everyone have github access and that we display the source side-by-side with the report.

Alternatives

Staying on evidence pre-USQL rollout, perhaps v21.

mmr-crexi avatar Feb 09 '24 17:02 mmr-crexi

This is a good idea. @ItsMeBrianD maybe we should add it to the schema explorer?

archiewood avatar Feb 09 '24 17:02 archiewood

Looks like we can enable this if the JSON extension works in WASM correctly: https://duckdb.org/docs/archive/0.9.2/extensions/json#deserializing-sql-to-json-and-vice-versa

ItsMeBrianD avatar Feb 09 '24 18:02 ItsMeBrianD

Okay so some ideas here:

Challenges

  • There are potentially multiple source queries per page query, could look messy
  • Not all sources have source queries. Eg csv connector . What do we do in this case?

Ideas

Some way to see source queries in the query viewer pane.

  • Perhaps there is a third button in the query viewer, which shows all the source queries CleanShot 2024-03-08 at 13 38 02@2x
  • perhaps on hover over the table name with the cursor, it flashes up the source query CleanShot 2024-03-08 at 13 56 12@2x

Advantages

  • Immediately in the context of the query

Disadvantages

  • Requires us to parse the SQL and detect what source tables are being used
  • UX could be hard to read

More information about the queries in the schema explorer

CleanShot 2024-03-08 at 13 51 32@2x

Advantages

  • Logical place to put source information
  • One source query per display area

Disadvantages

  • Schema explorer not currently available in prod (easy to change), just add a link
  • The source query is not "directly on the page"

@ItsMeBrianD why does the JSON extension matter here?

archiewood avatar Mar 08 '24 18:03 archiewood