PageSourceSearch

https://data-dynamos.github.io/assets/js/3b38cb10.747597e3.js

js data-dynamos.github.io collected 2026-10-03 08:14:53 UTC 6,918 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkdata_dynamos_github_io=self.webpackChunkdata_dynamos_github_io||[]).push([[2072],{3905:(e,t,a)=>{a.d(t,{Zo:()=>m,kt:()=>f});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?i(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function l(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),c=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},m=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),u=c(a),d=r,f=u["".concat(s,".").concat(d)]||u[d]||p[d]||i;return a?n.createElement(f,o(o({ref:t},m),{},{components:a})):n.createElement(f,o({ref:t},m))}));function f(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,o=new Array(i);o[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:r,o[1]=l;for(var c=2;c<i;c++)o[c]=a[c];return n.createElement.apply(null,o)}return n.createElement.apply(null,a)}d.displayName="MDXCreateElement"},4827:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var n=a(7462),r=(a(7294),a(3905));const i={sidebar_position:12},o="Exercise 6",l={unversionedId:"data-transformation/data-build-tool/Exercise-7",id:"data-transformation/data-build-tool/Exercise-7",title:"Exercise 6",description:"Create Table for Aggregate Country Emissions Temperatures",source:"@site/docs/data-transformation/data-build-tool/Exercise-7.mdx",sourceDirName:"data-transformation/data-build-tool",slug:"/data-transformation/data-build-tool/Exercise-7",permalink:"/docs/data-transformation/data-build-tool/Exercise-7",draft:!1,editUrl:"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/docs/data-transformation/data-build-tool/Exercise-7.mdx",tags:[],version:"current",sidebarPosition:12,frontMatter:{sidebar_position:12},sidebar:"tutorialSidebar",previous:{title:"Exercise 5",permalink:"/docs/data-transformation/data-build-tool/Exercise-6"},next:{title:"Exercise 7",permalink:"/docs/data-transformation/data-build-tool/Exercise-8"}},s={},c=[{value:"Create Table for Aggregate Country Emissions Temperatures",id:"create-table-for-aggregate-country-emissions-temperatures",level:2}],m={toc:c},u="wrapper";function p(e){let{components:t,...a}=e;return(0,r.kt)(u,(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"exercise-6"},"Exercise 6"),(0,r.kt)("h2",{id:"create-table-for-aggregate-country-emissions-temperatures"},"Create Table for Aggregate Country Emissions Temperatures"),(0,r.kt)("p",null,"In this exercise, you will create a table that combines the results of the ",(0,r.kt)("inlineCode",{parentName:"p"},"co2_emissions_by_country")," table and the ",(0,r.kt)("inlineCode",{parentName:"p"},"aggregate_country_temperatures")," table. You will perform an INNER JOIN between these two tables and standardize the country name using the ",(0,r.kt)("inlineCode",{parentName:"p"},"initcap")," function."),(0,r.kt)("p",null,"To create the table ",(0,r.kt)("inlineCode",{parentName:"p"},"aggregate_country_emissions_temperatures")," with the desired columns in the ",(0,r.kt)("inlineCode",{parentName:"p"},"carbon_emissions")," schema:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Open your dbt project and navigate to the appropriate schema directory (e.g., ",(0,r.kt)("inlineCode",{parentName:"li"},"models/carbon_emissions"),")."),(0,r.kt)("li",{parentName:"ol"},"Create a new file named ",(0,r.kt)("inlineCode",{parentName:"li"},"aggregate_country_emissions_temperatures.sql")," (or any desired name) in the schema directory."),(0,r.kt)("li",{parentName:"ol"},"In the ",(0,r.kt)("inlineCode",{parentName:"li"},"aggregate_country_emissions_temperatures.sql")," file, write the dbt model definition for the table."),(0,r.kt)("li",{parentName:"ol"},"Define the ",(0,r.kt)("inlineCode",{parentName:"li"},"aggregate_country_emissions_temperatures")," model using the ",(0,r.kt)("inlineCode",{parentName:"li"},"table")," materialization type."),(0,r.kt)("li",{parentName:"ol"},"Perform an INNER JOIN between the ",(0,r.kt)("inlineCode",{parentName:"li"},"co2_emissions_by_country")," table and the ",(0,r.kt)("inlineCode",{parentName:"li"},"aggregate_country_temperatures"),' table using the "Year" and "Country" columns as the join conditions.'),(0,r.kt)("li",{parentName:"ol"},"Use the ",(0,r.kt)("inlineCode",{parentName:"li"},"initcap"),' function to standardize the country name in the "Country" column.'),(0,r.kt)("li",{parentName:"ol"},"Select the following columns for the output table:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Year"),": Integer"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Country"),": String"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"TotalEmissions"),": Float"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"PerCapitaEmissions"),": Float"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"ShareOfGlobalEmissions"),": Float"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AverageTemperature"),": Float")))),(0,r.kt)("p",null,"By following these instructions and executing the appropriate dbt commands, you will create the table ",(0,r.kt)("inlineCode",{parentName:"p"},"aggregate_country_emissions_temperatures")," in the ",(0,r.kt)("inlineCode",{parentName:"p"},"carbon_emissions")," schema.\nThe table will contain the combined results of the emissions and temperatures data, with the specified columns as outlined above."))}p.isMDXComponent=!0}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.