[{"data":1,"prerenderedAt":3479},["ShallowReactive",2],{"article-alternates":3,"article-\u002Fit\u002Fdata\u002Fdbt-bigquery-modern-stack-marketing-data":13},{"i18nKey":4,"paths":5},"data-002-2026-07",{"de":6,"en":7,"es":8,"fr":9,"it":10,"ru":11,"tr":12},"\u002Fde\u002Fdata\u002Fdbt-bigquery-moderner-marketing-data-stack","\u002Fen\u002Fdata\u002Fdbt-bigquery-modern-marketing-data-stack","\u002Fes\u002Fdata\u002Fdbt-bigquery-modern-pila-datos-marketing","\u002Ffr\u002Fdata\u002Fdbt-bigquery-stack-marketing-data-moderne","\u002Fit\u002Fdata\u002Fdbt-bigquery-modern-stack-marketing-data","\u002Fru\u002Fdata\u002Fdbt-bigquery-modern-marketing-data-stack","\u002Ftr\u002Fdata\u002Fdbt-bigquery-ile-modern-pazarlama-data-stack",{"_path":10,"_dir":14,"_draft":15,"_partial":15,"_locale":16,"title":17,"description":18,"publishedAt":19,"modifiedAt":19,"category":14,"i18nKey":4,"tags":20,"readingTime":26,"author":27,"body":28,"_type":3473,"_id":3474,"_source":3475,"_file":3476,"_stem":3477,"_extension":3478},"data",false,"","dbt + BigQuery: lo stack moderno per il marketing data","Source mapping, modeling layer, semantic layer, exposures: architettura a quattro livelli che connette i dati di marketing al decision-making.","2026-07-17",[21,22,23,24,25],"dbt","bigquery","data-modeling","semantic-layer","marketing-analytics",9,"Roibase",{"type":29,"children":30,"toc":3465},"root",[31,39,46,90,565,594,615,621,656,1129,1150,1177,1636,1656,1721,1727,1756,2133,2162,2209,2215,2220,2605,2625,2654,2660,2672,3159,3180,3193,3393,3398,3404,3425,3438,3450,3454,3459],{"type":32,"tag":33,"props":34,"children":35},"element","p",{},[36],{"type":37,"value":38},"text","Il report di Google Analytics 4 mostra le performance per canale, Klaviyo registra quante email hai inviato a chi, la dashboard di Meta Ads fornisce il CPA — ma questi tre numeri possono stare insieme nella stessa query SQL? Se non riescono, il decision-making si basa sulla congettura. La promessa dello stack dbt + BigQuery è una sola: modellare i dati di marketing dalla source all'exposure attraverso quattro livelli, trasformando la domanda \"quale canale, quale cliente, quanto valore ha generato\" in una pipeline SQL ripetibile. Nel mondo post-cookie, dove l'attribution multi-touch e l'incrementalità sono diventate obbligatorie, questa architettura non è più un'opzione per l'agenzia specializzata — è una necessità.",{"type":32,"tag":40,"props":41,"children":43},"h2",{"id":42},"source-mapping-organizzare-i-cluster-di-dati-grezzi-in-gruppi-di-tabelle",[44],{"type":37,"value":45},"Source mapping: organizzare i cluster di dati grezzi in gruppi di tabelle",{"type":32,"tag":33,"props":47,"children":48},{},[49,51,58,60,66,67,73,74,80,82,88],{"type":37,"value":50},"In BigQuery ogni piattaforma crea il proprio dataset: ",{"type":32,"tag":52,"props":53,"children":55},"code",{"className":54},[],[56],{"type":37,"value":57},"ga4_export",{"type":37,"value":59},", ",{"type":32,"tag":52,"props":61,"children":63},{"className":62},[],[64],{"type":37,"value":65},"facebook_ads",{"type":37,"value":59},{"type":32,"tag":52,"props":68,"children":70},{"className":69},[],[71],{"type":37,"value":72},"klaviyo_events",{"type":37,"value":59},{"type":32,"tag":52,"props":75,"children":77},{"className":76},[],[78],{"type":37,"value":79},"shopify_orders",{"type":37,"value":81},". Gli schemi grezzi sono incompatibili tra loro — GA4 restituisce JSON annidato, Facebook API CSV piatto, Klaviyo webhook senza normalizzazione. Il source mapping di dbt è il primo livello: sopra questo caos scrivi un manifesto YAML, registri ogni tabella nel blocco ",{"type":32,"tag":52,"props":83,"children":85},{"className":84},[],[86],{"type":37,"value":87},"sources",{"type":37,"value":89}," e dichiari i tipi di dato, se è fresco o stantio, con quale frequenza viene caricato.",{"type":32,"tag":91,"props":92,"children":96},"pre",{"className":93,"code":94,"language":95,"meta":16,"style":16},"language-yaml shiki shiki-themes github-dark","# models\u002Fsources\u002Fmarketing_sources.yml\nversion: 2\n\nsources:\n  - name: ga4_export\n    database: roibase-analytics\n    schema: analytics_123456789\n    tables:\n      - name: events_*\n        identifier: 'events_*'\n        meta:\n          contains_pii: true\n        freshness:\n          warn_after: {count: 25, period: hour}\n          error_after: {count: 49, period: hour}\n\n  - name: facebook_ads\n    schema: facebook_raw\n    tables:\n      - name: ads_insights\n        loaded_at_field: date_start\n        freshness:\n          warn_after: {count: 2, period: day}\n","yaml",[97],{"type":32,"tag":52,"props":98,"children":99},{"__ignoreMap":16},[100,112,134,144,157,181,199,217,230,251,269,282,300,313,364,410,418,439,456,468,489,507,519],{"type":32,"tag":101,"props":102,"children":105},"span",{"class":103,"line":104},"line",1,[106],{"type":32,"tag":101,"props":107,"children":109},{"style":108},"--shiki-default:#6A737D",[110],{"type":37,"value":111},"# models\u002Fsources\u002Fmarketing_sources.yml\n",{"type":32,"tag":101,"props":113,"children":115},{"class":103,"line":114},2,[116,122,128],{"type":32,"tag":101,"props":117,"children":119},{"style":118},"--shiki-default:#85E89D",[120],{"type":37,"value":121},"version",{"type":32,"tag":101,"props":123,"children":125},{"style":124},"--shiki-default:#E1E4E8",[126],{"type":37,"value":127},": ",{"type":32,"tag":101,"props":129,"children":131},{"style":130},"--shiki-default:#79B8FF",[132],{"type":37,"value":133},"2\n",{"type":32,"tag":101,"props":135,"children":137},{"class":103,"line":136},3,[138],{"type":32,"tag":101,"props":139,"children":141},{"emptyLinePlaceholder":140},true,[142],{"type":37,"value":143},"\n",{"type":32,"tag":101,"props":145,"children":147},{"class":103,"line":146},4,[148,152],{"type":32,"tag":101,"props":149,"children":150},{"style":118},[151],{"type":37,"value":87},{"type":32,"tag":101,"props":153,"children":154},{"style":124},[155],{"type":37,"value":156},":\n",{"type":32,"tag":101,"props":158,"children":160},{"class":103,"line":159},5,[161,166,171,175],{"type":32,"tag":101,"props":162,"children":163},{"style":124},[164],{"type":37,"value":165},"  - ",{"type":32,"tag":101,"props":167,"children":168},{"style":118},[169],{"type":37,"value":170},"name",{"type":32,"tag":101,"props":172,"children":173},{"style":124},[174],{"type":37,"value":127},{"type":32,"tag":101,"props":176,"children":178},{"style":177},"--shiki-default:#9ECBFF",[179],{"type":37,"value":180},"ga4_export\n",{"type":32,"tag":101,"props":182,"children":184},{"class":103,"line":183},6,[185,190,194],{"type":32,"tag":101,"props":186,"children":187},{"style":118},[188],{"type":37,"value":189},"    database",{"type":32,"tag":101,"props":191,"children":192},{"style":124},[193],{"type":37,"value":127},{"type":32,"tag":101,"props":195,"children":196},{"style":177},[197],{"type":37,"value":198},"roibase-analytics\n",{"type":32,"tag":101,"props":200,"children":202},{"class":103,"line":201},7,[203,208,212],{"type":32,"tag":101,"props":204,"children":205},{"style":118},[206],{"type":37,"value":207},"    schema",{"type":32,"tag":101,"props":209,"children":210},{"style":124},[211],{"type":37,"value":127},{"type":32,"tag":101,"props":213,"children":214},{"style":177},[215],{"type":37,"value":216},"analytics_123456789\n",{"type":32,"tag":101,"props":218,"children":220},{"class":103,"line":219},8,[221,226],{"type":32,"tag":101,"props":222,"children":223},{"style":118},[224],{"type":37,"value":225},"    tables",{"type":32,"tag":101,"props":227,"children":228},{"style":124},[229],{"type":37,"value":156},{"type":32,"tag":101,"props":231,"children":232},{"class":103,"line":26},[233,238,242,246],{"type":32,"tag":101,"props":234,"children":235},{"style":124},[236],{"type":37,"value":237},"      - ",{"type":32,"tag":101,"props":239,"children":240},{"style":118},[241],{"type":37,"value":170},{"type":32,"tag":101,"props":243,"children":244},{"style":124},[245],{"type":37,"value":127},{"type":32,"tag":101,"props":247,"children":248},{"style":177},[249],{"type":37,"value":250},"events_*\n",{"type":32,"tag":101,"props":252,"children":254},{"class":103,"line":253},10,[255,260,264],{"type":32,"tag":101,"props":256,"children":257},{"style":118},[258],{"type":37,"value":259},"        identifier",{"type":32,"tag":101,"props":261,"children":262},{"style":124},[263],{"type":37,"value":127},{"type":32,"tag":101,"props":265,"children":266},{"style":177},[267],{"type":37,"value":268},"'events_*'\n",{"type":32,"tag":101,"props":270,"children":272},{"class":103,"line":271},11,[273,278],{"type":32,"tag":101,"props":274,"children":275},{"style":118},[276],{"type":37,"value":277},"        meta",{"type":32,"tag":101,"props":279,"children":280},{"style":124},[281],{"type":37,"value":156},{"type":32,"tag":101,"props":283,"children":285},{"class":103,"line":284},12,[286,291,295],{"type":32,"tag":101,"props":287,"children":288},{"style":118},[289],{"type":37,"value":290},"          contains_pii",{"type":32,"tag":101,"props":292,"children":293},{"style":124},[294],{"type":37,"value":127},{"type":32,"tag":101,"props":296,"children":297},{"style":130},[298],{"type":37,"value":299},"true\n",{"type":32,"tag":101,"props":301,"children":303},{"class":103,"line":302},13,[304,309],{"type":32,"tag":101,"props":305,"children":306},{"style":118},[307],{"type":37,"value":308},"        freshness",{"type":32,"tag":101,"props":310,"children":311},{"style":124},[312],{"type":37,"value":156},{"type":32,"tag":101,"props":314,"children":316},{"class":103,"line":315},14,[317,322,327,332,336,341,345,350,354,359],{"type":32,"tag":101,"props":318,"children":319},{"style":118},[320],{"type":37,"value":321},"          warn_after",{"type":32,"tag":101,"props":323,"children":324},{"style":124},[325],{"type":37,"value":326},": {",{"type":32,"tag":101,"props":328,"children":329},{"style":118},[330],{"type":37,"value":331},"count",{"type":32,"tag":101,"props":333,"children":334},{"style":124},[335],{"type":37,"value":127},{"type":32,"tag":101,"props":337,"children":338},{"style":130},[339],{"type":37,"value":340},"25",{"type":32,"tag":101,"props":342,"children":343},{"style":124},[344],{"type":37,"value":59},{"type":32,"tag":101,"props":346,"children":347},{"style":118},[348],{"type":37,"value":349},"period",{"type":32,"tag":101,"props":351,"children":352},{"style":124},[353],{"type":37,"value":127},{"type":32,"tag":101,"props":355,"children":356},{"style":177},[357],{"type":37,"value":358},"hour",{"type":32,"tag":101,"props":360,"children":361},{"style":124},[362],{"type":37,"value":363},"}\n",{"type":32,"tag":101,"props":365,"children":367},{"class":103,"line":366},15,[368,373,377,381,385,390,394,398,402,406],{"type":32,"tag":101,"props":369,"children":370},{"style":118},[371],{"type":37,"value":372},"          error_after",{"type":32,"tag":101,"props":374,"children":375},{"style":124},[376],{"type":37,"value":326},{"type":32,"tag":101,"props":378,"children":379},{"style":118},[380],{"type":37,"value":331},{"type":32,"tag":101,"props":382,"children":383},{"style":124},[384],{"type":37,"value":127},{"type":32,"tag":101,"props":386,"children":387},{"style":130},[388],{"type":37,"value":389},"49",{"type":32,"tag":101,"props":391,"children":392},{"style":124},[393],{"type":37,"value":59},{"type":32,"tag":101,"props":395,"children":396},{"style":118},[397],{"type":37,"value":349},{"type":32,"tag":101,"props":399,"children":400},{"style":124},[401],{"type":37,"value":127},{"type":32,"tag":101,"props":403,"children":404},{"style":177},[405],{"type":37,"value":358},{"type":32,"tag":101,"props":407,"children":408},{"style":124},[409],{"type":37,"value":363},{"type":32,"tag":101,"props":411,"children":413},{"class":103,"line":412},16,[414],{"type":32,"tag":101,"props":415,"children":416},{"emptyLinePlaceholder":140},[417],{"type":37,"value":143},{"type":32,"tag":101,"props":419,"children":421},{"class":103,"line":420},17,[422,426,430,434],{"type":32,"tag":101,"props":423,"children":424},{"style":124},[425],{"type":37,"value":165},{"type":32,"tag":101,"props":427,"children":428},{"style":118},[429],{"type":37,"value":170},{"type":32,"tag":101,"props":431,"children":432},{"style":124},[433],{"type":37,"value":127},{"type":32,"tag":101,"props":435,"children":436},{"style":177},[437],{"type":37,"value":438},"facebook_ads\n",{"type":32,"tag":101,"props":440,"children":442},{"class":103,"line":441},18,[443,447,451],{"type":32,"tag":101,"props":444,"children":445},{"style":118},[446],{"type":37,"value":207},{"type":32,"tag":101,"props":448,"children":449},{"style":124},[450],{"type":37,"value":127},{"type":32,"tag":101,"props":452,"children":453},{"style":177},[454],{"type":37,"value":455},"facebook_raw\n",{"type":32,"tag":101,"props":457,"children":459},{"class":103,"line":458},19,[460,464],{"type":32,"tag":101,"props":461,"children":462},{"style":118},[463],{"type":37,"value":225},{"type":32,"tag":101,"props":465,"children":466},{"style":124},[467],{"type":37,"value":156},{"type":32,"tag":101,"props":469,"children":471},{"class":103,"line":470},20,[472,476,480,484],{"type":32,"tag":101,"props":473,"children":474},{"style":124},[475],{"type":37,"value":237},{"type":32,"tag":101,"props":477,"children":478},{"style":118},[479],{"type":37,"value":170},{"type":32,"tag":101,"props":481,"children":482},{"style":124},[483],{"type":37,"value":127},{"type":32,"tag":101,"props":485,"children":486},{"style":177},[487],{"type":37,"value":488},"ads_insights\n",{"type":32,"tag":101,"props":490,"children":492},{"class":103,"line":491},21,[493,498,502],{"type":32,"tag":101,"props":494,"children":495},{"style":118},[496],{"type":37,"value":497},"        loaded_at_field",{"type":32,"tag":101,"props":499,"children":500},{"style":124},[501],{"type":37,"value":127},{"type":32,"tag":101,"props":503,"children":504},{"style":177},[505],{"type":37,"value":506},"date_start\n",{"type":32,"tag":101,"props":508,"children":510},{"class":103,"line":509},22,[511,515],{"type":32,"tag":101,"props":512,"children":513},{"style":118},[514],{"type":37,"value":308},{"type":32,"tag":101,"props":516,"children":517},{"style":124},[518],{"type":37,"value":156},{"type":32,"tag":101,"props":520,"children":522},{"class":103,"line":521},23,[523,527,531,535,539,544,548,552,556,561],{"type":32,"tag":101,"props":524,"children":525},{"style":118},[526],{"type":37,"value":321},{"type":32,"tag":101,"props":528,"children":529},{"style":124},[530],{"type":37,"value":326},{"type":32,"tag":101,"props":532,"children":533},{"style":118},[534],{"type":37,"value":331},{"type":32,"tag":101,"props":536,"children":537},{"style":124},[538],{"type":37,"value":127},{"type":32,"tag":101,"props":540,"children":541},{"style":130},[542],{"type":37,"value":543},"2",{"type":32,"tag":101,"props":545,"children":546},{"style":124},[547],{"type":37,"value":59},{"type":32,"tag":101,"props":549,"children":550},{"style":118},[551],{"type":37,"value":349},{"type":32,"tag":101,"props":553,"children":554},{"style":124},[555],{"type":37,"value":127},{"type":32,"tag":101,"props":557,"children":558},{"style":177},[559],{"type":37,"value":560},"day",{"type":32,"tag":101,"props":562,"children":563},{"style":124},[564],{"type":37,"value":363},{"type":32,"tag":33,"props":566,"children":567},{},[568,570,576,578,584,586,592],{"type":37,"value":569},"Questo manifesto fornisce a dbt due cose: 1) riferimento type-safe alla tabella grezza tramite la macro ",{"type":32,"tag":52,"props":571,"children":573},{"className":572},[],[574],{"type":37,"value":575},"source()",{"type":37,"value":577}," anziché ",{"type":32,"tag":52,"props":579,"children":581},{"className":580},[],[582],{"type":37,"value":583},"ref()",{"type":37,"value":585},", 2) rilevamento del punto esatto in cui la pipeline si ferma con il comando ",{"type":32,"tag":52,"props":587,"children":589},{"className":588},[],[590],{"type":37,"value":591},"dbt source freshness",{"type":37,"value":593},". Se un evento GA4 non è stato aggiornato per 49 ore, BigQuery non genera errore — dbt sì.",{"type":32,"tag":33,"props":595,"children":596},{},[597,599,605,607,613],{"type":37,"value":598},"Durante il source mapping, l'annotazione PII è obbligatoria: secondo GDPR e normative sulla privacy, quale colonna contiene l'ID utente, l'email, l'IP — questa informazione viene propagata nel lineage dei modelli verso il downstream. Ogni tabella con ",{"type":32,"tag":52,"props":600,"children":602},{"className":601},[],[603],{"type":37,"value":604},"user_pseudo_id",{"type":37,"value":606}," riceve il tag ",{"type":32,"tag":52,"props":608,"children":610},{"className":609},[],[611],{"type":37,"value":612},"meta.contains_pii: true",{"type":37,"value":614},". Nel semantic layer, questo tag si combina con le regole di mascheramento a livello di campo.",{"type":32,"tag":40,"props":616,"children":618},{"id":617},"modeling-layer-gli-stadi-di-staging-intermediate-mart",[619],{"type":37,"value":620},"Modeling layer: gli stadi di staging → intermediate → mart",{"type":32,"tag":33,"props":622,"children":623},{},[624,626,632,634,640,641,647,648,654],{"type":37,"value":625},"I modelli di staging rinominano la source grezza, convertono i tipi, scartano le colonne superflue e forniscono un schema standardizzato al downstream. Svolgere l'array ",{"type":32,"tag":52,"props":627,"children":629},{"className":628},[],[630],{"type":37,"value":631},"event_params",{"type":37,"value":633}," di GA4 e convertire campi come ",{"type":32,"tag":52,"props":635,"children":637},{"className":636},[],[638],{"type":37,"value":639},"page_location",{"type":37,"value":59},{"type":32,"tag":52,"props":642,"children":644},{"className":643},[],[645],{"type":37,"value":646},"session_id",{"type":37,"value":59},{"type":32,"tag":52,"props":649,"children":651},{"className":650},[],[652],{"type":37,"value":653},"transaction_id",{"type":37,"value":655}," da parametri annidati a colonne scalari è il lavoro dello staging:",{"type":32,"tag":91,"props":657,"children":661},{"className":658,"code":659,"language":660,"meta":16,"style":16},"language-sql shiki shiki-themes github-dark","-- models\u002Fstaging\u002Fga4\u002Fstg_ga4__events.sql\nwith source as (\n    select * from {{ source('ga4_export', 'events_*') }}\n    where _table_suffix between format_date('%Y%m%d', date_sub(current_date(), interval 90 day))\n                             and format_date('%Y%m%d', current_date())\n),\n\nunnested as (\n    select\n        event_date,\n        event_timestamp,\n        user_pseudo_id,\n        (select value.string_value from unnest(event_params) where key = 'page_location') as page_location,\n        (select value.int_value from unnest(event_params) where key = 'ga_session_id') as session_id,\n        ecommerce.transaction_id,\n        ecommerce.purchase_revenue_in_usd\n    from source\n    where event_name in ('page_view', 'purchase')\n)\n\nselect * from unnested\n","sql",[662],{"type":32,"tag":52,"props":663,"children":664},{"__ignoreMap":16},[665,673,697,739,787,808,816,823,839,847,855,863,871,942,1004,1025,1041,1054,1095,1102,1109],{"type":32,"tag":101,"props":666,"children":667},{"class":103,"line":104},[668],{"type":32,"tag":101,"props":669,"children":670},{"style":108},[671],{"type":37,"value":672},"-- models\u002Fstaging\u002Fga4\u002Fstg_ga4__events.sql\n",{"type":32,"tag":101,"props":674,"children":675},{"class":103,"line":114},[676,682,687,692],{"type":32,"tag":101,"props":677,"children":679},{"style":678},"--shiki-default:#F97583",[680],{"type":37,"value":681},"with",{"type":32,"tag":101,"props":683,"children":684},{"style":124},[685],{"type":37,"value":686}," source ",{"type":32,"tag":101,"props":688,"children":689},{"style":678},[690],{"type":37,"value":691},"as",{"type":32,"tag":101,"props":693,"children":694},{"style":124},[695],{"type":37,"value":696}," (\n",{"type":32,"tag":101,"props":698,"children":699},{"class":103,"line":136},[700,705,710,715,720,725,729,734],{"type":32,"tag":101,"props":701,"children":702},{"style":678},[703],{"type":37,"value":704},"    select",{"type":32,"tag":101,"props":706,"children":707},{"style":678},[708],{"type":37,"value":709}," *",{"type":32,"tag":101,"props":711,"children":712},{"style":678},[713],{"type":37,"value":714}," from",{"type":32,"tag":101,"props":716,"children":717},{"style":124},[718],{"type":37,"value":719}," {{ source(",{"type":32,"tag":101,"props":721,"children":722},{"style":177},[723],{"type":37,"value":724},"'ga4_export'",{"type":32,"tag":101,"props":726,"children":727},{"style":124},[728],{"type":37,"value":59},{"type":32,"tag":101,"props":730,"children":731},{"style":177},[732],{"type":37,"value":733},"'events_*'",{"type":32,"tag":101,"props":735,"children":736},{"style":124},[737],{"type":37,"value":738},") }}\n",{"type":32,"tag":101,"props":740,"children":741},{"class":103,"line":146},[742,747,752,757,762,767,772,777,782],{"type":32,"tag":101,"props":743,"children":744},{"style":678},[745],{"type":37,"value":746},"    where",{"type":32,"tag":101,"props":748,"children":749},{"style":124},[750],{"type":37,"value":751}," _table_suffix ",{"type":32,"tag":101,"props":753,"children":754},{"style":678},[755],{"type":37,"value":756},"between",{"type":32,"tag":101,"props":758,"children":759},{"style":124},[760],{"type":37,"value":761}," format_date(",{"type":32,"tag":101,"props":763,"children":764},{"style":177},[765],{"type":37,"value":766},"'%Y%m%d'",{"type":32,"tag":101,"props":768,"children":769},{"style":124},[770],{"type":37,"value":771},", date_sub(current_date(), interval ",{"type":32,"tag":101,"props":773,"children":774},{"style":130},[775],{"type":37,"value":776},"90",{"type":32,"tag":101,"props":778,"children":779},{"style":678},[780],{"type":37,"value":781}," day",{"type":32,"tag":101,"props":783,"children":784},{"style":124},[785],{"type":37,"value":786},"))\n",{"type":32,"tag":101,"props":788,"children":789},{"class":103,"line":159},[790,795,799,803],{"type":32,"tag":101,"props":791,"children":792},{"style":678},[793],{"type":37,"value":794},"                             and",{"type":32,"tag":101,"props":796,"children":797},{"style":124},[798],{"type":37,"value":761},{"type":32,"tag":101,"props":800,"children":801},{"style":177},[802],{"type":37,"value":766},{"type":32,"tag":101,"props":804,"children":805},{"style":124},[806],{"type":37,"value":807},", current_date())\n",{"type":32,"tag":101,"props":809,"children":810},{"class":103,"line":183},[811],{"type":32,"tag":101,"props":812,"children":813},{"style":124},[814],{"type":37,"value":815},"),\n",{"type":32,"tag":101,"props":817,"children":818},{"class":103,"line":201},[819],{"type":32,"tag":101,"props":820,"children":821},{"emptyLinePlaceholder":140},[822],{"type":37,"value":143},{"type":32,"tag":101,"props":824,"children":825},{"class":103,"line":219},[826,831,835],{"type":32,"tag":101,"props":827,"children":828},{"style":124},[829],{"type":37,"value":830},"unnested ",{"type":32,"tag":101,"props":832,"children":833},{"style":678},[834],{"type":37,"value":691},{"type":32,"tag":101,"props":836,"children":837},{"style":124},[838],{"type":37,"value":696},{"type":32,"tag":101,"props":840,"children":841},{"class":103,"line":26},[842],{"type":32,"tag":101,"props":843,"children":844},{"style":678},[845],{"type":37,"value":846},"    select\n",{"type":32,"tag":101,"props":848,"children":849},{"class":103,"line":253},[850],{"type":32,"tag":101,"props":851,"children":852},{"style":124},[853],{"type":37,"value":854},"        event_date,\n",{"type":32,"tag":101,"props":856,"children":857},{"class":103,"line":271},[858],{"type":32,"tag":101,"props":859,"children":860},{"style":124},[861],{"type":37,"value":862},"        event_timestamp,\n",{"type":32,"tag":101,"props":864,"children":865},{"class":103,"line":284},[866],{"type":32,"tag":101,"props":867,"children":868},{"style":124},[869],{"type":37,"value":870},"        user_pseudo_id,\n",{"type":32,"tag":101,"props":872,"children":873},{"class":103,"line":302},[874,879,884,889,894,899,903,908,913,918,923,928,933,937],{"type":32,"tag":101,"props":875,"children":876},{"style":124},[877],{"type":37,"value":878},"        (",{"type":32,"tag":101,"props":880,"children":881},{"style":678},[882],{"type":37,"value":883},"select",{"type":32,"tag":101,"props":885,"children":886},{"style":130},[887],{"type":37,"value":888}," value",{"type":32,"tag":101,"props":890,"children":891},{"style":124},[892],{"type":37,"value":893},".",{"type":32,"tag":101,"props":895,"children":896},{"style":130},[897],{"type":37,"value":898},"string_value",{"type":32,"tag":101,"props":900,"children":901},{"style":678},[902],{"type":37,"value":714},{"type":32,"tag":101,"props":904,"children":905},{"style":124},[906],{"type":37,"value":907}," unnest(event_params) ",{"type":32,"tag":101,"props":909,"children":910},{"style":678},[911],{"type":37,"value":912},"where",{"type":32,"tag":101,"props":914,"children":915},{"style":678},[916],{"type":37,"value":917}," key",{"type":32,"tag":101,"props":919,"children":920},{"style":678},[921],{"type":37,"value":922}," =",{"type":32,"tag":101,"props":924,"children":925},{"style":177},[926],{"type":37,"value":927}," 'page_location'",{"type":32,"tag":101,"props":929,"children":930},{"style":124},[931],{"type":37,"value":932},") ",{"type":32,"tag":101,"props":934,"children":935},{"style":678},[936],{"type":37,"value":691},{"type":32,"tag":101,"props":938,"children":939},{"style":124},[940],{"type":37,"value":941}," page_location,\n",{"type":32,"tag":101,"props":943,"children":944},{"class":103,"line":315},[945,949,953,957,961,966,970,974,978,982,986,991,995,999],{"type":32,"tag":101,"props":946,"children":947},{"style":124},[948],{"type":37,"value":878},{"type":32,"tag":101,"props":950,"children":951},{"style":678},[952],{"type":37,"value":883},{"type":32,"tag":101,"props":954,"children":955},{"style":130},[956],{"type":37,"value":888},{"type":32,"tag":101,"props":958,"children":959},{"style":124},[960],{"type":37,"value":893},{"type":32,"tag":101,"props":962,"children":963},{"style":130},[964],{"type":37,"value":965},"int_value",{"type":32,"tag":101,"props":967,"children":968},{"style":678},[969],{"type":37,"value":714},{"type":32,"tag":101,"props":971,"children":972},{"style":124},[973],{"type":37,"value":907},{"type":32,"tag":101,"props":975,"children":976},{"style":678},[977],{"type":37,"value":912},{"type":32,"tag":101,"props":979,"children":980},{"style":678},[981],{"type":37,"value":917},{"type":32,"tag":101,"props":983,"children":984},{"style":678},[985],{"type":37,"value":922},{"type":32,"tag":101,"props":987,"children":988},{"style":177},[989],{"type":37,"value":990}," 'ga_session_id'",{"type":32,"tag":101,"props":992,"children":993},{"style":124},[994],{"type":37,"value":932},{"type":32,"tag":101,"props":996,"children":997},{"style":678},[998],{"type":37,"value":691},{"type":32,"tag":101,"props":1000,"children":1001},{"style":124},[1002],{"type":37,"value":1003}," session_id,\n",{"type":32,"tag":101,"props":1005,"children":1006},{"class":103,"line":366},[1007,1012,1016,1020],{"type":32,"tag":101,"props":1008,"children":1009},{"style":130},[1010],{"type":37,"value":1011},"        ecommerce",{"type":32,"tag":101,"props":1013,"children":1014},{"style":124},[1015],{"type":37,"value":893},{"type":32,"tag":101,"props":1017,"children":1018},{"style":130},[1019],{"type":37,"value":653},{"type":32,"tag":101,"props":1021,"children":1022},{"style":124},[1023],{"type":37,"value":1024},",\n",{"type":32,"tag":101,"props":1026,"children":1027},{"class":103,"line":412},[1028,1032,1036],{"type":32,"tag":101,"props":1029,"children":1030},{"style":130},[1031],{"type":37,"value":1011},{"type":32,"tag":101,"props":1033,"children":1034},{"style":124},[1035],{"type":37,"value":893},{"type":32,"tag":101,"props":1037,"children":1038},{"style":130},[1039],{"type":37,"value":1040},"purchase_revenue_in_usd\n",{"type":32,"tag":101,"props":1042,"children":1043},{"class":103,"line":420},[1044,1049],{"type":32,"tag":101,"props":1045,"children":1046},{"style":678},[1047],{"type":37,"value":1048},"    from",{"type":32,"tag":101,"props":1050,"children":1051},{"style":124},[1052],{"type":37,"value":1053}," source\n",{"type":32,"tag":101,"props":1055,"children":1056},{"class":103,"line":441},[1057,1061,1066,1071,1076,1081,1085,1090],{"type":32,"tag":101,"props":1058,"children":1059},{"style":678},[1060],{"type":37,"value":746},{"type":32,"tag":101,"props":1062,"children":1063},{"style":124},[1064],{"type":37,"value":1065}," event_name ",{"type":32,"tag":101,"props":1067,"children":1068},{"style":678},[1069],{"type":37,"value":1070},"in",{"type":32,"tag":101,"props":1072,"children":1073},{"style":124},[1074],{"type":37,"value":1075}," (",{"type":32,"tag":101,"props":1077,"children":1078},{"style":177},[1079],{"type":37,"value":1080},"'page_view'",{"type":32,"tag":101,"props":1082,"children":1083},{"style":124},[1084],{"type":37,"value":59},{"type":32,"tag":101,"props":1086,"children":1087},{"style":177},[1088],{"type":37,"value":1089},"'purchase'",{"type":32,"tag":101,"props":1091,"children":1092},{"style":124},[1093],{"type":37,"value":1094},")\n",{"type":32,"tag":101,"props":1096,"children":1097},{"class":103,"line":458},[1098],{"type":32,"tag":101,"props":1099,"children":1100},{"style":124},[1101],{"type":37,"value":1094},{"type":32,"tag":101,"props":1103,"children":1104},{"class":103,"line":470},[1105],{"type":32,"tag":101,"props":1106,"children":1107},{"emptyLinePlaceholder":140},[1108],{"type":37,"value":143},{"type":32,"tag":101,"props":1110,"children":1111},{"class":103,"line":491},[1112,1116,1120,1124],{"type":32,"tag":101,"props":1113,"children":1114},{"style":678},[1115],{"type":37,"value":883},{"type":32,"tag":101,"props":1117,"children":1118},{"style":678},[1119],{"type":37,"value":709},{"type":32,"tag":101,"props":1121,"children":1122},{"style":678},[1123],{"type":37,"value":714},{"type":32,"tag":101,"props":1125,"children":1126},{"style":124},[1127],{"type":37,"value":1128}," unnested\n",{"type":32,"tag":33,"props":1130,"children":1131},{},[1132,1134,1140,1142,1148],{"type":37,"value":1133},"Questo modello riceve il prefisso ",{"type":32,"tag":52,"props":1135,"children":1137},{"className":1136},[],[1138],{"type":37,"value":1139},"stg_",{"type":37,"value":1141}," — nel downstream nessuno accede direttamente alla source, tutti prelevam dallo staging. I modelli di staging possono essere incrementali: ogni giorno elaborano solo la nuova partizione. Il comando ",{"type":32,"tag":52,"props":1143,"children":1145},{"className":1144},[],[1146],{"type":37,"value":1147},"dbt build --select stg_ga4__events",{"type":37,"value":1149}," viene eseguito in 30 secondi, senza rielaborare ogni volta 90 giorni di dati storici.",{"type":32,"tag":33,"props":1151,"children":1152},{},[1153,1155,1161,1162,1168,1169,1175],{"type":37,"value":1154},"I modelli intermediate uniscono lo staging e creano concetti analitici: ",{"type":32,"tag":52,"props":1156,"children":1158},{"className":1157},[],[1159],{"type":37,"value":1160},"int_sessions",{"type":37,"value":59},{"type":32,"tag":52,"props":1163,"children":1165},{"className":1164},[],[1166],{"type":37,"value":1167},"int_customer_cohorts",{"type":37,"value":59},{"type":32,"tag":52,"props":1170,"children":1172},{"className":1171},[],[1173],{"type":37,"value":1174},"int_channel_attribution",{"type":37,"value":1176},". Nascondono la logica della tabella intermedia. Ad esempio, il calcolo dell'attribution multi-touch è intermedio:",{"type":32,"tag":91,"props":1178,"children":1180},{"className":658,"code":1179,"language":660,"meta":16,"style":16},"-- models\u002Fintermediate\u002Fmarketing\u002Fint_channel_attribution.sql\nwith touchpoints as (\n    select\n        user_id,\n        session_start_timestamp,\n        source_medium,\n        row_number() over (partition by user_id order by session_start_timestamp) as touch_position,\n        count(*) over (partition by user_id) as total_touches\n    from {{ ref('stg_sessions') }}\n    where user_id is not null\n),\n\nattributed as (\n    select\n        user_id,\n        source_medium,\n        case\n            when touch_position = 1 then 0.4\n            when touch_position = total_touches then 0.4\n            else 0.2 \u002F (total_touches - 2)\n        end as attribution_weight\n    from touchpoints\n)\n\nselect * from attributed\n",[1181],{"type":32,"tag":52,"props":1182,"children":1183},{"__ignoreMap":16},[1184,1192,1212,1219,1227,1235,1243,1299,1351,1372,1388,1395,1402,1418,1425,1432,1439,1447,1489,1526,1570,1588,1600,1607,1615],{"type":32,"tag":101,"props":1185,"children":1186},{"class":103,"line":104},[1187],{"type":32,"tag":101,"props":1188,"children":1189},{"style":108},[1190],{"type":37,"value":1191},"-- models\u002Fintermediate\u002Fmarketing\u002Fint_channel_attribution.sql\n",{"type":32,"tag":101,"props":1193,"children":1194},{"class":103,"line":114},[1195,1199,1204,1208],{"type":32,"tag":101,"props":1196,"children":1197},{"style":678},[1198],{"type":37,"value":681},{"type":32,"tag":101,"props":1200,"children":1201},{"style":124},[1202],{"type":37,"value":1203}," touchpoints ",{"type":32,"tag":101,"props":1205,"children":1206},{"style":678},[1207],{"type":37,"value":691},{"type":32,"tag":101,"props":1209,"children":1210},{"style":124},[1211],{"type":37,"value":696},{"type":32,"tag":101,"props":1213,"children":1214},{"class":103,"line":136},[1215],{"type":32,"tag":101,"props":1216,"children":1217},{"style":678},[1218],{"type":37,"value":846},{"type":32,"tag":101,"props":1220,"children":1221},{"class":103,"line":146},[1222],{"type":32,"tag":101,"props":1223,"children":1224},{"style":124},[1225],{"type":37,"value":1226},"        user_id,\n",{"type":32,"tag":101,"props":1228,"children":1229},{"class":103,"line":159},[1230],{"type":32,"tag":101,"props":1231,"children":1232},{"style":124},[1233],{"type":37,"value":1234},"        session_start_timestamp,\n",{"type":32,"tag":101,"props":1236,"children":1237},{"class":103,"line":183},[1238],{"type":32,"tag":101,"props":1239,"children":1240},{"style":124},[1241],{"type":37,"value":1242},"        source_medium,\n",{"type":32,"tag":101,"props":1244,"children":1245},{"class":103,"line":201},[1246,1251,1256,1261,1265,1270,1275,1280,1285,1290,1294],{"type":32,"tag":101,"props":1247,"children":1248},{"style":130},[1249],{"type":37,"value":1250},"        row_number",{"type":32,"tag":101,"props":1252,"children":1253},{"style":124},[1254],{"type":37,"value":1255},"() ",{"type":32,"tag":101,"props":1257,"children":1258},{"style":678},[1259],{"type":37,"value":1260},"over",{"type":32,"tag":101,"props":1262,"children":1263},{"style":124},[1264],{"type":37,"value":1075},{"type":32,"tag":101,"props":1266,"children":1267},{"style":678},[1268],{"type":37,"value":1269},"partition",{"type":32,"tag":101,"props":1271,"children":1272},{"style":678},[1273],{"type":37,"value":1274}," by",{"type":32,"tag":101,"props":1276,"children":1277},{"style":124},[1278],{"type":37,"value":1279}," user_id ",{"type":32,"tag":101,"props":1281,"children":1282},{"style":678},[1283],{"type":37,"value":1284},"order by",{"type":32,"tag":101,"props":1286,"children":1287},{"style":124},[1288],{"type":37,"value":1289}," session_start_timestamp) ",{"type":32,"tag":101,"props":1291,"children":1292},{"style":678},[1293],{"type":37,"value":691},{"type":32,"tag":101,"props":1295,"children":1296},{"style":124},[1297],{"type":37,"value":1298}," touch_position,\n",{"type":32,"tag":101,"props":1300,"children":1301},{"class":103,"line":219},[1302,1307,1312,1317,1321,1325,1329,1333,1337,1342,1346],{"type":32,"tag":101,"props":1303,"children":1304},{"style":130},[1305],{"type":37,"value":1306},"        count",{"type":32,"tag":101,"props":1308,"children":1309},{"style":124},[1310],{"type":37,"value":1311},"(",{"type":32,"tag":101,"props":1313,"children":1314},{"style":678},[1315],{"type":37,"value":1316},"*",{"type":32,"tag":101,"props":1318,"children":1319},{"style":124},[1320],{"type":37,"value":932},{"type":32,"tag":101,"props":1322,"children":1323},{"style":678},[1324],{"type":37,"value":1260},{"type":32,"tag":101,"props":1326,"children":1327},{"style":124},[1328],{"type":37,"value":1075},{"type":32,"tag":101,"props":1330,"children":1331},{"style":678},[1332],{"type":37,"value":1269},{"type":32,"tag":101,"props":1334,"children":1335},{"style":678},[1336],{"type":37,"value":1274},{"type":32,"tag":101,"props":1338,"children":1339},{"style":124},[1340],{"type":37,"value":1341}," user_id) ",{"type":32,"tag":101,"props":1343,"children":1344},{"style":678},[1345],{"type":37,"value":691},{"type":32,"tag":101,"props":1347,"children":1348},{"style":124},[1349],{"type":37,"value":1350}," total_touches\n",{"type":32,"tag":101,"props":1352,"children":1353},{"class":103,"line":26},[1354,1358,1363,1368],{"type":32,"tag":101,"props":1355,"children":1356},{"style":678},[1357],{"type":37,"value":1048},{"type":32,"tag":101,"props":1359,"children":1360},{"style":124},[1361],{"type":37,"value":1362}," {{ ref(",{"type":32,"tag":101,"props":1364,"children":1365},{"style":177},[1366],{"type":37,"value":1367},"'stg_sessions'",{"type":32,"tag":101,"props":1369,"children":1370},{"style":124},[1371],{"type":37,"value":738},{"type":32,"tag":101,"props":1373,"children":1374},{"class":103,"line":253},[1375,1379,1383],{"type":32,"tag":101,"props":1376,"children":1377},{"style":678},[1378],{"type":37,"value":746},{"type":32,"tag":101,"props":1380,"children":1381},{"style":124},[1382],{"type":37,"value":1279},{"type":32,"tag":101,"props":1384,"children":1385},{"style":678},[1386],{"type":37,"value":1387},"is not null\n",{"type":32,"tag":101,"props":1389,"children":1390},{"class":103,"line":271},[1391],{"type":32,"tag":101,"props":1392,"children":1393},{"style":124},[1394],{"type":37,"value":815},{"type":32,"tag":101,"props":1396,"children":1397},{"class":103,"line":284},[1398],{"type":32,"tag":101,"props":1399,"children":1400},{"emptyLinePlaceholder":140},[1401],{"type":37,"value":143},{"type":32,"tag":101,"props":1403,"children":1404},{"class":103,"line":302},[1405,1410,1414],{"type":32,"tag":101,"props":1406,"children":1407},{"style":124},[1408],{"type":37,"value":1409},"attributed ",{"type":32,"tag":101,"props":1411,"children":1412},{"style":678},[1413],{"type":37,"value":691},{"type":32,"tag":101,"props":1415,"children":1416},{"style":124},[1417],{"type":37,"value":696},{"type":32,"tag":101,"props":1419,"children":1420},{"class":103,"line":315},[1421],{"type":32,"tag":101,"props":1422,"children":1423},{"style":678},[1424],{"type":37,"value":846},{"type":32,"tag":101,"props":1426,"children":1427},{"class":103,"line":366},[1428],{"type":32,"tag":101,"props":1429,"children":1430},{"style":124},[1431],{"type":37,"value":1226},{"type":32,"tag":101,"props":1433,"children":1434},{"class":103,"line":412},[1435],{"type":32,"tag":101,"props":1436,"children":1437},{"style":124},[1438],{"type":37,"value":1242},{"type":32,"tag":101,"props":1440,"children":1441},{"class":103,"line":420},[1442],{"type":32,"tag":101,"props":1443,"children":1444},{"style":678},[1445],{"type":37,"value":1446},"        case\n",{"type":32,"tag":101,"props":1448,"children":1449},{"class":103,"line":441},[1450,1455,1460,1465,1470,1475,1480,1484],{"type":32,"tag":101,"props":1451,"children":1452},{"style":678},[1453],{"type":37,"value":1454},"            when",{"type":32,"tag":101,"props":1456,"children":1457},{"style":124},[1458],{"type":37,"value":1459}," touch_position ",{"type":32,"tag":101,"props":1461,"children":1462},{"style":678},[1463],{"type":37,"value":1464},"=",{"type":32,"tag":101,"props":1466,"children":1467},{"style":130},[1468],{"type":37,"value":1469}," 1",{"type":32,"tag":101,"props":1471,"children":1472},{"style":678},[1473],{"type":37,"value":1474}," then",{"type":32,"tag":101,"props":1476,"children":1477},{"style":130},[1478],{"type":37,"value":1479}," 0",{"type":32,"tag":101,"props":1481,"children":1482},{"style":124},[1483],{"type":37,"value":893},{"type":32,"tag":101,"props":1485,"children":1486},{"style":130},[1487],{"type":37,"value":1488},"4\n",{"type":32,"tag":101,"props":1490,"children":1491},{"class":103,"line":458},[1492,1496,1500,1504,1509,1514,1518,1522],{"type":32,"tag":101,"props":1493,"children":1494},{"style":678},[1495],{"type":37,"value":1454},{"type":32,"tag":101,"props":1497,"children":1498},{"style":124},[1499],{"type":37,"value":1459},{"type":32,"tag":101,"props":1501,"children":1502},{"style":678},[1503],{"type":37,"value":1464},{"type":32,"tag":101,"props":1505,"children":1506},{"style":124},[1507],{"type":37,"value":1508}," total_touches ",{"type":32,"tag":101,"props":1510,"children":1511},{"style":678},[1512],{"type":37,"value":1513},"then",{"type":32,"tag":101,"props":1515,"children":1516},{"style":130},[1517],{"type":37,"value":1479},{"type":32,"tag":101,"props":1519,"children":1520},{"style":124},[1521],{"type":37,"value":893},{"type":32,"tag":101,"props":1523,"children":1524},{"style":130},[1525],{"type":37,"value":1488},{"type":32,"tag":101,"props":1527,"children":1528},{"class":103,"line":470},[1529,1534,1538,1542,1546,1551,1556,1561,1566],{"type":32,"tag":101,"props":1530,"children":1531},{"style":678},[1532],{"type":37,"value":1533},"            else",{"type":32,"tag":101,"props":1535,"children":1536},{"style":130},[1537],{"type":37,"value":1479},{"type":32,"tag":101,"props":1539,"children":1540},{"style":124},[1541],{"type":37,"value":893},{"type":32,"tag":101,"props":1543,"children":1544},{"style":130},[1545],{"type":37,"value":543},{"type":32,"tag":101,"props":1547,"children":1548},{"style":678},[1549],{"type":37,"value":1550}," \u002F",{"type":32,"tag":101,"props":1552,"children":1553},{"style":124},[1554],{"type":37,"value":1555}," (total_touches ",{"type":32,"tag":101,"props":1557,"children":1558},{"style":678},[1559],{"type":37,"value":1560},"-",{"type":32,"tag":101,"props":1562,"children":1563},{"style":130},[1564],{"type":37,"value":1565}," 2",{"type":32,"tag":101,"props":1567,"children":1568},{"style":124},[1569],{"type":37,"value":1094},{"type":32,"tag":101,"props":1571,"children":1572},{"class":103,"line":491},[1573,1578,1583],{"type":32,"tag":101,"props":1574,"children":1575},{"style":678},[1576],{"type":37,"value":1577},"        end",{"type":32,"tag":101,"props":1579,"children":1580},{"style":678},[1581],{"type":37,"value":1582}," as",{"type":32,"tag":101,"props":1584,"children":1585},{"style":124},[1586],{"type":37,"value":1587}," attribution_weight\n",{"type":32,"tag":101,"props":1589,"children":1590},{"class":103,"line":509},[1591,1595],{"type":32,"tag":101,"props":1592,"children":1593},{"style":678},[1594],{"type":37,"value":1048},{"type":32,"tag":101,"props":1596,"children":1597},{"style":124},[1598],{"type":37,"value":1599}," touchpoints\n",{"type":32,"tag":101,"props":1601,"children":1602},{"class":103,"line":521},[1603],{"type":32,"tag":101,"props":1604,"children":1605},{"style":124},[1606],{"type":37,"value":1094},{"type":32,"tag":101,"props":1608,"children":1610},{"class":103,"line":1609},24,[1611],{"type":32,"tag":101,"props":1612,"children":1613},{"emptyLinePlaceholder":140},[1614],{"type":37,"value":143},{"type":32,"tag":101,"props":1616,"children":1618},{"class":103,"line":1617},25,[1619,1623,1627,1631],{"type":32,"tag":101,"props":1620,"children":1621},{"style":678},[1622],{"type":37,"value":883},{"type":32,"tag":101,"props":1624,"children":1625},{"style":678},[1626],{"type":37,"value":709},{"type":32,"tag":101,"props":1628,"children":1629},{"style":678},[1630],{"type":37,"value":714},{"type":32,"tag":101,"props":1632,"children":1633},{"style":124},[1634],{"type":37,"value":1635}," attributed\n",{"type":32,"tag":33,"props":1637,"children":1638},{},[1639,1641,1647,1649,1655],{"type":37,"value":1640},"Modello U-shaped: primo e ultimo contatto ricevono il 40%, i contatti intermedi si dividono il restante 20%. Questo SQL rimane nel modello intermediate, gli scienziati di dati modificano il file, la dashboard frontend non è mai toccata. Se vuoi parametrizzare, definisci ",{"type":32,"tag":52,"props":1642,"children":1644},{"className":1643},[],[1645],{"type":37,"value":1646},"vars.attribution_model: u_shaped",{"type":37,"value":1648}," nel dbt_project.yml e leggi il valore con ",{"type":32,"tag":52,"props":1650,"children":1652},{"className":1651},[],[1653],{"type":37,"value":1654},"{{ var('attribution_model') }}",{"type":37,"value":893},{"type":32,"tag":33,"props":1657,"children":1658},{},[1659,1661,1667,1669,1675,1677,1683,1684,1690,1691,1697,1699,1704,1706,1712,1713,1719],{"type":37,"value":1660},"I modelli mart sono l'ultimo livello: la tabella che la dashboard, il BI tool o la pipeline ML prelevano direttamente. Ricevono il prefisso ",{"type":32,"tag":52,"props":1662,"children":1664},{"className":1663},[],[1665],{"type":37,"value":1666},"fct_",{"type":37,"value":1668}," (fatto) o ",{"type":32,"tag":52,"props":1670,"children":1672},{"className":1671},[],[1673],{"type":37,"value":1674},"dim_",{"type":37,"value":1676}," (dimensione). ",{"type":32,"tag":52,"props":1678,"children":1680},{"className":1679},[],[1681],{"type":37,"value":1682},"fct_orders",{"type":37,"value":59},{"type":32,"tag":52,"props":1685,"children":1687},{"className":1686},[],[1688],{"type":37,"value":1689},"dim_customers",{"type":37,"value":59},{"type":32,"tag":52,"props":1692,"children":1694},{"className":1693},[],[1695],{"type":37,"value":1696},"fct_ad_performance",{"type":37,"value":1698},". I modelli mart possono essere denormalizzati — l'overhead dei join rimane in dbt, non nel BI tool. Invece di \"unisci la tabella degli ordini con il cliente\" in Looker, in ",{"type":32,"tag":52,"props":1700,"children":1702},{"className":1701},[],[1703],{"type":37,"value":1682},{"type":37,"value":1705}," hai già ",{"type":32,"tag":52,"props":1707,"children":1709},{"className":1708},[],[1710],{"type":37,"value":1711},"customer_lifetime_value",{"type":37,"value":59},{"type":32,"tag":52,"props":1714,"children":1716},{"className":1715},[],[1717],{"type":37,"value":1718},"customer_cohort",{"type":37,"value":1720}," come colonne.",{"type":32,"tag":40,"props":1722,"children":1724},{"id":1723},"semantic-layer-la-centralizzazione-della-definizione-delle-metriche-e-della-business-logic",[1725],{"type":37,"value":1726},"Semantic layer: la centralizzazione della definizione delle metriche e della business logic",{"type":32,"tag":33,"props":1728,"children":1729},{},[1730,1732,1738,1740,1746,1748,1754],{"type":37,"value":1731},"A partire da dbt 1.6+, il semantic layer converte l'SQL nel concetto di \"metrica\". Prima, ogni dashboard aveva una propria query ",{"type":32,"tag":52,"props":1733,"children":1735},{"className":1734},[],[1736],{"type":37,"value":1737},"sum(revenue)",{"type":37,"value":1739}," — adesso definisci una metrica ",{"type":32,"tag":52,"props":1741,"children":1743},{"className":1742},[],[1744],{"type":37,"value":1745},"revenue",{"type":37,"value":1747}," una volta sola e le dashboard la utilizzano. La definizione della metrica è in YAML nella cartella ",{"type":32,"tag":52,"props":1749,"children":1751},{"className":1750},[],[1752],{"type":37,"value":1753},"metrics\u002F",{"type":37,"value":1755},":",{"type":32,"tag":91,"props":1757,"children":1759},{"className":93,"code":1758,"language":95,"meta":16,"style":16},"# models\u002Fmetrics\u002Fmarketing_metrics.yml\nversion: 2\n\nmetrics:\n  - name: total_revenue\n    label: Ricavo Totale\n    model: ref('fct_orders')\n    calculation_method: sum\n    expression: order_total\n    timestamp: order_date\n    time_grains: [day, week, month, quarter, year]\n    dimensions:\n      - channel\n      - customer_cohort\n      - product_category\n\n  - name: customer_acquisition_cost\n    label: Costo di Acquisizione Clienti (CAC)\n    calculation_method: derived\n    expression: \"{{ metric('total_ad_spend') }} \u002F {{ metric('new_customers') }}\"\n    timestamp: order_date\n    time_grains: [month, quarter]\n",[1760],{"type":32,"tag":52,"props":1761,"children":1762},{"__ignoreMap":16},[1763,1771,1786,1793,1805,1825,1842,1859,1876,1893,1910,1968,1980,1992,2004,2016,2023,2043,2059,2075,2091,2106],{"type":32,"tag":101,"props":1764,"children":1765},{"class":103,"line":104},[1766],{"type":32,"tag":101,"props":1767,"children":1768},{"style":108},[1769],{"type":37,"value":1770},"# models\u002Fmetrics\u002Fmarketing_metrics.yml\n",{"type":32,"tag":101,"props":1772,"children":1773},{"class":103,"line":114},[1774,1778,1782],{"type":32,"tag":101,"props":1775,"children":1776},{"style":118},[1777],{"type":37,"value":121},{"type":32,"tag":101,"props":1779,"children":1780},{"style":124},[1781],{"type":37,"value":127},{"type":32,"tag":101,"props":1783,"children":1784},{"style":130},[1785],{"type":37,"value":133},{"type":32,"tag":101,"props":1787,"children":1788},{"class":103,"line":136},[1789],{"type":32,"tag":101,"props":1790,"children":1791},{"emptyLinePlaceholder":140},[1792],{"type":37,"value":143},{"type":32,"tag":101,"props":1794,"children":1795},{"class":103,"line":146},[1796,1801],{"type":32,"tag":101,"props":1797,"children":1798},{"style":118},[1799],{"type":37,"value":1800},"metrics",{"type":32,"tag":101,"props":1802,"children":1803},{"style":124},[1804],{"type":37,"value":156},{"type":32,"tag":101,"props":1806,"children":1807},{"class":103,"line":159},[1808,1812,1816,1820],{"type":32,"tag":101,"props":1809,"children":1810},{"style":124},[1811],{"type":37,"value":165},{"type":32,"tag":101,"props":1813,"children":1814},{"style":118},[1815],{"type":37,"value":170},{"type":32,"tag":101,"props":1817,"children":1818},{"style":124},[1819],{"type":37,"value":127},{"type":32,"tag":101,"props":1821,"children":1822},{"style":177},[1823],{"type":37,"value":1824},"total_revenue\n",{"type":32,"tag":101,"props":1826,"children":1827},{"class":103,"line":183},[1828,1833,1837],{"type":32,"tag":101,"props":1829,"children":1830},{"style":118},[1831],{"type":37,"value":1832},"    label",{"type":32,"tag":101,"props":1834,"children":1835},{"style":124},[1836],{"type":37,"value":127},{"type":32,"tag":101,"props":1838,"children":1839},{"style":177},[1840],{"type":37,"value":1841},"Ricavo Totale\n",{"type":32,"tag":101,"props":1843,"children":1844},{"class":103,"line":201},[1845,1850,1854],{"type":32,"tag":101,"props":1846,"children":1847},{"style":118},[1848],{"type":37,"value":1849},"    model",{"type":32,"tag":101,"props":1851,"children":1852},{"style":124},[1853],{"type":37,"value":127},{"type":32,"tag":101,"props":1855,"children":1856},{"style":177},[1857],{"type":37,"value":1858},"ref('fct_orders')\n",{"type":32,"tag":101,"props":1860,"children":1861},{"class":103,"line":219},[1862,1867,1871],{"type":32,"tag":101,"props":1863,"children":1864},{"style":118},[1865],{"type":37,"value":1866},"    calculation_method",{"type":32,"tag":101,"props":1868,"children":1869},{"style":124},[1870],{"type":37,"value":127},{"type":32,"tag":101,"props":1872,"children":1873},{"style":177},[1874],{"type":37,"value":1875},"sum\n",{"type":32,"tag":101,"props":1877,"children":1878},{"class":103,"line":26},[1879,1884,1888],{"type":32,"tag":101,"props":1880,"children":1881},{"style":118},[1882],{"type":37,"value":1883},"    expression",{"type":32,"tag":101,"props":1885,"children":1886},{"style":124},[1887],{"type":37,"value":127},{"type":32,"tag":101,"props":1889,"children":1890},{"style":177},[1891],{"type":37,"value":1892},"order_total\n",{"type":32,"tag":101,"props":1894,"children":1895},{"class":103,"line":253},[1896,1901,1905],{"type":32,"tag":101,"props":1897,"children":1898},{"style":118},[1899],{"type":37,"value":1900},"    timestamp",{"type":32,"tag":101,"props":1902,"children":1903},{"style":124},[1904],{"type":37,"value":127},{"type":32,"tag":101,"props":1906,"children":1907},{"style":177},[1908],{"type":37,"value":1909},"order_date\n",{"type":32,"tag":101,"props":1911,"children":1912},{"class":103,"line":271},[1913,1918,1923,1927,1931,1936,1940,1945,1949,1954,1958,1963],{"type":32,"tag":101,"props":1914,"children":1915},{"style":118},[1916],{"type":37,"value":1917},"    time_grains",{"type":32,"tag":101,"props":1919,"children":1920},{"style":124},[1921],{"type":37,"value":1922},": [",{"type":32,"tag":101,"props":1924,"children":1925},{"style":177},[1926],{"type":37,"value":560},{"type":32,"tag":101,"props":1928,"children":1929},{"style":124},[1930],{"type":37,"value":59},{"type":32,"tag":101,"props":1932,"children":1933},{"style":177},[1934],{"type":37,"value":1935},"week",{"type":32,"tag":101,"props":1937,"children":1938},{"style":124},[1939],{"type":37,"value":59},{"type":32,"tag":101,"props":1941,"children":1942},{"style":177},[1943],{"type":37,"value":1944},"month",{"type":32,"tag":101,"props":1946,"children":1947},{"style":124},[1948],{"type":37,"value":59},{"type":32,"tag":101,"props":1950,"children":1951},{"style":177},[1952],{"type":37,"value":1953},"quarter",{"type":32,"tag":101,"props":1955,"children":1956},{"style":124},[1957],{"type":37,"value":59},{"type":32,"tag":101,"props":1959,"children":1960},{"style":177},[1961],{"type":37,"value":1962},"year",{"type":32,"tag":101,"props":1964,"children":1965},{"style":124},[1966],{"type":37,"value":1967},"]\n",{"type":32,"tag":101,"props":1969,"children":1970},{"class":103,"line":284},[1971,1976],{"type":32,"tag":101,"props":1972,"children":1973},{"style":118},[1974],{"type":37,"value":1975},"    dimensions",{"type":32,"tag":101,"props":1977,"children":1978},{"style":124},[1979],{"type":37,"value":156},{"type":32,"tag":101,"props":1981,"children":1982},{"class":103,"line":302},[1983,1987],{"type":32,"tag":101,"props":1984,"children":1985},{"style":124},[1986],{"type":37,"value":237},{"type":32,"tag":101,"props":1988,"children":1989},{"style":177},[1990],{"type":37,"value":1991},"channel\n",{"type":32,"tag":101,"props":1993,"children":1994},{"class":103,"line":315},[1995,1999],{"type":32,"tag":101,"props":1996,"children":1997},{"style":124},[1998],{"type":37,"value":237},{"type":32,"tag":101,"props":2000,"children":2001},{"style":177},[2002],{"type":37,"value":2003},"customer_cohort\n",{"type":32,"tag":101,"props":2005,"children":2006},{"class":103,"line":366},[2007,2011],{"type":32,"tag":101,"props":2008,"children":2009},{"style":124},[2010],{"type":37,"value":237},{"type":32,"tag":101,"props":2012,"children":2013},{"style":177},[2014],{"type":37,"value":2015},"product_category\n",{"type":32,"tag":101,"props":2017,"children":2018},{"class":103,"line":412},[2019],{"type":32,"tag":101,"props":2020,"children":2021},{"emptyLinePlaceholder":140},[2022],{"type":37,"value":143},{"type":32,"tag":101,"props":2024,"children":2025},{"class":103,"line":420},[2026,2030,2034,2038],{"type":32,"tag":101,"props":2027,"children":2028},{"style":124},[2029],{"type":37,"value":165},{"type":32,"tag":101,"props":2031,"children":2032},{"style":118},[2033],{"type":37,"value":170},{"type":32,"tag":101,"props":2035,"children":2036},{"style":124},[2037],{"type":37,"value":127},{"type":32,"tag":101,"props":2039,"children":2040},{"style":177},[2041],{"type":37,"value":2042},"customer_acquisition_cost\n",{"type":32,"tag":101,"props":2044,"children":2045},{"class":103,"line":441},[2046,2050,2054],{"type":32,"tag":101,"props":2047,"children":2048},{"style":118},[2049],{"type":37,"value":1832},{"type":32,"tag":101,"props":2051,"children":2052},{"style":124},[2053],{"type":37,"value":127},{"type":32,"tag":101,"props":2055,"children":2056},{"style":177},[2057],{"type":37,"value":2058},"Costo di Acquisizione Clienti (CAC)\n",{"type":32,"tag":101,"props":2060,"children":2061},{"class":103,"line":458},[2062,2066,2070],{"type":32,"tag":101,"props":2063,"children":2064},{"style":118},[2065],{"type":37,"value":1866},{"type":32,"tag":101,"props":2067,"children":2068},{"style":124},[2069],{"type":37,"value":127},{"type":32,"tag":101,"props":2071,"children":2072},{"style":177},[2073],{"type":37,"value":2074},"derived\n",{"type":32,"tag":101,"props":2076,"children":2077},{"class":103,"line":470},[2078,2082,2086],{"type":32,"tag":101,"props":2079,"children":2080},{"style":118},[2081],{"type":37,"value":1883},{"type":32,"tag":101,"props":2083,"children":2084},{"style":124},[2085],{"type":37,"value":127},{"type":32,"tag":101,"props":2087,"children":2088},{"style":177},[2089],{"type":37,"value":2090},"\"{{ metric('total_ad_spend') }} \u002F {{ metric('new_customers') }}\"\n",{"type":32,"tag":101,"props":2092,"children":2093},{"class":103,"line":491},[2094,2098,2102],{"type":32,"tag":101,"props":2095,"children":2096},{"style":118},[2097],{"type":37,"value":1900},{"type":32,"tag":101,"props":2099,"children":2100},{"style":124},[2101],{"type":37,"value":127},{"type":32,"tag":101,"props":2103,"children":2104},{"style":177},[2105],{"type":37,"value":1909},{"type":32,"tag":101,"props":2107,"children":2108},{"class":103,"line":509},[2109,2113,2117,2121,2125,2129],{"type":32,"tag":101,"props":2110,"children":2111},{"style":118},[2112],{"type":37,"value":1917},{"type":32,"tag":101,"props":2114,"children":2115},{"style":124},[2116],{"type":37,"value":1922},{"type":32,"tag":101,"props":2118,"children":2119},{"style":177},[2120],{"type":37,"value":1944},{"type":32,"tag":101,"props":2122,"children":2123},{"style":124},[2124],{"type":37,"value":59},{"type":32,"tag":101,"props":2126,"children":2127},{"style":177},[2128],{"type":37,"value":1953},{"type":32,"tag":101,"props":2130,"children":2131},{"style":124},[2132],{"type":37,"value":1967},{"type":32,"tag":33,"props":2134,"children":2135},{},[2136,2138,2144,2146,2152,2154,2160],{"type":37,"value":2137},"Con questa definizione, in Looker la query \"Mostra ",{"type":32,"tag":52,"props":2139,"children":2141},{"className":2140},[],[2142],{"type":37,"value":2143},"total_revenue",{"type":37,"value":2145}," per ",{"type":32,"tag":52,"props":2147,"children":2149},{"className":2148},[],[2150],{"type":37,"value":2151},"channel",{"type":37,"value":2153}," per l'ultimo trimestre\" viene risolta automaticamente tramite l'API dbt Semantic Layer. Non scrivi SQL — chiami la metrica. ",{"type":32,"tag":52,"props":2155,"children":2157},{"className":2156},[],[2158],{"type":37,"value":2159},"customer_acquisition_cost",{"type":37,"value":2161}," è una metrica derivata: calcolata da altre due metriche. Quando la formula cambia, la modifichi in un solo posto, senza aggiornare 12 dashboard manualmente.",{"type":32,"tag":33,"props":2163,"children":2164},{},[2165,2167,2176,2178,2183,2185,2191,2193,2199,2201,2207],{"type":37,"value":2166},"Il secondo vantaggio del semantic layer: richiede l'",{"type":32,"tag":2168,"props":2169,"children":2173},"a",{"href":2170,"rel":2171},"https:\u002F\u002Fwww.roibase.com.tr\u002Fit\u002Ffirstparty",[2172],"nofollow",[2174],{"type":37,"value":2175},"architettura first-party data",{"type":37,"value":2177}," perché la definizione della metrica si basa su customer ID. Se lo ",{"type":32,"tag":52,"props":2179,"children":2181},{"className":2180},[],[2182],{"type":37,"value":604},{"type":37,"value":2184}," di GA4 corrisponde al ",{"type":32,"tag":52,"props":2186,"children":2188},{"className":2187},[],[2189],{"type":37,"value":2190},"customer_id",{"type":37,"value":2192}," di Shopify per la stessa persona, questa identity resolution deve essere risolta nel modello intermediate. La tabella ",{"type":32,"tag":52,"props":2194,"children":2196},{"className":2195},[],[2197],{"type":37,"value":2198},"dim_unified_customers",{"type":37,"value":2200}," unisce tutti i segnali e restituisce ",{"type":32,"tag":52,"props":2202,"children":2204},{"className":2203},[],[2205],{"type":37,"value":2206},"canonical_customer_id",{"type":37,"value":2208},". Quell'ID viene usato come dimensione nel semantic layer. Senza un ID canonico, la metrica CAC risulta sbagliata — lo stesso cliente viene conteggiato due volte.",{"type":32,"tag":40,"props":2210,"children":2212},{"id":2211},"exposures-i-punti-di-consumo-downstream",[2213],{"type":37,"value":2214},"Exposures: i punti di consumo downstream",{"type":32,"tag":33,"props":2216,"children":2217},{},[2218],{"type":37,"value":2219},"Exposure è l'ultimo concetto di dbt: registrare quale dashboard, quale task Airflow, quale modello di machine learning preleva dati da questa pipeline dbt. Il formato è YAML:",{"type":32,"tag":91,"props":2221,"children":2223},{"className":93,"code":2222,"language":95,"meta":16,"style":16},"# models\u002Fexposures\u002Fmarketing_exposures.yml\nversion: 2\n\nexposures:\n  - name: executive_marketing_dashboard\n    type: dashboard\n    maturity: high\n    url: https:\u002F\u002Flookerstudio.google.com\u002Freporting\u002Fabc123\n    description: \"Dashboard CMO: ricavo, CAC, LTV per canale\"\n    depends_on:\n      - ref('fct_orders')\n      - ref('fct_ad_performance')\n      - metric('total_revenue')\n      - metric('customer_acquisition_cost')\n    owner:\n      name: Team Marketing Ops\n      email: ops@roibase.com.tr\n\n  - name: klaviyo_segment_sync\n    type: application\n    maturity: medium\n    description: \"Sincronizzazione segment BigQuery → Klaviyo via Hightouch\"\n    depends_on:\n      - ref('dim_unified_customers')\n    owner:\n      name: CRM Automation\n      email: crm@roibase.com.tr\n",[2224],{"type":32,"tag":52,"props":2225,"children":2226},{"__ignoreMap":16},[2227,2235,2250,2257,2269,2289,2306,2323,2340,2357,2369,2380,2392,2404,2416,2428,2445,2462,2469,2489,2505,2521,2537,2548,2560,2571,2588],{"type":32,"tag":101,"props":2228,"children":2229},{"class":103,"line":104},[2230],{"type":32,"tag":101,"props":2231,"children":2232},{"style":108},[2233],{"type":37,"value":2234},"# models\u002Fexposures\u002Fmarketing_exposures.yml\n",{"type":32,"tag":101,"props":2236,"children":2237},{"class":103,"line":114},[2238,2242,2246],{"type":32,"tag":101,"props":2239,"children":2240},{"style":118},[2241],{"type":37,"value":121},{"type":32,"tag":101,"props":2243,"children":2244},{"style":124},[2245],{"type":37,"value":127},{"type":32,"tag":101,"props":2247,"children":2248},{"style":130},[2249],{"type":37,"value":133},{"type":32,"tag":101,"props":2251,"children":2252},{"class":103,"line":136},[2253],{"type":32,"tag":101,"props":2254,"children":2255},{"emptyLinePlaceholder":140},[2256],{"type":37,"value":143},{"type":32,"tag":101,"props":2258,"children":2259},{"class":103,"line":146},[2260,2265],{"type":32,"tag":101,"props":2261,"children":2262},{"style":118},[2263],{"type":37,"value":2264},"exposures",{"type":32,"tag":101,"props":2266,"children":2267},{"style":124},[2268],{"type":37,"value":156},{"type":32,"tag":101,"props":2270,"children":2271},{"class":103,"line":159},[2272,2276,2280,2284],{"type":32,"tag":101,"props":2273,"children":2274},{"style":124},[2275],{"type":37,"value":165},{"type":32,"tag":101,"props":2277,"children":2278},{"style":118},[2279],{"type":37,"value":170},{"type":32,"tag":101,"props":2281,"children":2282},{"style":124},[2283],{"type":37,"value":127},{"type":32,"tag":101,"props":2285,"children":2286},{"style":177},[2287],{"type":37,"value":2288},"executive_marketing_dashboard\n",{"type":32,"tag":101,"props":2290,"children":2291},{"class":103,"line":183},[2292,2297,2301],{"type":32,"tag":101,"props":2293,"children":2294},{"style":118},[2295],{"type":37,"value":2296},"    type",{"type":32,"tag":101,"props":2298,"children":2299},{"style":124},[2300],{"type":37,"value":127},{"type":32,"tag":101,"props":2302,"children":2303},{"style":177},[2304],{"type":37,"value":2305},"dashboard\n",{"type":32,"tag":101,"props":2307,"children":2308},{"class":103,"line":201},[2309,2314,2318],{"type":32,"tag":101,"props":2310,"children":2311},{"style":118},[2312],{"type":37,"value":2313},"    maturity",{"type":32,"tag":101,"props":2315,"children":2316},{"style":124},[2317],{"type":37,"value":127},{"type":32,"tag":101,"props":2319,"children":2320},{"style":177},[2321],{"type":37,"value":2322},"high\n",{"type":32,"tag":101,"props":2324,"children":2325},{"class":103,"line":219},[2326,2331,2335],{"type":32,"tag":101,"props":2327,"children":2328},{"style":118},[2329],{"type":37,"value":2330},"    url",{"type":32,"tag":101,"props":2332,"children":2333},{"style":124},[2334],{"type":37,"value":127},{"type":32,"tag":101,"props":2336,"children":2337},{"style":177},[2338],{"type":37,"value":2339},"https:\u002F\u002Flookerstudio.google.com\u002Freporting\u002Fabc123\n",{"type":32,"tag":101,"props":2341,"children":2342},{"class":103,"line":26},[2343,2348,2352],{"type":32,"tag":101,"props":2344,"children":2345},{"style":118},[2346],{"type":37,"value":2347},"    description",{"type":32,"tag":101,"props":2349,"children":2350},{"style":124},[2351],{"type":37,"value":127},{"type":32,"tag":101,"props":2353,"children":2354},{"style":177},[2355],{"type":37,"value":2356},"\"Dashboard CMO: ricavo, CAC, LTV per canale\"\n",{"type":32,"tag":101,"props":2358,"children":2359},{"class":103,"line":253},[2360,2365],{"type":32,"tag":101,"props":2361,"children":2362},{"style":118},[2363],{"type":37,"value":2364},"    depends_on",{"type":32,"tag":101,"props":2366,"children":2367},{"style":124},[2368],{"type":37,"value":156},{"type":32,"tag":101,"props":2370,"children":2371},{"class":103,"line":271},[2372,2376],{"type":32,"tag":101,"props":2373,"children":2374},{"style":124},[2375],{"type":37,"value":237},{"type":32,"tag":101,"props":2377,"children":2378},{"style":177},[2379],{"type":37,"value":1858},{"type":32,"tag":101,"props":2381,"children":2382},{"class":103,"line":284},[2383,2387],{"type":32,"tag":101,"props":2384,"children":2385},{"style":124},[2386],{"type":37,"value":237},{"type":32,"tag":101,"props":2388,"children":2389},{"style":177},[2390],{"type":37,"value":2391},"ref('fct_ad_performance')\n",{"type":32,"tag":101,"props":2393,"children":2394},{"class":103,"line":302},[2395,2399],{"type":32,"tag":101,"props":2396,"children":2397},{"style":124},[2398],{"type":37,"value":237},{"type":32,"tag":101,"props":2400,"children":2401},{"style":177},[2402],{"type":37,"value":2403},"metric('total_revenue')\n",{"type":32,"tag":101,"props":2405,"children":2406},{"class":103,"line":315},[2407,2411],{"type":32,"tag":101,"props":2408,"children":2409},{"style":124},[2410],{"type":37,"value":237},{"type":32,"tag":101,"props":2412,"children":2413},{"style":177},[2414],{"type":37,"value":2415},"metric('customer_acquisition_cost')\n",{"type":32,"tag":101,"props":2417,"children":2418},{"class":103,"line":366},[2419,2424],{"type":32,"tag":101,"props":2420,"children":2421},{"style":118},[2422],{"type":37,"value":2423},"    owner",{"type":32,"tag":101,"props":2425,"children":2426},{"style":124},[2427],{"type":37,"value":156},{"type":32,"tag":101,"props":2429,"children":2430},{"class":103,"line":412},[2431,2436,2440],{"type":32,"tag":101,"props":2432,"children":2433},{"style":118},[2434],{"type":37,"value":2435},"      name",{"type":32,"tag":101,"props":2437,"children":2438},{"style":124},[2439],{"type":37,"value":127},{"type":32,"tag":101,"props":2441,"children":2442},{"style":177},[2443],{"type":37,"value":2444},"Team Marketing Ops\n",{"type":32,"tag":101,"props":2446,"children":2447},{"class":103,"line":420},[2448,2453,2457],{"type":32,"tag":101,"props":2449,"children":2450},{"style":118},[2451],{"type":37,"value":2452},"      email",{"type":32,"tag":101,"props":2454,"children":2455},{"style":124},[2456],{"type":37,"value":127},{"type":32,"tag":101,"props":2458,"children":2459},{"style":177},[2460],{"type":37,"value":2461},"ops@roibase.com.tr\n",{"type":32,"tag":101,"props":2463,"children":2464},{"class":103,"line":441},[2465],{"type":32,"tag":101,"props":2466,"children":2467},{"emptyLinePlaceholder":140},[2468],{"type":37,"value":143},{"type":32,"tag":101,"props":2470,"children":2471},{"class":103,"line":458},[2472,2476,2480,2484],{"type":32,"tag":101,"props":2473,"children":2474},{"style":124},[2475],{"type":37,"value":165},{"type":32,"tag":101,"props":2477,"children":2478},{"style":118},[2479],{"type":37,"value":170},{"type":32,"tag":101,"props":2481,"children":2482},{"style":124},[2483],{"type":37,"value":127},{"type":32,"tag":101,"props":2485,"children":2486},{"style":177},[2487],{"type":37,"value":2488},"klaviyo_segment_sync\n",{"type":32,"tag":101,"props":2490,"children":2491},{"class":103,"line":470},[2492,2496,2500],{"type":32,"tag":101,"props":2493,"children":2494},{"style":118},[2495],{"type":37,"value":2296},{"type":32,"tag":101,"props":2497,"children":2498},{"style":124},[2499],{"type":37,"value":127},{"type":32,"tag":101,"props":2501,"children":2502},{"style":177},[2503],{"type":37,"value":2504},"application\n",{"type":32,"tag":101,"props":2506,"children":2507},{"class":103,"line":491},[2508,2512,2516],{"type":32,"tag":101,"props":2509,"children":2510},{"style":118},[2511],{"type":37,"value":2313},{"type":32,"tag":101,"props":2513,"children":2514},{"style":124},[2515],{"type":37,"value":127},{"type":32,"tag":101,"props":2517,"children":2518},{"style":177},[2519],{"type":37,"value":2520},"medium\n",{"type":32,"tag":101,"props":2522,"children":2523},{"class":103,"line":509},[2524,2528,2532],{"type":32,"tag":101,"props":2525,"children":2526},{"style":118},[2527],{"type":37,"value":2347},{"type":32,"tag":101,"props":2529,"children":2530},{"style":124},[2531],{"type":37,"value":127},{"type":32,"tag":101,"props":2533,"children":2534},{"style":177},[2535],{"type":37,"value":2536},"\"Sincronizzazione segment BigQuery → Klaviyo via Hightouch\"\n",{"type":32,"tag":101,"props":2538,"children":2539},{"class":103,"line":521},[2540,2544],{"type":32,"tag":101,"props":2541,"children":2542},{"style":118},[2543],{"type":37,"value":2364},{"type":32,"tag":101,"props":2545,"children":2546},{"style":124},[2547],{"type":37,"value":156},{"type":32,"tag":101,"props":2549,"children":2550},{"class":103,"line":1609},[2551,2555],{"type":32,"tag":101,"props":2552,"children":2553},{"style":124},[2554],{"type":37,"value":237},{"type":32,"tag":101,"props":2556,"children":2557},{"style":177},[2558],{"type":37,"value":2559},"ref('dim_unified_customers')\n",{"type":32,"tag":101,"props":2561,"children":2562},{"class":103,"line":1617},[2563,2567],{"type":32,"tag":101,"props":2564,"children":2565},{"style":118},[2566],{"type":37,"value":2423},{"type":32,"tag":101,"props":2568,"children":2569},{"style":124},[2570],{"type":37,"value":156},{"type":32,"tag":101,"props":2572,"children":2574},{"class":103,"line":2573},26,[2575,2579,2583],{"type":32,"tag":101,"props":2576,"children":2577},{"style":118},[2578],{"type":37,"value":2435},{"type":32,"tag":101,"props":2580,"children":2581},{"style":124},[2582],{"type":37,"value":127},{"type":32,"tag":101,"props":2584,"children":2585},{"style":177},[2586],{"type":37,"value":2587},"CRM Automation\n",{"type":32,"tag":101,"props":2589,"children":2591},{"class":103,"line":2590},27,[2592,2596,2600],{"type":32,"tag":101,"props":2593,"children":2594},{"style":118},[2595],{"type":37,"value":2452},{"type":32,"tag":101,"props":2597,"children":2598},{"style":124},[2599],{"type":37,"value":127},{"type":32,"tag":101,"props":2601,"children":2602},{"style":177},[2603],{"type":37,"value":2604},"crm@roibase.com.tr\n",{"type":32,"tag":33,"props":2606,"children":2607},{},[2608,2610,2616,2618,2623],{"type":37,"value":2609},"Con questo manifesto, dopo ",{"type":32,"tag":52,"props":2611,"children":2613},{"className":2612},[],[2614],{"type":37,"value":2615},"dbt docs generate",{"type":37,"value":2617},", il DAG della documentazione mostra gli exposure come nodi terminali. Quando modifichi il modello ",{"type":32,"tag":52,"props":2619,"children":2621},{"className":2620},[],[2622],{"type":37,"value":1682},{"type":37,"value":2624},", nel grafico di lineage vedi subito quale dashboard potrebbe essere influenzata. Un exposure è anche una regola di alert: puoi inviare un messaggio Slack \"upstream dell'executive_marketing_dashboard in errore\".",{"type":32,"tag":33,"props":2626,"children":2627},{},[2628,2630,2636,2638,2644,2646,2652],{"type":37,"value":2629},"Il campo maturity dell'exposure traccia il debito tecnico: gli exposure con maturity ",{"type":32,"tag":52,"props":2631,"children":2633},{"className":2632},[],[2634],{"type":37,"value":2635},"low",{"type":37,"value":2637}," potrebbero essere analisi temporanee, quelli con ",{"type":32,"tag":52,"props":2639,"children":2641},{"className":2640},[],[2642],{"type":37,"value":2643},"high",{"type":37,"value":2645}," sono critici per la produzione. Il comando ",{"type":32,"tag":52,"props":2647,"children":2649},{"className":2648},[],[2650],{"type":37,"value":2651},"dbt list --select exposure:executive_marketing_dashboard+",{"type":37,"value":2653}," elenca l'intera rete di dipendenze di quella dashboard — durante la deprecazione di un modello, fai l'analisi dell'impatto.",{"type":32,"tag":40,"props":2655,"children":2657},{"id":2656},"copertura-dei-test-e-data-quality-contract",[2658],{"type":37,"value":2659},"Copertura dei test e data quality contract",{"type":32,"tag":33,"props":2661,"children":2662},{},[2663,2665,2671],{"type":37,"value":2664},"La forza di dbt non è solo la trasformazione, ma la suite di test. Per ogni modello, definisci i test nel file ",{"type":32,"tag":52,"props":2666,"children":2668},{"className":2667},[],[2669],{"type":37,"value":2670},"schema.yml",{"type":37,"value":1755},{"type":32,"tag":91,"props":2673,"children":2675},{"className":93,"code":2674,"language":95,"meta":16,"style":16},"# models\u002Fmarts\u002Fmarketing\u002Ffct_orders.yml\nversion: 2\n\nmodels:\n  - name: fct_orders\n    description: \"Tabella denormalizzata dei fatti degli ordini per il consumo BI\"\n    columns:\n      - name: order_id\n        description: \"Chiave primaria\"\n        tests:\n          - unique\n          - not_null\n\n      - name: customer_id\n        description: \"Chiave esterna verso dim_customers\"\n        tests:\n          - not_null\n          - relationships:\n              to: ref('dim_customers')\n              field: customer_id\n\n      - name: order_total\n        description: \"Totale dell'ordine in USD\"\n        tests:\n          - not_null\n          - dbt_utils.expression_is_true:\n              expression: \">= 0\"\n\n      - name: order_date\n        tests:\n          - not_null\n          - dbt_utils.accepted_range:\n              min_value: \"'2020-01-01'\"\n              max_value: \"current_date()\"\n",[2676],{"type":32,"tag":52,"props":2677,"children":2678},{"__ignoreMap":16},[2679,2687,2702,2709,2721,2741,2757,2769,2789,2806,2818,2831,2843,2850,2870,2886,2897,2908,2924,2941,2957,2964,2983,2999,3010,3021,3037,3054,3062,3082,3094,3106,3123,3141],{"type":32,"tag":101,"props":2680,"children":2681},{"class":103,"line":104},[2682],{"type":32,"tag":101,"props":2683,"children":2684},{"style":108},[2685],{"type":37,"value":2686},"# models\u002Fmarts\u002Fmarketing\u002Ffct_orders.yml\n",{"type":32,"tag":101,"props":2688,"children":2689},{"class":103,"line":114},[2690,2694,2698],{"type":32,"tag":101,"props":2691,"children":2692},{"style":118},[2693],{"type":37,"value":121},{"type":32,"tag":101,"props":2695,"children":2696},{"style":124},[2697],{"type":37,"value":127},{"type":32,"tag":101,"props":2699,"children":2700},{"style":130},[2701],{"type":37,"value":133},{"type":32,"tag":101,"props":2703,"children":2704},{"class":103,"line":136},[2705],{"type":32,"tag":101,"props":2706,"children":2707},{"emptyLinePlaceholder":140},[2708],{"type":37,"value":143},{"type":32,"tag":101,"props":2710,"children":2711},{"class":103,"line":146},[2712,2717],{"type":32,"tag":101,"props":2713,"children":2714},{"style":118},[2715],{"type":37,"value":2716},"models",{"type":32,"tag":101,"props":2718,"children":2719},{"style":124},[2720],{"type":37,"value":156},{"type":32,"tag":101,"props":2722,"children":2723},{"class":103,"line":159},[2724,2728,2732,2736],{"type":32,"tag":101,"props":2725,"children":2726},{"style":124},[2727],{"type":37,"value":165},{"type":32,"tag":101,"props":2729,"children":2730},{"style":118},[2731],{"type":37,"value":170},{"type":32,"tag":101,"props":2733,"children":2734},{"style":124},[2735],{"type":37,"value":127},{"type":32,"tag":101,"props":2737,"children":2738},{"style":177},[2739],{"type":37,"value":2740},"fct_orders\n",{"type":32,"tag":101,"props":2742,"children":2743},{"class":103,"line":183},[2744,2748,2752],{"type":32,"tag":101,"props":2745,"children":2746},{"style":118},[2747],{"type":37,"value":2347},{"type":32,"tag":101,"props":2749,"children":2750},{"style":124},[2751],{"type":37,"value":127},{"type":32,"tag":101,"props":2753,"children":2754},{"style":177},[2755],{"type":37,"value":2756},"\"Tabella denormalizzata dei fatti degli ordini per il consumo BI\"\n",{"type":32,"tag":101,"props":2758,"children":2759},{"class":103,"line":201},[2760,2765],{"type":32,"tag":101,"props":2761,"children":2762},{"style":118},[2763],{"type":37,"value":2764},"    columns",{"type":32,"tag":101,"props":2766,"children":2767},{"style":124},[2768],{"type":37,"value":156},{"type":32,"tag":101,"props":2770,"children":2771},{"class":103,"line":219},[2772,2776,2780,2784],{"type":32,"tag":101,"props":2773,"children":2774},{"style":124},[2775],{"type":37,"value":237},{"type":32,"tag":101,"props":2777,"children":2778},{"style":118},[2779],{"type":37,"value":170},{"type":32,"tag":101,"props":2781,"children":2782},{"style":124},[2783],{"type":37,"value":127},{"type":32,"tag":101,"props":2785,"children":2786},{"style":177},[2787],{"type":37,"value":2788},"order_id\n",{"type":32,"tag":101,"props":2790,"children":2791},{"class":103,"line":26},[2792,2797,2801],{"type":32,"tag":101,"props":2793,"children":2794},{"style":118},[2795],{"type":37,"value":2796},"        description",{"type":32,"tag":101,"props":2798,"children":2799},{"style":124},[2800],{"type":37,"value":127},{"type":32,"tag":101,"props":2802,"children":2803},{"style":177},[2804],{"type":37,"value":2805},"\"Chiave primaria\"\n",{"type":32,"tag":101,"props":2807,"children":2808},{"class":103,"line":253},[2809,2814],{"type":32,"tag":101,"props":2810,"children":2811},{"style":118},[2812],{"type":37,"value":2813},"        tests",{"type":32,"tag":101,"props":2815,"children":2816},{"style":124},[2817],{"type":37,"value":156},{"type":32,"tag":101,"props":2819,"children":2820},{"class":103,"line":271},[2821,2826],{"type":32,"tag":101,"props":2822,"children":2823},{"style":124},[2824],{"type":37,"value":2825},"          - ",{"type":32,"tag":101,"props":2827,"children":2828},{"style":177},[2829],{"type":37,"value":2830},"unique\n",{"type":32,"tag":101,"props":2832,"children":2833},{"class":103,"line":284},[2834,2838],{"type":32,"tag":101,"props":2835,"children":2836},{"style":124},[2837],{"type":37,"value":2825},{"type":32,"tag":101,"props":2839,"children":2840},{"style":177},[2841],{"type":37,"value":2842},"not_null\n",{"type":32,"tag":101,"props":2844,"children":2845},{"class":103,"line":302},[2846],{"type":32,"tag":101,"props":2847,"children":2848},{"emptyLinePlaceholder":140},[2849],{"type":37,"value":143},{"type":32,"tag":101,"props":2851,"children":2852},{"class":103,"line":315},[2853,2857,2861,2865],{"type":32,"tag":101,"props":2854,"children":2855},{"style":124},[2856],{"type":37,"value":237},{"type":32,"tag":101,"props":2858,"children":2859},{"style":118},[2860],{"type":37,"value":170},{"type":32,"tag":101,"props":2862,"children":2863},{"style":124},[2864],{"type":37,"value":127},{"type":32,"tag":101,"props":2866,"children":2867},{"style":177},[2868],{"type":37,"value":2869},"customer_id\n",{"type":32,"tag":101,"props":2871,"children":2872},{"class":103,"line":366},[2873,2877,2881],{"type":32,"tag":101,"props":2874,"children":2875},{"style":118},[2876],{"type":37,"value":2796},{"type":32,"tag":101,"props":2878,"children":2879},{"style":124},[2880],{"type":37,"value":127},{"type":32,"tag":101,"props":2882,"children":2883},{"style":177},[2884],{"type":37,"value":2885},"\"Chiave esterna verso dim_customers\"\n",{"type":32,"tag":101,"props":2887,"children":2888},{"class":103,"line":412},[2889,2893],{"type":32,"tag":101,"props":2890,"children":2891},{"style":118},[2892],{"type":37,"value":2813},{"type":32,"tag":101,"props":2894,"children":2895},{"style":124},[2896],{"type":37,"value":156},{"type":32,"tag":101,"props":2898,"children":2899},{"class":103,"line":420},[2900,2904],{"type":32,"tag":101,"props":2901,"children":2902},{"style":124},[2903],{"type":37,"value":2825},{"type":32,"tag":101,"props":2905,"children":2906},{"style":177},[2907],{"type":37,"value":2842},{"type":32,"tag":101,"props":2909,"children":2910},{"class":103,"line":441},[2911,2915,2920],{"type":32,"tag":101,"props":2912,"children":2913},{"style":124},[2914],{"type":37,"value":2825},{"type":32,"tag":101,"props":2916,"children":2917},{"style":118},[2918],{"type":37,"value":2919},"relationships",{"type":32,"tag":101,"props":2921,"children":2922},{"style":124},[2923],{"type":37,"value":156},{"type":32,"tag":101,"props":2925,"children":2926},{"class":103,"line":458},[2927,2932,2936],{"type":32,"tag":101,"props":2928,"children":2929},{"style":118},[2930],{"type":37,"value":2931},"              to",{"type":32,"tag":101,"props":2933,"children":2934},{"style":124},[2935],{"type":37,"value":127},{"type":32,"tag":101,"props":2937,"children":2938},{"style":177},[2939],{"type":37,"value":2940},"ref('dim_customers')\n",{"type":32,"tag":101,"props":2942,"children":2943},{"class":103,"line":470},[2944,2949,2953],{"type":32,"tag":101,"props":2945,"children":2946},{"style":118},[2947],{"type":37,"value":2948},"              field",{"type":32,"tag":101,"props":2950,"children":2951},{"style":124},[2952],{"type":37,"value":127},{"type":32,"tag":101,"props":2954,"children":2955},{"style":177},[2956],{"type":37,"value":2869},{"type":32,"tag":101,"props":2958,"children":2959},{"class":103,"line":491},[2960],{"type":32,"tag":101,"props":2961,"children":2962},{"emptyLinePlaceholder":140},[2963],{"type":37,"value":143},{"type":32,"tag":101,"props":2965,"children":2966},{"class":103,"line":509},[2967,2971,2975,2979],{"type":32,"tag":101,"props":2968,"children":2969},{"style":124},[2970],{"type":37,"value":237},{"type":32,"tag":101,"props":2972,"children":2973},{"style":118},[2974],{"type":37,"value":170},{"type":32,"tag":101,"props":2976,"children":2977},{"style":124},[2978],{"type":37,"value":127},{"type":32,"tag":101,"props":2980,"children":2981},{"style":177},[2982],{"type":37,"value":1892},{"type":32,"tag":101,"props":2984,"children":2985},{"class":103,"line":521},[2986,2990,2994],{"type":32,"tag":101,"props":2987,"children":2988},{"style":118},[2989],{"type":37,"value":2796},{"type":32,"tag":101,"props":2991,"children":2992},{"style":124},[2993],{"type":37,"value":127},{"type":32,"tag":101,"props":2995,"children":2996},{"style":177},[2997],{"type":37,"value":2998},"\"Totale dell'ordine in USD\"\n",{"type":32,"tag":101,"props":3000,"children":3001},{"class":103,"line":1609},[3002,3006],{"type":32,"tag":101,"props":3003,"children":3004},{"style":118},[3005],{"type":37,"value":2813},{"type":32,"tag":101,"props":3007,"children":3008},{"style":124},[3009],{"type":37,"value":156},{"type":32,"tag":101,"props":3011,"children":3012},{"class":103,"line":1617},[3013,3017],{"type":32,"tag":101,"props":3014,"children":3015},{"style":124},[3016],{"type":37,"value":2825},{"type":32,"tag":101,"props":3018,"children":3019},{"style":177},[3020],{"type":37,"value":2842},{"type":32,"tag":101,"props":3022,"children":3023},{"class":103,"line":2573},[3024,3028,3033],{"type":32,"tag":101,"props":3025,"children":3026},{"style":124},[3027],{"type":37,"value":2825},{"type":32,"tag":101,"props":3029,"children":3030},{"style":118},[3031],{"type":37,"value":3032},"dbt_utils.expression_is_true",{"type":32,"tag":101,"props":3034,"children":3035},{"style":124},[3036],{"type":37,"value":156},{"type":32,"tag":101,"props":3038,"children":3039},{"class":103,"line":2590},[3040,3045,3049],{"type":32,"tag":101,"props":3041,"children":3042},{"style":118},[3043],{"type":37,"value":3044},"              expression",{"type":32,"tag":101,"props":3046,"children":3047},{"style":124},[3048],{"type":37,"value":127},{"type":32,"tag":101,"props":3050,"children":3051},{"style":177},[3052],{"type":37,"value":3053},"\">= 0\"\n",{"type":32,"tag":101,"props":3055,"children":3057},{"class":103,"line":3056},28,[3058],{"type":32,"tag":101,"props":3059,"children":3060},{"emptyLinePlaceholder":140},[3061],{"type":37,"value":143},{"type":32,"tag":101,"props":3063,"children":3065},{"class":103,"line":3064},29,[3066,3070,3074,3078],{"type":32,"tag":101,"props":3067,"children":3068},{"style":124},[3069],{"type":37,"value":237},{"type":32,"tag":101,"props":3071,"children":3072},{"style":118},[3073],{"type":37,"value":170},{"type":32,"tag":101,"props":3075,"children":3076},{"style":124},[3077],{"type":37,"value":127},{"type":32,"tag":101,"props":3079,"children":3080},{"style":177},[3081],{"type":37,"value":1909},{"type":32,"tag":101,"props":3083,"children":3085},{"class":103,"line":3084},30,[3086,3090],{"type":32,"tag":101,"props":3087,"children":3088},{"style":118},[3089],{"type":37,"value":2813},{"type":32,"tag":101,"props":3091,"children":3092},{"style":124},[3093],{"type":37,"value":156},{"type":32,"tag":101,"props":3095,"children":3097},{"class":103,"line":3096},31,[3098,3102],{"type":32,"tag":101,"props":3099,"children":3100},{"style":124},[3101],{"type":37,"value":2825},{"type":32,"tag":101,"props":3103,"children":3104},{"style":177},[3105],{"type":37,"value":2842},{"type":32,"tag":101,"props":3107,"children":3109},{"class":103,"line":3108},32,[3110,3114,3119],{"type":32,"tag":101,"props":3111,"children":3112},{"style":124},[3113],{"type":37,"value":2825},{"type":32,"tag":101,"props":3115,"children":3116},{"style":118},[3117],{"type":37,"value":3118},"dbt_utils.accepted_range",{"type":32,"tag":101,"props":3120,"children":3121},{"style":124},[3122],{"type":37,"value":156},{"type":32,"tag":101,"props":3124,"children":3126},{"class":103,"line":3125},33,[3127,3132,3136],{"type":32,"tag":101,"props":3128,"children":3129},{"style":118},[3130],{"type":37,"value":3131},"              min_value",{"type":32,"tag":101,"props":3133,"children":3134},{"style":124},[3135],{"type":37,"value":127},{"type":32,"tag":101,"props":3137,"children":3138},{"style":177},[3139],{"type":37,"value":3140},"\"'2020-01-01'\"\n",{"type":32,"tag":101,"props":3142,"children":3144},{"class":103,"line":3143},34,[3145,3150,3154],{"type":32,"tag":101,"props":3146,"children":3147},{"style":118},[3148],{"type":37,"value":3149},"              max_value",{"type":32,"tag":101,"props":3151,"children":3152},{"style":124},[3153],{"type":37,"value":127},{"type":32,"tag":101,"props":3155,"children":3156},{"style":177},[3157],{"type":37,"value":3158},"\"current_date()\"\n",{"type":32,"tag":33,"props":3160,"children":3161},{},[3162,3164,3170,3172,3178],{"type":37,"value":3163},"Il comando ",{"type":32,"tag":52,"props":3165,"children":3167},{"className":3166},[],[3168],{"type":37,"value":3169},"dbt test",{"type":37,"value":3171}," esegue questi controlli. Se c'è un'anomalia come ",{"type":32,"tag":52,"props":3173,"children":3175},{"className":3174},[],[3176],{"type":37,"value":3177},"order_total \u003C 0",{"type":37,"value":3179},", la build fallisce e un alert viene inviato a Slack. Questo contract fornisce la fiducia ai consumer downstream — la qualità dei dati è garantita nella pipeline, non nel BI tool.",{"type":32,"tag":33,"props":3181,"children":3182},{},[3183,3185,3191],{"type":37,"value":3184},"Aggiungere test personalizzati è semplice: basta inserire un file SQL nella cartella ",{"type":32,"tag":52,"props":3186,"children":3188},{"className":3187},[],[3189],{"type":37,"value":3190},"tests\u002F",{"type":37,"value":3192},". Esempio: \"Ogni cliente può avere al massimo un abbonamento attivo\":",{"type":32,"tag":91,"props":3194,"children":3196},{"className":658,"code":3195,"language":660,"meta":16,"style":16},"-- tests\u002Fassert_single_active_subscription.sql\nwith duplicate_subscriptions as (\n    select\n        customer_id,\n        count(*) as active_count\n    from {{ ref('fct_subscriptions') }}\n    where status = 'active'\n    group by 1\n    having count(*) > 1\n)\n\nselect * from duplicate_subscriptions\n",[3197],{"type":32,"tag":52,"props":3198,"children":3199},{"__ignoreMap":16},[3200,3208,3228,3235,3243,3271,3291,3312,3325,3359,3366,3373],{"type":32,"tag":101,"props":3201,"children":3202},{"class":103,"line":104},[3203],{"type":32,"tag":101,"props":3204,"children":3205},{"style":108},[3206],{"type":37,"value":3207},"-- tests\u002Fassert_single_active_subscription.sql\n",{"type":32,"tag":101,"props":3209,"children":3210},{"class":103,"line":114},[3211,3215,3220,3224],{"type":32,"tag":101,"props":3212,"children":3213},{"style":678},[3214],{"type":37,"value":681},{"type":32,"tag":101,"props":3216,"children":3217},{"style":124},[3218],{"type":37,"value":3219}," duplicate_subscriptions ",{"type":32,"tag":101,"props":3221,"children":3222},{"style":678},[3223],{"type":37,"value":691},{"type":32,"tag":101,"props":3225,"children":3226},{"style":124},[3227],{"type":37,"value":696},{"type":32,"tag":101,"props":3229,"children":3230},{"class":103,"line":136},[3231],{"type":32,"tag":101,"props":3232,"children":3233},{"style":678},[3234],{"type":37,"value":846},{"type":32,"tag":101,"props":3236,"children":3237},{"class":103,"line":146},[3238],{"type":32,"tag":101,"props":3239,"children":3240},{"style":124},[3241],{"type":37,"value":3242},"        customer_id,\n",{"type":32,"tag":101,"props":3244,"children":3245},{"class":103,"line":159},[3246,3250,3254,3258,3262,3266],{"type":32,"tag":101,"props":3247,"children":3248},{"style":130},[3249],{"type":37,"value":1306},{"type":32,"tag":101,"props":3251,"children":3252},{"style":124},[3253],{"type":37,"value":1311},{"type":32,"tag":101,"props":3255,"children":3256},{"style":678},[3257],{"type":37,"value":1316},{"type":32,"tag":101,"props":3259,"children":3260},{"style":124},[3261],{"type":37,"value":932},{"type":32,"tag":101,"props":3263,"children":3264},{"style":678},[3265],{"type":37,"value":691},{"type":32,"tag":101,"props":3267,"children":3268},{"style":124},[3269],{"type":37,"value":3270}," active_count\n",{"type":32,"tag":101,"props":3272,"children":3273},{"class":103,"line":183},[3274,3278,3282,3287],{"type":32,"tag":101,"props":3275,"children":3276},{"style":678},[3277],{"type":37,"value":1048},{"type":32,"tag":101,"props":3279,"children":3280},{"style":124},[3281],{"type":37,"value":1362},{"type":32,"tag":101,"props":3283,"children":3284},{"style":177},[3285],{"type":37,"value":3286},"'fct_subscriptions'",{"type":32,"tag":101,"props":3288,"children":3289},{"style":124},[3290],{"type":37,"value":738},{"type":32,"tag":101,"props":3292,"children":3293},{"class":103,"line":201},[3294,3298,3303,3307],{"type":32,"tag":101,"props":3295,"children":3296},{"style":678},[3297],{"type":37,"value":746},{"type":32,"tag":101,"props":3299,"children":3300},{"style":678},[3301],{"type":37,"value":3302}," status",{"type":32,"tag":101,"props":3304,"children":3305},{"style":678},[3306],{"type":37,"value":922},{"type":32,"tag":101,"props":3308,"children":3309},{"style":177},[3310],{"type":37,"value":3311}," 'active'\n",{"type":32,"tag":101,"props":3313,"children":3314},{"class":103,"line":219},[3315,3320],{"type":32,"tag":101,"props":3316,"children":3317},{"style":678},[3318],{"type":37,"value":3319},"    group by",{"type":32,"tag":101,"props":3321,"children":3322},{"style":130},[3323],{"type":37,"value":3324}," 1\n",{"type":32,"tag":101,"props":3326,"children":3327},{"class":103,"line":26},[3328,3333,3338,3342,3346,3350,3355],{"type":32,"tag":101,"props":3329,"children":3330},{"style":678},[3331],{"type":37,"value":3332},"    having",{"type":32,"tag":101,"props":3334,"children":3335},{"style":130},[3336],{"type":37,"value":3337}," count",{"type":32,"tag":101,"props":3339,"children":3340},{"style":124},[3341],{"type":37,"value":1311},{"type":32,"tag":101,"props":3343,"children":3344},{"style":678},[3345],{"type":37,"value":1316},{"type":32,"tag":101,"props":3347,"children":3348},{"style":124},[3349],{"type":37,"value":932},{"type":32,"tag":101,"props":3351,"children":3352},{"style":678},[3353],{"type":37,"value":3354},">",{"type":32,"tag":101,"props":3356,"children":3357},{"style":130},[3358],{"type":37,"value":3324},{"type":32,"tag":101,"props":3360,"children":3361},{"class":103,"line":253},[3362],{"type":32,"tag":101,"props":3363,"children":3364},{"style":124},[3365],{"type":37,"value":1094},{"type":32,"tag":101,"props":3367,"children":3368},{"class":103,"line":271},[3369],{"type":32,"tag":101,"props":3370,"children":3371},{"emptyLinePlaceholder":140},[3372],{"type":37,"value":143},{"type":32,"tag":101,"props":3374,"children":3375},{"class":103,"line":284},[3376,3380,3384,3388],{"type":32,"tag":101,"props":3377,"children":3378},{"style":678},[3379],{"type":37,"value":883},{"type":32,"tag":101,"props":3381,"children":3382},{"style":678},[3383],{"type":37,"value":709},{"type":32,"tag":101,"props":3385,"children":3386},{"style":678},[3387],{"type":37,"value":714},{"type":32,"tag":101,"props":3389,"children":3390},{"style":124},[3391],{"type":37,"value":3392}," duplicate_subscriptions\n",{"type":32,"tag":33,"props":3394,"children":3395},{},[3396],{"type":37,"value":3397},"Se questa query restituisce righe, il test fallisce. Quando la copertura dei test supera l'80%, il numero di alert di dashboard errata scende drasticamente — dato Roibase 2023: oltre l'85% di test coverage, gli alert di errore si riducono del 60%.",{"type":32,"tag":40,"props":3399,"children":3401},{"id":3400},"orchestrazione-della-pipeline-e-deployment-in-produzione",[3402],{"type":37,"value":3403},"Orchestrazione della pipeline e deployment in produzione",{"type":32,"tag":33,"props":3405,"children":3406},{},[3407,3409,3415,3417,3423],{"type":37,"value":3408},"Se usi dbt Cloud, definisci un job schedulato: ogni giorno alle 04:00 esegui il comando ",{"type":32,"tag":52,"props":3410,"children":3412},{"className":3411},[],[3413],{"type":37,"value":3414},"dbt build --select +fct_orders",{"type":37,"value":3416},". Se usi self-hosted, aggiungi il comando dbt a un DAG Airflow tramite ",{"type":32,"tag":52,"props":3418,"children":3420},{"className":3419},[],[3421],{"type":37,"value":3422},"BashOperator",{"type":37,"value":3424},". La strategia incrementale di dbt fa sì che 90 giorni di dati vengano elaborati in 5 minuti — il full-refresh diventa superfluo.",{"type":32,"tag":33,"props":3426,"children":3427},{},[3428,3430,3436],{"type":37,"value":3429},"Nel processo CI\u002FCD: quando apri una Pull Request, GitHub Actions esegue ",{"type":32,"tag":52,"props":3431,"children":3433},{"className":3432},[],[3434],{"type":37,"value":3435},"dbt build --select state:modified+",{"type":37,"value":3437}," — vengono testati solo i modelli modificati e le loro dipendenze downstream. Dopo il merge, viene fatto il deploy del dataset BigQuery in produzione. Grazie a dbt Slim CI, in un progetto con 200 modelli il build della PR scende a 3 minuti (il full build impiegherebbe 40 minuti).",{"type":32,"tag":33,"props":3439,"children":3440},{},[3441,3443,3448],{"type":37,"value":3442},"In produzione, il risultato di ",{"type":32,"tag":52,"props":3444,"children":3446},{"className":3445},[],[3447],{"type":37,"value":2615},{"type":37,"value":3449}," viene pubblicato come sito statico su S3\u002FGCS. Versioni i file Markdown — i cambiamenti nello schema del modello appaiono nella history di git. Un nuovo membro del team legge dal sito della documentazione di dbt come viene calcolata ogni metrica — non c'è knowledge che rimane solo nella testa di qualcuno.",{"type":32,"tag":3451,"props":3452,"children":3453},"hr",{},[],{"type":32,"tag":33,"props":3455,"children":3456},{},[3457],{"type":37,"value":3458},"Lo stack dbt + BigQuery non è l'unico modo per connettere i dati di marketing al decision-making — ma è il più ripetibile, testabile e versionabile. Il source mapping porta il dato grezzo sotto controllo, il modeling layer trasforma il concetto analitico in SQL, il semantic layer centralizza la definizione delle metriche, gli exposure rendono visibile il downstream. Quando hai costruito questi quattro livelli, la domanda \"quanto budget dovrei allocare a ogni canale\" diventa il risultato di una query SQL — non una congettura, una misurazione.",{"type":32,"tag":3460,"props":3461,"children":3462},"style",{},[3463],{"type":37,"value":3464},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":16,"searchDepth":136,"depth":136,"links":3466},[3467,3468,3469,3470,3471,3472],{"id":42,"depth":114,"text":45},{"id":617,"depth":114,"text":620},{"id":1723,"depth":114,"text":1726},{"id":2211,"depth":114,"text":2214},{"id":2656,"depth":114,"text":2659},{"id":3400,"depth":114,"text":3403},"markdown","content:it:data:dbt-bigquery-modern-stack-marketing-data.md","content","it\u002Fdata\u002Fdbt-bigquery-modern-stack-marketing-data.md","it\u002Fdata\u002Fdbt-bigquery-modern-stack-marketing-data","md",1785276282337]