%3CLINGO-SUB%20id%3D%22lingo-sub-1364202%22%20slang%3D%22en-US%22%3EStep%20by%20step%20to%20transfer%20data%20from%20Azure%20Synapse%20instance%20using%20a%20Spark%20data%20source%20with%20Databrick%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1364202%22%20slang%3D%22en-US%22%3E%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%3B%22%3EIt%20is%20been%20a%20long%20time%20since%20I%20made%20a%20post%20about%20SQL%20DW.%20I%20was%20trying%20to%20remember%20and%20I%20found.%20it%20was%20in%202017%3A%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%3B%22%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%20box-sizing%3A%20border-box%3B%22%3E%3CA%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23146cac%3B%20text-decoration%3A%20underline%3B%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-gb%2Farchive%2Fblogs%2Fdataplatform%2Fsql-azure-dw-what-is-it-how-it-works%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-gb%2Farchive%2Fblogs%2Fdataplatform%2Fsql-azure-dw-what-is-it-how-it-works%3C%2FA%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%3B%22%3EAnyway%2C%20this%20one%20is%20not%20really%20about%20the%20DW%20(%20it%20is%20kind%20of%20indirect%20about%20it).%26nbsp%3B%20I%20am%20writing%20just%20to%20provide%20a%20simple%20guide%20based%20on%20this%20documentation%20%3CA%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23146cac%3B%20text-decoration%3A%20underline%3B%22%20href%3D%22https%3A%2F%2Fdocs.databricks.com%2Fdata%2Fdata-sources%2Fazure%2Fsynapse-analytics.html%23language-sql%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.databricks.com%2Fdata%2Fdata-sources%2Fazure%2Fsynapse-analytics.html%23language-sql%3C%2FA%3E.%20I%20want%20to%20create%20a%20lab%20on%20databricks%20cluster%20and%26nbsp%3B%20I%20also%20want%20to%20transfer%20data%20from%20azure%20synapse%20instance%20using%20a%20spark%20data%20source%20implementation.%3C%2FP%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%3B%22%3EAgain%2C%20this%20is%20a%20very%20beginner%20guide%20on%20how%20to%20do%20it%20step%20by%20step.%20For%20you%20successfully%20follow%20this%20guide%20you%20will%20need%3A%3C%2FP%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20margin-bottom%3A%2012px%3B%20margin-top%3A%200px%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3EResource%20group%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3EStorage%20account%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3EDatabricks%20cluster%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3EDW%20database%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%3B%22%3EPlease%20refer%20to%20each%20link%20for%20more%20detail.%3C%2FP%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20margin-bottom%3A%2012px%3B%20margin-top%3A%200px%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3EResource%20Group%3A%20%3CA%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23146cac%3B%20text-decoration%3A%20underline%3B%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Fmanagement%2Fmanage-resource-groups-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Fmanagement%2Fmanage-resource-groups-portal%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3EStorage%20Account%20%3CA%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23146cac%3B%20text-decoration%3A%20underline%3B%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fstorage%2Fcommon%2Fstorage-account-create%3Ftabs%3Dazure-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fstorage%2Fcommon%2Fstorage-account-create%3Ftabs%3Dazure-portal%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3EDatabricks%20Cluster%3A%20%3CA%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23146cac%3B%20text-decoration%3A%20underline%3B%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-databricks%2Fquickstart-create-databricks-workspace-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-databricks%2Fquickstart-create-databricks-workspace-portal%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3EDW%20Database%3A%20%3CA%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23146cac%3B%20text-decoration%3A%20underline%3B%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsynapse-analytics%2Fsql-data-warehouse%2Fsql-data-warehouse-overview-what-is%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsynapse-analytics%2Fsql-data-warehouse%2Fsql-data-warehouse-overview-what-is%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20you%20have%20all%20the%20prerequisites%20in%20place.%20Open%20Databricks%20and%20create%20a%20new%20notebook%20(fig%201)%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Liliam_Leme_0-1588776410221.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F189488iB2E82A5963FEB5B3%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Liliam_Leme_0-1588776410221.jpeg%22%20alt%3D%22Liliam_Leme_0-1588776410221.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EFig1%3A%20New%20Notebook%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDefine%20a%20name%20for%20the%20notebook%2C%20select%20the%20cluster%20that%20you%20created%20and%20a%20language.%20Our%20example%20will%20be%20SQL%20as%20you%20can%20see%20on%20figure%202%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Liliam_Leme_1-1588776410225.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F189487iEEA6B17E0285CC29%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Liliam_Leme_1-1588776410225.jpeg%22%20alt%3D%22Liliam_Leme_1-1588776410225.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EFigure%202%3A%20Define%20notebook%20configuration%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20I%20already%20mentioned%20I%20based%20this%20post%20in%20the%20databricks%20documentation.%20So%20most%20of%20the%20code%20is%20available%20here%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.databricks.com%2Fdata%2Fdata-sources%2Fazure%2Fsynapse-analytics.html%23language-sql%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.databricks.com%2Fdata%2Fdata-sources%2Fazure%2Fsynapse-analytics.html%23language-sql%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHowever%2C%26nbsp%3B%20our%20code%20will%20be%20slightly%20different.%20The%20next%20step%20involves%20working%20on%20the%20notebook%20so%20you%20will%20need%20information%20regards%20your%20storage%20account%20to%20add%20this%20later%20to%20the%20notebook%20code.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20is%20the%20piece%20of%20code%20where%20we%20will%20set%20up%20the%20storage%20account%3A%3C%2FP%3E%0A%3CP%3E%3CEM%3E%3CSTRONG%3ESET%3C%2FSTRONG%3E%20fs.azure.account.%3CSTRONG%3Ekey%3C%2FSTRONG%3E.%3CYOUR-%3E%3CSTRONG%3Estorage%3C%2FSTRONG%3E-account-name%26gt%3B.blob.core.windows.net%3D%3CYOUR-%3E%3CSTRONG%3Estorage%3C%2FSTRONG%3E-account-%3CSTRONG%3Eaccess%3C%2FSTRONG%3E-%3CSTRONG%3Ekey%3C%2FSTRONG%3E%26gt%3B%3B%3C%2FYOUR-%3E%3C%2FYOUR-%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20inherit%3B%20font-size%3A%2012.0pt%3B%20color%3A%20%23333333%3B%22%3EIn%20order%20to%20copy%20the%20storage%20key%20required%20and%20replace%20the%20information%20on%20the%20syntax%20above.%20Open%20the%20portal%20and%20select%26nbsp%3B%20the%20service%20storage%20account-%26gt%3B%20select%20the%20name%20of%20your%20storage%20account%20%3CSPAN%20style%3D%22background%3A%20white%3B%22%3Ethat%20was%20previous%20create%20for%20this%20lab%3C%2FSPAN%3E%20-%26gt%3B%20Select%20the%20option%20access%20key%20from%20your%20storage%20account%20as%20the%20figure%203%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20inherit%3B%20font-size%3A%2012.0pt%3B%20color%3A%20%23333333%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20inherit%3B%20font-size%3A%2012.0pt%3B%20color%3A%20%23333333%3B%22%3E%3CSPAN%20style%3D%22background%3A%20white%3B%22%3EFor%20example%2C%20my%20storage%20account%20is%3A%20acctnameadf%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20inherit%3B%20font-size%3A%2012.0pt%3B%20color%3A%20%23333333%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorLiliam_Leme_0%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Figure3_StorageAccount_key.PNG%22%20style%3D%22width%3A%20966px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F189507iE3B1F99712D86627%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Figure3_StorageAccount_key.PNG%22%20alt%3D%22Figure3_StorageAccount_key.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20inherit%3B%20font-size%3A%2012.0pt%3B%20color%3A%20%23333333%3B%22%3EFigure%203%20Storage%20account%20access%20key%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20you%20have%20the%20key%20you%20can%20change%20teh%20code%20as%20the%20example%20below%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E--%20Set%20up%20the%20Blob%20storage%20account%20access%20key%20in%20the%20notebook%20session%20conf.%3C%2FP%3E%0A%3CP%3ESET%20fs.azure.account.key.acctnameadf.blob.core.windows.net%3D3333333333%2B121222222222222%2FN1eZ6rLvNn2RF%2F111111%3D%3D%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%222%22%3E%0A%3CLI%3EYou%20will%20need%20to%20define%20a%20table%20on%20in%20your%20SQL%20DW%20to%20be%20the%20source%20of%20the%20data.%20I%20defined%20mine%20as%3A%20my_table_in_dw%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Liliam_Leme_3-1588776410274.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F189491i10E4B089DA9C668B%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Liliam_Leme_3-1588776410274.jpeg%22%20alt%3D%22Liliam_Leme_3-1588776410274.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3C%2FP%3E%0A%3CP%3EThis%20is%20the%20code%20that%20will%20be%20used%20on%20the%20notebook%20to%20create%20the%20table%20in%20Spark%20with%20the%20source%20on%20SQL%20DW%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E--%20Read%20data%20using%20SQL.%0ACREATE%20TABLE%20my_table_in_spark_read%0AUSING%20com.databricks.spark.sqldw%0AOPTIONS%20(%0A%20%20url%20'jdbc%3Asqlserver%3A%2F%2F%3CTHE-REST-OF-THE-CONNECTION-STRING%3E'%2C%0A%20%20forwardSparkAzureStorageCredentials%20'true'%2C%0A%20%20dbTable%20'my_table_in_dw'%2C%20---%26gt%3B%20Source%20table%20on%20the%20DW.%20Replace%20by%20your%20table%20name%0A%20%20tempDir%20'wasbs%3A%2F%2F%3CYOUR-CONTAINER-NAME%3E%40%3CYOUR-STORAGE-ACCOUNT-NAME%3E.blob.core.windows.net%2F%3CYOUR-DIRECTORY-NAME%3E'%0A)%3B%3C%2FYOUR-DIRECTORY-NAME%3E%3C%2FYOUR-STORAGE-ACCOUNT-NAME%3E%3C%2FYOUR-CONTAINER-NAME%3E%3C%2FTHE-REST-OF-THE-CONNECTION-STRING%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20other%20words%2C%20applying%20the%20code%20to%20our%20example%3A%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ENote%3C%2FSTRONG%3E%3A%20I%20am%20using%20SQL%20Server%20a%20user%20to%20connect.%20With%20the%20purpose%20to%20make%20it%20simple%2C%20I%20am%20not%20using%20AAD%2C%20just%20SQL%20User%20on%20DW%3A%20%3CSPAN%20style%3D%22display%3A%20inline%20!important%3B%20float%3A%20none%3B%20background-color%3A%20%23ffffff%3B%20color%3A%20%23333333%3B%20cursor%3A%20text%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3E%26nbsp%3B%20%3CEM%3E'jdbc%3Asqlserver%3A%2F%2F%3C%2FEM%3E%3C%2FSPAN%3E%3CEM%3E%3CSTRONG%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20bold%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3EYOURServerNAME%3C%2FSTRONG%3E%3CSPAN%20style%3D%22text-align%3A%20left%3B%20color%3A%20%23333333%3B%20text-transform%3A%20none%3B%20line-height%3A%201.7142%3B%20text-indent%3A%200px%3B%20letter-spacing%3A%20normal%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20text-decoration%3A%20none%3B%20word-spacing%3A%200px%3B%20display%3A%20inline%20!important%3B%20white-space%3A%20normal%3B%20cursor%3A%20text%3B%20orphans%3A%202%3B%20float%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20background-color%3A%20%23ffffff%3B%22%3E.database.windows.net%3A1433%3BdatabaseName%3D%3C%2FSPAN%3E%3CSTRONG%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20bold%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3EYOURDATAbase%20name%3C%2FSTRONG%3E%3CSPAN%20style%3D%22text-align%3A%20left%3B%20color%3A%20%23333333%3B%20text-transform%3A%20none%3B%20line-height%3A%201.7142%3B%20text-indent%3A%200px%3B%20letter-spacing%3A%20normal%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20text-decoration%3A%20none%3B%20word-spacing%3A%200px%3B%20display%3A%20inline%20!important%3B%20white-space%3A%20normal%3B%20cursor%3A%20text%3B%20orphans%3A%202%3B%20float%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20background-color%3A%20%23ffffff%3B%22%3E%3Buser%3D%3C%2FSPAN%3E%3CSTRONG%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20bold%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3EUSERtoconnectonSQL%3C%2FSTRONG%3E%3CSPAN%20style%3D%22text-align%3A%20left%3B%20color%3A%20%23333333%3B%20text-transform%3A%20none%3B%20line-height%3A%201.7142%3B%20text-indent%3A%200px%3B%20letter-spacing%3A%20normal%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20text-decoration%3A%20none%3B%20word-spacing%3A%200px%3B%20display%3A%20inline%20!important%3B%20white-space%3A%20normal%3B%20cursor%3A%20text%3B%20orphans%3A%202%3B%20float%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20background-color%3A%20%23ffffff%3B%22%3E%3Bpassword%3D%3C%2FSPAN%3E%3CSTRONG%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20bold%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3EPASSWORDofthatUse%3C%2FSTRONG%3E%3CSPAN%20style%3D%22text-align%3A%20left%3B%20color%3A%20%23333333%3B%20text-transform%3A%20none%3B%20line-height%3A%201.7142%3B%20text-indent%3A%200px%3B%20letter-spacing%3A%20normal%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20text-decoration%3A%20none%3B%20word-spacing%3A%200px%3B%20display%3A%20inline%20!important%3B%20white-space%3A%20normal%3B%20cursor%3A%20text%3B%20orphans%3A%202%3B%20float%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20background-color%3A%20%23ffffff%3B%22%3Er'%2C%3C%2FSPAN%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%20%0A--%20Read%20data%20using%20SQL.%0ACREATE%20TABLE%20if%20not%20exists%20my_table_in_spark_read%0AUSING%20com.databricks.spark.sqldw%0AOPTIONS%20(%0A%20%20url%20'jdbc%3Asqlserver%3A%2F%2FYOURServerNAME.database.windows.net%3A1433%3BdatabaseName%3DYOURDATAbase%20name%3Buser%3DUSERtoconnectonSQL%3Bpassword%3DPASSWORDofthatUser'%2C%0A%20%20forwardSparkAzureStorageCredentials%20'true'%2C%0A%20dbTable%20'my_table_in_dw'%2C%0A%20%20tempDir%20'wasbs%3A%2F%2Fadftutorial%40acctnameadf.blob.core.windows.net%2F'%0A)%3B%20----------------------%26gt%3Breplace%20by%20%20your%20container%20and%20storage%20account(%20mine%20is%20adftutorial%20and%20acctnameadf%20respectively)%20%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%223%22%3E%0A%3CLI%3ENext%20step%20will%20be%20to%20create%20a%20table%20on%20SQLDW%20using%20a%20table%20created%20previously%20on%20Spark%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%20%0A--%20Write%20data%20using%20SQL.%0A--%20Create%20a%20new%20table%2C%20throwing%20an%20error%20if%20a%20table%20with%20the%20same%20name%20already%20exists%3A%0ACREATE%20TABLE%20my_table_in_spark_write%0AUSING%20com.databricks.spark.sqldw%0AOPTIONS%20(%0A%20%20url%20'jdbc%3Asqlserver%3A%2F%2F%3CTHE-REST-OF-THE-CONNECTION-STRING%3E'%2C%0A%20%20forwardSparkAzureStorageCredentials%20'true'%2C%0A%20%20dbTable%20'my_table_in_dw_copy'%2C%0A%20%20tempDir%20'wasbs%3A%2F%2F%3CYOUR-CONTAINER-NAME%3E%40%3CYOUR-STORAGE-ACCOUNT-NAME%3E.blob.core.windows.net%2F%3CYOUR-DIRECTORY-NAME%3E'%0A)%0AAS%20SELECT%20*%20FROM%20table_to_save_in_spark%3B%3C%2FYOUR-DIRECTORY-NAME%3E%3C%2FYOUR-STORAGE-ACCOUNT-NAME%3E%3C%2FYOUR-CONTAINER-NAME%3E%3C%2FTHE-REST-OF-THE-CONNECTION-STRING%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOur%20example%20will%20be%3A%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ENote%3C%2FSTRONG%3E%3A%20I%20am%20using%20the%20same%20table%20created%20on%20the%20last%20step%20and%20also%20I%20added%20the%20not%20exist%20clause%20in%20the%20table%20creation.%3C%2FP%3E%0A%3CP%3EThe%20table%20to%20be%20created%20on%20SQL%20DW%20is%20my_table_in_dw_copy%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3ECREATE%20TABLE%20if%20not%20exists%20%20my_table_in_spark_write%20---%26gt%3B%20Spark%20table%0AUSING%20com.databricks.spark.sqldw%0AOPTIONS%20(%0A%20%20url%20'jdbc%3Asqlserver%3A%2F%2FYOURSERVERNAME.database.windows.net%3A1433%3BdatabaseName%3DSQLUSERNAME%3Buser%3DTest%3Bpassword%3DSQLUSERPASSWORD'%2C%0A%20%20forwardSparkAzureStorageCredentials%20'true'%2C%0A%20%20dbTable%20'my_table_in_dw_copy'%2C%20---%26gt%3B%20table%20to%20be%20created%20on%20SQLDW%0A%20%20tempDir%20'wasbs%3A%2F%2Fadftutorial%40acctnameadf.blob.core.windows.net%2F'%0A)%20----------------------%26gt%3Breplace%20by%20%20your%20container%20and%20storage%20account(%20mine%20is%20adftutorial%20and%20acctnameadf%20respectively)%20%0AAS%20SELECT%20*%20FROM%20my_table_in_spark_read%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3BNow%20hit%20the%20option%20run%20all.%20The%20results%20we%20expected%20are%20in%20figure%204%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Liliam_Leme_5-1588776410290.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F189492iEB931907D1A69452%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Liliam_Leme_5-1588776410290.jpeg%22%20alt%3D%22Liliam_Leme_5-1588776410290.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EFigure%204%3A%20Jobs%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20are%20wondering%20where%20are%20the%20databrick%20tables%20that%20we%20just%20created%20-%26gt%3B%20check%20the%20data%20option%20as%20per%20figure%205%20below%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Liliam_Leme_6-1588776410299.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F189495i3F681A8150CDE044%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Liliam_Leme_6-1588776410299.jpeg%22%20alt%3D%22Liliam_Leme_6-1588776410299.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFigure%205%3A%20Spark%20Tables%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20check%20our%20SQLDW%20you%20will%20also%20find%20a%20new%20object%20%E2%80%93%20my_table_in_dw_copy%20as%20figure%206%20show%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Liliam_Leme_7-1588776410303.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F189494i373704130E50213D%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Liliam_Leme_7-1588776410303.jpeg%22%20alt%3D%22Liliam_Leme_7-1588776410303.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EFigure%206%20DW%20Objects%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETable%20created%20for%20the%20example%20on%20the%20DW%20(%20if%20you%20want%20to%20use%20my%20table%20example%20as%20source)%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3ESET%20ANSI_NULLS%20ON%0AGO%0A%20%0ASET%20QUOTED_IDENTIFIER%20ON%0AGO%0A%20%0ACREATE%20TABLE%20%5Bdbo%5D.%5Bmy_table_in_dw%5D%0A(%0A%5BNAME_%5D%20%5Bvarchar%5D(50)%20NULL%2C%0A%5BsURNAME_%5D%20%5Bvarchar%5D(50)%20NULL%0A)%0AWITH%0A(%0ADISTRIBUTION%20%3D%20ROUND_ROBIN%2C%0ACLUSTERED%20COLUMNSTORE%20INDEX%0A)%0AGO%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ESo%20maybe%20you%20are%20asking%20yourself.%20Why%20do%20I%20need%20a%20Storage%20account%3F%3F%3F%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ENote%20the%20storage%20account%20is%20used%20as%20temporary%20data%20management.%20As%20you%20can%20see%20per%20documentation%3A%20%22%3C%2FP%3E%0A%3CP%3E%3CEM%3EAzure%20Synapse%20instead%20creates%20a%20subdirectory%20of%20the%20form%3A%20%3CTEMPDIR%3E%2F%3CYYYY-MM-DD%3E%2F%2F%3CRANDOMUUID%3E%2F.%20You%20can%20set%20up%20periodic%20jobs%20(using%20the%20Databricks%20%3CA%20href%3D%22https%3A%2F%2Fdocs.databricks.com%2Fjobs.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ejobs%3C%2FA%3E%20feature%20or%20otherwise)%20to%20recursively%20delete%20any%20subdirectories%20that%20are%20older%20than%20a%20given%20threshold%20(for%20example%2C%202%20days)%2C%20with%20the%20assumption%20that%20there%20cannot%20be%20Spark%20jobs%20running%20longer%20than%20that%20threshold.%3C%2FRANDOMUUID%3E%3C%2FYYYY-MM-DD%3E%3C%2FTEMPDIR%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%3CEM%3EThe%20Azure%20Synapse%20connector%20automates%20data%20transfer%20between%20a%20Databricks%20cluster%20and%20an%20Azure%20Synapse%20instance.%20For%20reading%20data%20from%20an%20Azure%20Synapse%20table%20or%20query%20or%20writing%20data%20to%20an%20Azure%20Synapse%20table%2C%20the%20Azure%20Synapse%20connector%20creates%20temporary%20objects%2C%20including%20DATABASE%20SCOPED%20CREDENTIAL%2C%20EXTERNAL%20DATA%20SOURCE%2C%20EXTERNAL%20FILE%20FORMAT%2C%20and%20EXTERNAL%20TABLE%20behind%20the%20scenes.%20These%20objects%20live%20only%20throughout%20the%20duration%20of%20the%20corresponding%20Spark%20job%20and%20should%20automatically%20be%20dropped%20thereafter.%E2%80%9D%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20will%20be%20able%20to%20check%20for%20yourself%20those%20temporary%20files%20under%20your%20storage%20account%20as%20figure%207%20demonstrate%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22storage.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F189521iD7444DA48A2C4E39%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22storage.png%22%20alt%3D%22storage.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EFigure%207%20Temporary%20files%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOr%20you%20can%20also%20query%20them%20by%20running%20this%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ESELECT%20*%20FROM%20sys.database_scoped_credentials%20WHERE%20name%20LIKE%20'tmp_databricks_%25'%3C%2FLI%3E%0A%3CLI%3ESELECT%20*%20FROM%20sys.external_data_sources%20WHERE%20name%20LIKE%20'tmp_databricks_%25'%3C%2FLI%3E%0A%3CLI%3ESELECT%20*%20FROM%20sys.external_file_formats%20WHERE%20name%20LIKE%20'tmp_databricks_%25'%3C%2FLI%3E%0A%3CLI%3ESELECT%20*%20FROM%20sys.external_tables%20WHERE%20name%20LIKE%20'tmp_databricks_%25'%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ENote%3C%2FSTRONG%3E%3A%20if%20the%20Spark%20crashes%20or%20is%20forcefully%20restarted%2C%20or%20if%20the%20cluster%20is%20forcefully%20terminated%20or%20restarted%2C%20temporary%20objects%20might%20not%20be%20dropped.%26nbsp%3B%20So%20it%20is%20important%20to%20know%20how%20to%20track%20those%20files.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELiliam%20C%20Leme%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1364202%22%20slang%3D%22en-US%22%3E%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20inherit%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.7142%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%3B%22%3EBased%20on%20this%20documentation%20%3CA%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23146cac%3B%20text-decoration%3A%20underline%3B%22%20href%3D%22https%3A%2F%2Fdocs.databricks.com%2Fdata%2Fdata-sources%2Fazure%2Fsynapse-analytics.html%23language-sql%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.databricks.com%2Fdata%2Fdata-sources%2Fazure%2Fsynapse-analytics.html%23language-sql%3C%2FA%3E.%20I%20want%20to%20create%20a%20lab%20on%20databricks%20cluster%20and%26nbsp%3B%20I%20also%20want%20to%20transfer%20data%20from%20azure%20synapse%20instance%20using%20a%20spark%20data%20source%20implementation%20this%20is%20a%20beginner's%20guide.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1364202%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESynapse%20Spark%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESynapse%20Support%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

It is been a long time since I made a post about SQL DW. I was trying to remember and I found. it was in 2017: 

https://docs.microsoft.com/en-gb/archive/blogs/dataplatform/sql-azure-dw-what-is-it-how-it-works

Anyway, this one is not really about the DW ( it is kind of indirect about it).  I am writing just to provide a simple guide based on this documentation https://docs.databricks.com/data/data-sources/azure/synapse-analytics.html#language-sql. I want to create a lab on databricks cluster and  I also want to transfer data from azure synapse instance using a spark data source implementation.

 

Again, this is a very beginner guide on how to do it step by step. For you successfully follow this guide you will need:

 

  1. Resource group
  2. Storage account
  3. Databricks cluster
  4. DW database

 

Please refer to each link for more detail.

 

  1. Resource Group: https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/manage-resource-groups-port...
  2. Storage Account https://docs.microsoft.com/en-us/azure/storage/common/storage-account-create?tabs=azure-portal
  3. Databricks Cluster: https://docs.microsoft.com/en-us/azure/azure-databricks/quickstart-create-databricks-workspace-porta...
  4. DW Database: https://docs.microsoft.com/en-us/azure/synapse-analytics/sql-data-warehouse/sql-data-warehouse-overv...

 

Once you have all the prerequisites in place. Open Databricks and create a new notebook (fig 1):

 

 

Liliam_Leme_0-1588776410221.jpeg

Fig1: New Notebook

 

 

 

Define a name for the notebook, select the cluster that you created and a language. Our example will be SQL as you can see on figure 2:

 

Liliam_Leme_1-1588776410225.jpeg

Figure 2: Define notebook configuration

 

As I already mentioned I based this post in the databricks documentation. So most of the code is available here: https://docs.databricks.com/data/data-sources/azure/synapse-analytics.html#language-sql

 

However,  our code will be slightly different. The next step involves working on the notebook so you will need information regards your storage account to add this later to the notebook code.

 

This is the piece of code where we will set up the storage account:

SET fs.azure.account.key.<your-storage-account-name>.blob.core.windows.net=<your-storage-account-access-key>;

In order to copy the storage key required and replace the information on the syntax above. Open the portal and select  the service storage account-> select the name of your storage account that was previous create for this lab -> Select the option access key from your storage account as the figure 3

 

For example, my storage account is: acctnameadf

 

 

Figure3_StorageAccount_key.PNG

Figure 3 Storage account access key

 

Once you have the key you can change teh code as the example below:

 

-- Set up the Blob storage account access key in the notebook session conf.

SET fs.azure.account.key.acctnameadf.blob.core.windows.net=3333333333+121222222222222/N1eZ6rLvNn2RF/111111==;

 

 

  1. You will need to define a table on in your SQL DW to be the source of the data. I defined mine as: my_table_in_dw

 

Liliam_Leme_3-1588776410274.jpeg

 

 

=================

This is the code that will be used on the notebook to create the table in Spark with the source on SQL DW:

 

 

 

 

 

-- Read data using SQL.
CREATE TABLE my_table_in_spark_read
USING com.databricks.spark.sqldw
OPTIONS (
  url 'jdbc:sqlserver://<the-rest-of-the-connection-string>',
  forwardSparkAzureStorageCredentials 'true',
  dbTable 'my_table_in_dw', ---> Source table on the DW. Replace by your table name
  tempDir 'wasbs://<your-container-name>@<your-storage-account-name>.blob.core.windows.net/<your-directory-name>'
);

 

 

 

 

In other words, applying the code to our example: 

Note: I am using SQL Server a user to connect. With the purpose to make it simple, I am not using AAD, just SQL User on DW:   'jdbc:sqlserver://YOURServerNAME.database.windows.net:1433;databaseName=YOURDATAbase name;user=USERtoconnectonSQL;password=PASSWORDofthatUser',

 

 

 

 

 
-- Read data using SQL.
CREATE TABLE if not exists my_table_in_spark_read
USING com.databricks.spark.sqldw
OPTIONS (
  url 'jdbc:sqlserver://YOURServerNAME.database.windows.net:1433;databaseName=YOURDATAbase name;user=USERtoconnectonSQL;password=PASSWORDofthatUser',
  forwardSparkAzureStorageCredentials 'true',
 dbTable 'my_table_in_dw',
  tempDir 'wasbs://adftutorial@acctnameadf.blob.core.windows.net/'
); ---------------------->replace by  your container and storage account( mine is adftutorial and acctnameadf respectively) 

 

 

 

 

 

  1. Next step will be to create a table on SQLDW using a table created previously on Spark:

 

 

 

 
-- Write data using SQL.
-- Create a new table, throwing an error if a table with the same name already exists:
CREATE TABLE my_table_in_spark_write
USING com.databricks.spark.sqldw
OPTIONS (
  url 'jdbc:sqlserver://<the-rest-of-the-connection-string>',
  forwardSparkAzureStorageCredentials 'true',
  dbTable 'my_table_in_dw_copy',
  tempDir 'wasbs://<your-container-name>@<your-storage-account-name>.blob.core.windows.net/<your-directory-name>'
)
AS SELECT * FROM table_to_save_in_spark;

 

 

 

 

Our example will be:

Note: I am using the same table created on the last step and also I added the not exist clause in the table creation.

The table to be created on SQL DW is my_table_in_dw_copy

 

 

 

 

CREATE TABLE if not exists  my_table_in_spark_write ---> Spark table
USING com.databricks.spark.sqldw
OPTIONS (
  url 'jdbc:sqlserver://YOURSERVERNAME.database.windows.net:1433;databaseName=SQLUSERNAME;user=Test;password=SQLUSERPASSWORD',
  forwardSparkAzureStorageCredentials 'true',
  dbTable 'my_table_in_dw_copy', ---> table to be created on SQLDW
  tempDir 'wasbs://adftutorial@acctnameadf.blob.core.windows.net/'
) ---------------------->replace by  your container and storage account( mine is adftutorial and acctnameadf respectively) 
AS SELECT * FROM my_table_in_spark_read;

 

 

 

 

 

 Now hit the option run all. The results we expected are in figure 4:

 

Liliam_Leme_5-1588776410290.jpeg

Figure 4: Jobs

 

If you are wondering where are the databrick tables that we just created -> check the data option as per figure 5 below:

 

Liliam_Leme_6-1588776410299.jpeg

 

Figure 5: Spark Tables

 

If you check our SQLDW you will also find a new object – my_table_in_dw_copy as figure 6 show:

Liliam_Leme_7-1588776410303.jpeg

Figure 6 DW Objects

 

Table created for the example on the DW ( if you want to use my table example as source):

 

 

 

 

 

SET ANSI_NULLS ON
GO
 
SET QUOTED_IDENTIFIER ON
GO
 
CREATE TABLE [dbo].[my_table_in_dw]
(
[NAME_] [varchar](50) NULL,
[sURNAME_] [varchar](50) NULL
)
WITH
(
DISTRIBUTION = ROUND_ROBIN,
CLUSTERED COLUMNSTORE INDEX
)
GO

 

 

 

 

 

So maybe you are asking yourself. Why do I need a Storage account???

Note the storage account is used as temporary data management. As you can see per documentation: "

Azure Synapse instead creates a subdirectory of the form: <tempDir>/<yyyy-MM-dd>/<HH-mm-ss-SSS>/<randomUUID>/. You can set up periodic jobs (using the Databricks jobs feature or otherwise) to recursively delete any subdirectories that are older than a given threshold (for example, 2 days), with the assumption that there cannot be Spark jobs running longer than that threshold.

The Azure Synapse connector automates data transfer between a Databricks cluster and an Azure Synapse instance. For reading data from an Azure Synapse table or query or writing data to an Azure Synapse table, the Azure Synapse connector creates temporary objects, including DATABASE SCOPED CREDENTIAL, EXTERNAL DATA SOURCE, EXTERNAL FILE FORMAT, and EXTERNAL TABLE behind the scenes. These objects live only throughout the duration of the corresponding Spark job and should automatically be dropped thereafter.”

 

You will be able to check for yourself those temporary files under your storage account as figure 7 demonstrate:

storage.png

Figure 7 Temporary files

 

Or you can also query them by running this:

  • SELECT * FROM sys.database_scoped_credentials WHERE name LIKE 'tmp_databricks_%'
  • SELECT * FROM sys.external_data_sources WHERE name LIKE 'tmp_databricks_%'
  • SELECT * FROM sys.external_file_formats WHERE name LIKE 'tmp_databricks_%'
  • SELECT * FROM sys.external_tables WHERE name LIKE 'tmp_databricks_%'

 

Note: if the Spark crashes or is forcefully restarted, or if the cluster is forcefully terminated or restarted, temporary objects might not be dropped.  So it is important to know how to track those files.

 

Liliam C Leme