In a notebook of MS Fabric how to filter a SQL query?

Marco117 80 Reputation points
2024-04-05T18:25:09.6466667+00:00

Hello, I would like to know if I am doing the process correctly.

I need to filter a query from a SQL code block in a Fabric notebook, in my case the variable I use to filter is defined from python using spark.conf.set(). The code I show you works but I don't know if it is the best way.

As a restriction I have that the query has to be done in a sql code block, that's why I can't use spark.sql.
#python

GROUP_TYPE = 225

spark.conf.set("group_type", GROUP_TYPE)


%%sql

DROP VIEW IF EXISTS temp_test;

CREATE TEMPORARY VIEW temp_test AS

SELECT *

FROM MyFact

WHERE GroupTypeSnk = '${group_type}'

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,077 questions
{count} votes

1 answer

Sort by: Most helpful
  1. PRADEEPCHEEKATLA-MSFT 77,426 Reputation points Microsoft Employee
    2024-04-18T02:46:20.3066667+00:00

    @Marco117 - Thanks for the question and using MS Q&A platform.

    Are you referring to any Microsoft Fabric Training learning module or your question specific to Microsoft Fabric product?

    MS Fabric is currently not supported in the Q&A forums, the supported products are listed over here Supported products on MS Q&A (more to be added later on).

    You can ask the experts in the dedicated MS Fabric community forum.

    Can you please open as a new thread in MS Fabric community: https://community.fabric.microsoft.com/t5/General-Discussion/bd-p/ac_generaldiscussion

    User's image

    Hope this helps. Do let us know if you any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    0 comments No comments