Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Dataform optimisation

I have this query in Dataform which I am trying to optimise. I cannot find a way to do it. Any help will be appreciated. Scanning records with timestamp is not helping unfortunately

Any help will be gratefully appreciated.

 

config {
    type: "table",
    description: "Information from PHY diagnostics",
    assertions: {
        uniqueKey: ["eqp","force_vector","scalar_date","update_status","due_date","visual_character"],
        nonNull: [
          "session_id",
          "eqp",
          "visual_character",
          "system"
        ],
    
    }

}

WITH PHY_diagnostics_table AS (

    SELECT 
    PHY.now_time AS visual_character, 
    'N/A' AS retailer_name, 
    PHY.session_id,
    'N/A' AS ufn, 
    'N/A' AS uln, 
    PHY.eqp AS EQP, 
    'N/A' AS rc,
    'N/A' AS md, 
    'N/A' AS di, 
    'N/A' AS h, 
    'PHY_DIAGNOSTICS' AS System,
    V.scalar_date, 
    V.Due_date, 
    V.force_vector, 
    V.force_region,
    V.update_status
    FROM ${ref("PHY_DIAGNOSTICS_INTERACTIONS")} PHY
    JOIN ${ref('result_card')} V ON PHY.eqp = V.EQP
                AND DATE(PHY.now_time) >= DATE_ADD( V.scalar_date , INTERVAL -7 DAY )
                AND (DATE(PHY.now_time) < V.Due_date OR Due_date IS NULL)

)

SELECT DISTINCT * FROM PHY_diagnostics_table

 

 

 

0 1 117
1 REPLY 1