Forum Discussion

kye1's avatar
kye1
New Member
8 months ago
Solved

About Pipeline Query

Hi Team,

I met a problem that when I use Lookup from Fabric Pipeline, linking lakehouse and I can't find the "Query" even I choose Table.
The case is that I create a table to be the watermark to do increamental load but cant find "Query" when using Lookup in Pipeline.
Please help. Thank you guys.

Best Regards,
Kye

  • Anonymous's avatar
    Anonymous
    8 months ago

    Hi kye1crystal ,

     

    Thank you for clarifying. The T-SQL Query option shown in your screenshot is only available in the Copy Data activity when using the Lakehouse SQL analytics endpoint.

    For the Lookup activity, this option isn't supported with Lakehouse connections. Lookup can reference only Tables or Files, which is why you don't see the query textbox.

    If you want to run a query as part of your Lookup logic, you can use the Azure SQL Database connector and connect it to the Lakehouse SQL analytics endpoint. This way, Lookup will support T-SQL queries.

    I hope this explains the behavior.

     

    Thank you.

12 Replies

  • You can use Azure SQL Db connector and connect to the lakehouse via SQL anlaytics endpoint and then use look up activity and query 

  • Hi kye1 ,

     

    There is an option in Copy activity , are you looking for something like this?

     

    Regards,

    Srisakthi

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi kye1crystal ,

     

    Thank you for clarifying. The T-SQL Query option shown in your screenshot is only available in the Copy Data activity when using the Lakehouse SQL analytics endpoint.

    For the Lookup activity, this option isn't supported with Lakehouse connections. Lookup can reference only Tables or Files, which is why you don't see the query textbox.

    If you want to run a query as part of your Lookup logic, you can use the Azure SQL Database connector and connect it to the Lakehouse SQL analytics endpoint. This way, Lookup will support T-SQL queries.

    I hope this explains the behavior.

     

    Thank you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi kye1 ,

    Thank you for reaching out to the Microsoft Fabric Community Forum.

     

    Could you please let us know if the issue has been resolved? I wanted to check if you had the opportunity to review the information provided by  NandanHegde and tayloramy  . If you still require support, please let us know, we are happy to assist you.

     

    Thank you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi kye1 ,

     

    We haven’t received an update from you in some time. Could you please let us know if the issue has been resolved?
    If you still require support, please let us know, we are happy to assist you.

     

    Thank you.

    • kye1crystal's avatar
      kye1crystal
      Frequent Visitor

      Hi Anonymous ,
      The priority of this job seems to lower. So I didn't continue. I will update when I keep finding something. Thanks.

  •  

     

    In Fabric Data Pipeline → Lookup activity:

     

    When you connect Lakehouse and select Table

     

    Fabric does NOT show a “Query” option

     

     

    👉 Because Lookup with Lakehouse only supports table-level access, not custom SQL queries.

     

     

     

     

    Important Limitation (Key Point)

     

    🔴 Lookup activity in Fabric does NOT support SQL queries on Lakehouse tables

     

    That’s why:

     

    You only see Table

     

    No Query textbox appears

     

    You cannot write SELECT MAX(watermark) directly

     

     

     

    ---

     

    How to Handle Watermark for Incremental Load (Correct Ways)

     

    Option 1: Use Lakehouse Table with Single Row

     

    Best & simplest approach.

     

    Design your watermark table like this:

     

    watermark_value

     

    2024-12-01 00:00:00

     

     

    Then in Lookup:

     

    Source: Lakehouse

     

    Table: watermark_table

     

    First row only: enabled

     

     

    You can access it using:

     

    @activity('Lookup_Watermark').output.firstRow.watermark_value

     

    ✔ No query needed

    ✔ Fully supported

     

     

    ---

     

    Option 2: Use Notebook activity (Recommended for flexibility)

     

    If you need:

     

    MAX()

     

    filtering

     

    complex logic

     

     

    Then:

     

    1. Use Notebook activity

     

     

    2. Run Spark SQL:

     

     

     

    SELECT MAX(watermark_value) AS watermark FROM watermark_table

     

    3. Return the value

     

     

    4. Use it in the pipeline via notebook output

     

     

     

    ✔ Most flexible

    ✔ Best practice for complex logic

     

     

    ---

     

    Option 3: Use Warehouse instead of Lakehouse

     

    If your watermark table is in a Fabric Warehouse:

     

    Lookup → Source = Warehouse

     

    You will see “Query”

     

    You can write SQL normally

     

     

     

    ---

     

    Summary (Quick Answer)

     

    Scenario Query Visible?

     

    Lakehouse + Lookup No

    Warehouse + Lookup Yes

    Notebook + Lakehouse Yes

     

     

     

    ---

     

    Recommended Architecture for Incremental Load

     

    ✔ Watermark table = 1 row only

    ✔ Use Lookup (table) OR Notebook

    Do not expect SQL Query option in Lakehouse Lookup

     

     

    How you want to update watermark

     

     

    I’ll design the exact incremental pipeline flow for you step by step 🚀