none
What happens when you change a shared query?

    Question

  • When I view the M script for a query that contains a reference to a shared query, I see something like this:

    let

        Source = Embedded.Value("e9860766-bedb-44c9-bb2e-f1f937541c6b"),

    in

        Source

    I assume this is a reference to the query in the catalog (where the GUID is the key to look up the shared query source code).   If this is true, then what happens when the shared query is modified in the catalog?  Do all workbooks that use the shared query get changed as well or does the new version generate a new GUID?

    Also, what would happen if the user refreshing the workbook is not licensed for Power BI?   Would the refresh fail because the user is not authorized to connect to the catalog to resolve the query reference?

    If my assumption about the meaning of Embedded.Value("e9860766-bedb-44c9-bb2e-f1f937541c6b") is wrong, please correct me.

    Tuesday, March 18, 2014 3:45 PM

Answers

  • Hi David,

    When a shared query is consumed, it copies the contents of the query and embeds it in the document for the consuming user. It is not a reference, it is a copy of the shared query. The impact of this model is that any edits to the shared query will not reflect in the copies consumed by other users. The users will have to consume the modified query again to be able to pick up the latest changes.

    This is a known point of feedback and improving this model is an item on our radar.

    Thanks


    Zafar Abbas

    Tuesday, March 18, 2014 9:35 PM

All replies

  • Hi David,

    When a shared query is consumed, it copies the contents of the query and embeds it in the document for the consuming user. It is not a reference, it is a copy of the shared query. The impact of this model is that any edits to the shared query will not reflect in the copies consumed by other users. The users will have to consume the modified query again to be able to pick up the latest changes.

    This is a known point of feedback and improving this model is an item on our radar.

    Thanks


    Zafar Abbas

    Tuesday, March 18, 2014 9:35 PM
  • The current behavior is as Zafar described. If you are interested in making it easier to update a query from the Data Catalog in place for a consumer of that query, my suggested workaround would be:

    1) Find the query via Online Search and add it to your workbook.

    2) Create a new query that references the query that you downloaded from Search. This can be done from the Query contextual ribbon tab or from the Query peek/fly-out in the Workbook Queries pane. This will create a new query (i.e. Query1) that references the other query: Query1 = QueryFromSearch.

    3) You can apply downstream transformation steps or build visualizations on top of "Query1".

    4) If in the future you want to update "QueryFromSearch" to the latest definition of this query in the Data Catalog, consume the query from Search again, and re-point Query1 to QueryFromSearch.

    This will cause Query1 to pick up the new logic/data in QueryFromSearch, and update all downstream artifacts on the next refresh.

    Hope this helps. I'd be interested in learning your thoughts about the importance of such "auto-update" mechanism that Zafar mentioned. The biggest challenge with that is guaranteeing that the downstream artifacts or operations on top of such query don't break after the query definition changes, so this is currently a fairly involved process for the user to ensure the "migration" works.

    Thanks,
    M.

    Saturday, March 22, 2014 4:07 PM