YouTube2Text

Databricks Tutorial (From Zero to Hero) | Azure Databricks Masterclass — Transcript

by Ansh Lamba · 40,026 words · 5,660 segments · language en · Watch on YouTube

Full transcript

  1. 0:00this 4 hours of datab Bri master class
  2. 0:04will make you a tab Bri data engineer
  3. 0:07even if you do not have any prior
  4. 0:09experience because in this master class
  5. 0:12you will learn about spark cluster spark
  6. 0:16architecture data Brak fundamentals
  7. 0:18magic commands data brakes utilities
  8. 0:20datab brakes file system reading
  9. 0:22external data from cloud data storage
  10. 0:25secret Scopes ipark Transformations
  11. 0:27loading data incrementally using
  12. 0:30autoloader and after covering all these
  13. 0:34areas you will learn something special
  14. 0:37which is required to crack the
  15. 0:38interviews I am talking about Delta Lake
  16. 0:41you will learn Delta Lake in detail and
  17. 0:44learn about Delta log external Delta
  18. 0:47table versus manage Delta table
  19. 0:49tombstoning of files data versioning
  20. 0:52time travel Delta table optimization
  21. 0:55techniques such as zorder by vacuum
  22. 0:57command and much more wow that sounds
  23. 1:01like this is your onstop solution to
  24. 1:04become a datab brakes data engineer but
  25. 1:08you should only watch this video if you
  26. 1:10are dedicated enough to learn everything
  27. 1:13with excitement if your answer is yes so
  28. 1:17let's get started with this amazing data
  29. 1:20breakes master class so welcome welcome
  30. 1:24welcome welcome to data breaks Master
  31. 1:28Class
  32. 1:30this session is really really really
  33. 1:33interesting because I know that demand
  34. 1:35for data Brak is growing ridly and
  35. 1:39companies are going after like data Brak
  36. 1:41developers and they should because data
  37. 1:45Brak is like one of those Technologies
  38. 1:47which are in demand plus which are
  39. 1:49powerful enough and which are strongly
  40. 1:52inclined towards future they are
  41. 1:56continuously adding so many updates that
  42. 2:00you need to be updated enough to just
  43. 2:03cope with the pace so I can say that if
  44. 2:06you just see data breaks few years back
  45. 2:08it was totally totally different but now
  46. 2:12now now the scenario is totally changed
  47. 2:16there are so many updates in data brakes
  48. 2:19let me give you a hint so earlier we
  49. 2:22were using mounting if you want to just
  50. 2:26um read any data from the external
  51. 2:28location but now we use Unity catalogs
  52. 2:31now we use Delta lakes and in Delta
  53. 2:33Lakes we are seeing updates on a daily
  54. 2:37basis trust me like there are so so so
  55. 2:40many updates in the Delta Lake and it's
  56. 2:43very important to stay updated when I
  57. 2:46just look for the courses available in
  58. 2:48data breakes even the paid courses they
  59. 2:51are really really good the only thing
  60. 2:53that was missing was information was not
  61. 2:56updated information was not as per the
  62. 3:00latest Trend so here I am with terab
  63. 3:04brick master class and I will be
  64. 3:06covering all the latest
  65. 3:09information yes all the latest trends
  66. 3:13that are going with the data bricks so
  67. 3:16I'm just trying to fill that Gap and I
  68. 3:19hope that you will love the session and
  69. 3:22trust me like I have like read books
  70. 3:25related to data breaks I have read books
  71. 3:28related to Delta l and let me just show
  72. 3:31you as well so this book so this book is
  73. 3:35a gym so this is like specially related
  74. 3:38to Delta Lake and this this book I think
  75. 3:40is recently published so there's like so
  76. 3:44so so much of knowledge that is missing
  77. 3:47right now in the online platform so I
  78. 3:50thought like it's my duty for my
  79. 3:52community to just pass on this knowledge
  80. 3:56so that you can also be competitive
  81. 3:58enough and TR trust me if you want to
  82. 4:00crack interviews in today's scenario you
  83. 4:03need to be updated you need to be like
  84. 4:06you you need to be like someone who
  85. 4:08knows like all the latest trends and
  86. 4:10technology that are being used who is
  87. 4:13like well vered with all the recent
  88. 4:15updates so now you have found the best
  89. 4:19video which will be covering each and
  90. 4:21everything from scratch yes this master
  91. 4:24class will get will be covering
  92. 4:27everything from scratch so if you do not
  93. 4:28have any prior EXP experience any PR
  94. 4:30knowledge do not need to worry because I
  95. 4:32will explain you each and everything
  96. 4:34from scratch and we'll be covering all
  97. 4:37the latest updates and just a hint in
  98. 4:41this particular master class we will be
  99. 4:42covering Delta l in detail which is the
  100. 4:46most in demand technology right now and
  101. 4:49we will see how we can just work with
  102. 4:51Delta Lake and I will just try
  103. 4:54[Music]
  104. 4:55to pass on the knowledge that I have
  105. 4:58gained so far so do not need to worry
  106. 5:00you do not need to pay for any of the
  107. 5:02resources everything is available for
  108. 5:04free you just need to be focused you
  109. 5:07just need to just take out your
  110. 5:08notebooks pen pencils everything and
  111. 5:11just start taking notes because this is
  112. 5:13the onstop solution that you were
  113. 5:16looking for and now you have got it so
  114. 5:20let's get started with our Tera breaks
  115. 5:22master
  116. 5:24class so first of all let's discuss
  117. 5:26about the prequests so there are not
  118. 5:28much prequest obviously you just need a
  119. 5:31laptop or PC with stable internet
  120. 5:33connection so that you can just enjoy
  121. 5:35this video so that you can just learn
  122. 5:38from this video next data breakes
  123. 5:41account
  124. 5:43oops oops oops oops so if you do not
  125. 5:46have datab Bri account do not need to
  126. 5:48worry because I am here to help you how
  127. 5:51you can just set up a free datab Brix
  128. 5:53account and this will not be a databas
  129. 5:57community account no no no no no no as I
  130. 6:01just told you because this
  131. 6:03video is ah level up for like as
  132. 6:08compared to other videos so we will be
  133. 6:10just creating cloud account because that
  134. 6:13is required if you want to just crack
  135. 6:16interviews because if you want to show
  136. 6:18that you are experienced enough then you
  137. 6:20should know all the uh handson and you
  138. 6:23should know all the workings that we
  139. 6:26have within the cloud account so even if
  140. 6:28you do not have any cloud account we
  141. 6:30will create everything from scratch do
  142. 6:32not need to worry next next next next
  143. 6:35the main thing excitement to learn data
  144. 6:37braks because data braks is like the
  145. 6:41Hulk I I call it as Hulk because
  146. 6:44everyone is running towards data brakes
  147. 6:48why the main advantage of using data
  148. 6:51Brak is it is independent of any Cloud
  149. 6:53environment you can just use data braks
  150. 6:56with any Cloud environment and that is
  151. 6:57the best thing if you using aure you can
  152. 7:00use data Bri if you are using gcp that
  153. 7:02is Google Cloud platform you can use
  154. 7:04data briak if you are using AWS you can
  155. 7:06use data if you're using AWS you can use
  156. 7:08datax yeah so this is like Cloud
  157. 7:12independent so that's why all the three
  158. 7:15major Cloud players can integrate datab
  159. 7:19B and that's the biggest advantage of
  160. 7:21this and that's why every company is
  161. 7:24just relying on data breaks because
  162. 7:26obviously when you transform the data
  163. 7:28when you want to just work with the big
  164. 7:29data sets data brakes spark clusters are
  165. 7:33your only choice did I just say spark
  166. 7:35clusters don't need to worry I will tell
  167. 7:37you everything that I'm saying right now
  168. 7:41so what is a spark cluster what is a
  169. 7:44spark cluster so basically when we talk
  170. 7:46about data braks data braks we are
  171. 7:48actually talking about spark clusters
  172. 7:51okay because the founder of data BRS the
  173. 7:55creator of data brakes is the same that
  174. 7:57we were creator of Apache spot
  175. 8:00so now let's cover this
  176. 8:04topic what is a spark cluster what what
  177. 8:07is a SW cluster what is a cluster so the
  178. 8:11thing is let me give you an example so
  179. 8:12that you can just get this knowledge
  180. 8:15like very easily instead of just making
  181. 8:17it complicated let me just uh give you
  182. 8:20an
  183. 8:21example you must have worked in your
  184. 8:24computer lab maybe in your school or in
  185. 8:27your college so you would have seen so
  186. 8:30many computers in that particular room
  187. 8:33right let's say you saw like 30
  188. 8:36computers right let let's say you just
  189. 8:38saw 30 computers in one room right now
  190. 8:42if I just ask you to combine all the 30
  191. 8:47computers together and treat those 30
  192. 8:51computers as one computer can you
  193. 8:54imagine the power of that one computer
  194. 8:57would be the power of processing the how
  195. 9:01how fast it can process the data can you
  196. 9:04imagine obviously it is much more than
  197. 9:08one single computer even if I just say
  198. 9:13that you can just take one computer
  199. 9:16right and you can just increase its Ram
  200. 9:19its Rome its storage everything there is
  201. 9:22a limit to do
  202. 9:25it there is a limit but there is no
  203. 9:29limit when you combine computers now you
  204. 9:32would say I only have 30 computers so
  205. 9:35what you can just include another
  206. 9:37computer lab of 30 computers now you
  207. 9:39have 60 computers then you can include
  208. 9:42another computer lab of 30 computers now
  209. 9:44you have 90 computers so there is no
  210. 9:47limit when you horizontally scale your
  211. 9:52machines and in spark language we call
  212. 9:55machines as nodes let me type it for you
  213. 9:58and start taking notes start taking
  214. 10:01notes right
  215. 10:03now so we call them as nodes instead of
  216. 10:08machines like you can just call them
  217. 10:10machines as well but in spark language
  218. 10:11you call them as
  219. 10:13nodes so just imagine now we have 90
  220. 10:18machines now we have 90 nodes and we are
  221. 10:22treating them at treating them as like
  222. 10:24only one single machine now just imagine
  223. 10:27its power that is is spk cluster so
  224. 10:29basically when we combine machines when
  225. 10:33we combine nodes and we connect them
  226. 10:36together it becomes a cluster so as you
  227. 10:40can see let's say we have machine one or
  228. 10:42let's say we have computer lab one which
  229. 10:45have 30 computers we have computer lab
  230. 10:47two having 30 computers we have computer
  231. 10:49lab three 30 computers now this cluster
  232. 10:53is
  233. 10:54having 90 nodes 90 computers 90 90
  234. 11:00machines and these 90 machines are being
  235. 11:04treated as one single machine because
  236. 11:08these are
  237. 11:09interconnected now these M okay okay
  238. 11:13okay okay your question is valid why do
  239. 11:15we need to just combine so many machines
  240. 11:17because we can distribute our work just
  241. 11:20imagine I just got a task I just got a
  242. 11:23task to let's say process 1 GB of data
  243. 11:26this is an a hypothetical situation so
  244. 11:28don't about that let's see I just got
  245. 11:31okay let's take it as one
  246. 11:34TB one TB of data right one TB of data
  247. 11:38one
  248. 11:39terabyte so now I can just ask these 90
  249. 11:44machines to distribute the data to
  250. 11:48distribute some some data some part of
  251. 11:49data that's called like subset of data
  252. 11:51or let's say that's also called as like
  253. 11:53data partitioning so these like this one
  254. 11:56TB of
  255. 11:57data can be distributed among 90
  256. 12:01machines and these 90 machines can work
  257. 12:04in parallel and can deliver the
  258. 12:08results that is why we need parallel
  259. 12:13processing that's why we need
  260. 12:16clusters and that's why we need a par
  261. 12:19spark got it I hope like now you know
  262. 12:22the concept of spark cluster what is a
  263. 12:24spark cluster what is a spark cluster
  264. 12:27now after this I am going to cover one
  265. 12:30very important topic not just for the
  266. 12:33sake of learning but if you want to
  267. 12:36crack interviews this is the area that
  268. 12:38you should focus on
  269. 12:40definitely this is none other than spark
  270. 12:43architecture I know this topic is a
  271. 12:48little bit complicated but I will tell
  272. 12:51you like let me tell you like I I will
  273. 12:54just make this topic so so so easy to
  274. 12:57understand trust me just just be with me
  275. 12:58for like next few minutes and then you
  276. 13:01will be like okay now we have understood
  277. 13:03each and everything related to spark
  278. 13:05architecture just trust me
  279. 13:08now we don't know what is this okay now
  280. 13:12we don't know what is this now we don't
  281. 13:13know what is this what is this we just
  282. 13:15know so far that cluster is a group of
  283. 13:19machines cluster is a group of machines
  284. 13:22we just know this part okay you know
  285. 13:25this part very good so in this example
  286. 13:28we talked about that we have let's say
  287. 13:30three machines machine one Machine 2
  288. 13:33machine 3 and our cluster is just having
  289. 13:36three machines
  290. 13:38right okay we just have three machines
  291. 13:42so our cluster is having just three
  292. 13:44machines let's understand the spark
  293. 13:46architecture with this example so let's
  294. 13:49say we have just three machines so first
  295. 13:51of all obviously when I say I want to
  296. 13:54process one TB of data right
  297. 13:59and let's say this is
  298. 14:01you and you want to process this one TB
  299. 14:05of data this is
  300. 14:09you don't mind my drawing okay this is
  301. 14:13you right so now you have this is a
  302. 14:16cluster this is a cluster so let's call
  303. 14:20it as cluster because you just know
  304. 14:22cluster you don't know what is going
  305. 14:23inside this right so this is your
  306. 14:25cluster so now every cluster has a
  307. 14:29cluster manager so this cluster manager
  308. 14:33can be spark Standalone cluster manager
  309. 14:36or the external one as well so this this
  310. 14:39has a cluster manager Every Spark
  311. 14:41cluster has a cluster manager and
  312. 14:43obviously as name suggest it manages
  313. 14:45everything let me tell you let me tell
  314. 14:46you wait wait wait wait wait so now what
  315. 14:49it will do first of all it will use one
  316. 14:54machine one node to create driver
  317. 14:58application to create driver program
  318. 15:00this one first of all this is the first
  319. 15:03thing it will treat one machine as
  320. 15:07driver machine right just take notes
  321. 15:11just take notes so one machine is like
  322. 15:14driver machine or driver program right
  323. 15:17so this is our our driver program now
  324. 15:21this is done like one machine is
  325. 15:23occupied and we have two machines left
  326. 15:25right okay now what will what will
  327. 15:28happen now when we submit the codee to
  328. 15:31Cluster manager like to Cluster
  329. 15:35right it first goes to Cluster manager
  330. 15:39yes it first goes to Cluster manager
  331. 15:42then it creates this driver program this
  332. 15:45is done this you understood right this
  333. 15:47you understood now this driver
  334. 15:52program this driver program will divide
  335. 15:56your data processing in small small
  336. 16:00tasks it will just give the directions
  337. 16:04like what actually need to happen right
  338. 16:08let me repeat it will break your data
  339. 16:11processing command in small small task
  340. 16:14and will give instructions what actually
  341. 16:18need to happen so it has some
  342. 16:21information it has some information
  343. 16:25right it has some information now this
  344. 16:28information will go to the cluster
  345. 16:33manager okay now this information will
  346. 16:35go to the cluster manager now this
  347. 16:39information has also the information
  348. 16:43related to number of machines required
  349. 16:46number of machines required to actually
  350. 16:49execute the code and those machines are
  351. 16:52called as worker nodes called as worker
  352. 16:56nodes right got it so let's say this
  353. 17:00driver program said that I need both the
  354. 17:02machines I need this machine as well I
  355. 17:05need this machine as well okay now it
  356. 17:08will create worker node on both the
  357. 17:11machines okay worker
  358. 17:14one worker two okay worker one worker
  359. 17:17two so it will create worker node on
  360. 17:20both the machines now this
  361. 17:23information will be going to these
  362. 17:27worker nodes worker one and worker to
  363. 17:30and these worker nodes has something
  364. 17:32called
  365. 17:33executors as you can see
  366. 17:36executor executor so in data breaks we
  367. 17:39just have one executor per work worker
  368. 17:41node so don't worry about that so now
  369. 17:45this information will go to worker one
  370. 17:47and worker two right now cluster manager
  371. 17:51responsibility is done e says you gave
  372. 17:55me one TB of data I created driver
  373. 17:57program for you driver program gave me
  374. 18:00information to create two worker notes I
  375. 18:02have created that manager's
  376. 18:04responsibility is done manager's task is
  377. 18:06done now these two worker nodes will
  378. 18:10actually process the data will actually
  379. 18:12do the hard work then they will return
  380. 18:15this result back to the driver program
  381. 18:19yes now there's no intervention of this
  382. 18:22cluster manager is out now these two are
  383. 18:25communicating worker nodes is
  384. 18:26communicating with driver program this
  385. 18:28worker node is communicating with driver
  386. 18:29program and obviously the whole cluster
  387. 18:32is now synced with each other and we get
  388. 18:37the processed data out of
  389. 18:39it
  390. 18:41understood this is the easiest way this
  391. 18:44is the easiest example I could have
  392. 18:47taken so if you have understood some of
  393. 18:50this part it's really good because when
  394. 18:52I was understanding this part I've
  395. 18:53watched I think videos like so many
  396. 18:56times I just read books so many times
  397. 18:59because it is really confusing but try
  398. 19:00to grasp it rewatch this part again and
  399. 19:04trust me you will just grasp this part I
  400. 19:06know you have understood like at least
  401. 19:0750% of it I am damn sure I damn sure
  402. 19:10about it but just rewatch this part so
  403. 19:13to summarize let me summarize
  404. 19:15it this is you you want your Spar
  405. 19:18cluster to process your data right so
  406. 19:21you have a cluster manager this cluster
  407. 19:23manager will create one driver program
  408. 19:26right so this driver program will see
  409. 19:28your code okay you want to do this you
  410. 19:30want to do this so it will break that
  411. 19:32processing thing into small small task
  412. 19:34and it will provide the information to
  413. 19:36Cluster manager and then that
  414. 19:39information will also be written in this
  415. 19:40information page that we need two worker
  416. 19:42notes it will create two worker notes he
  417. 19:44will say okay my task is done now you
  418. 19:46can communicate now these worker nodes
  419. 19:48and dver program will communicate with
  420. 19:50each other one thing to note driver
  421. 19:53program will not do any kind of
  422. 19:55execution no it will not process your
  423. 19:58data it will just give the directions it
  424. 20:00will just orchestrate the task that's it
  425. 20:03that's it it will not process it will
  426. 20:07not do the hard work hard work will be
  427. 20:09done by worker nodes that's it simple
  428. 20:13and they do not need to use their brain
  429. 20:16no they will get the instructions they
  430. 20:18do it simple simple they do not need to
  431. 20:21think hey can we do this can we do this
  432. 20:23no everything will be instructed by
  433. 20:27driver program like what task should be
  434. 20:29done first and like what should be the
  435. 20:32orchestration flow everything will be
  436. 20:34provided by driver program this
  437. 20:37one simple this was all about spark
  438. 20:40architecture if you haven't understand
  439. 20:41100% of it it is fine that means you are
  440. 20:44learning and now it's time to just
  441. 20:46rewatch this part again and once you
  442. 20:47have rewatched it now let's start with
  443. 20:50now un please tell us like what is data
  444. 20:54so the thing is we just talked about
  445. 20:56clusters right now the best thing is you
  446. 20:59do you do not need to manage these
  447. 21:01cluster no data breaks is actually doing
  448. 21:06all the hard work for us it is so good
  449. 21:08it is managing this whole
  450. 21:11cluster for us it is kind of a
  451. 21:14management layer for our spark clusters
  452. 21:18yes that's why we use data brakes
  453. 21:20nowadays we do not need to manage
  454. 21:22clusters we do not need to do anything
  455. 21:24everything will be done by data brakes
  456. 21:27everything will be done by data break
  457. 21:28that's why we love datab brakes and
  458. 21:30that's why data brakes is the like OG it
  459. 21:33is like the
  460. 21:35OG so now data is managing our cluster
  461. 21:38that's a good news right yeah that's a
  462. 21:40good news because we do not need to do
  463. 21:41anything and we just need to configure
  464. 21:43our cluster don't worry I will just show
  465. 21:45you how you can do it so that was all
  466. 21:47about data brakes now you have
  467. 21:48understood what is actually data brakes
  468. 21:49so data brakes will manage our clusters
  469. 21:52data breaks will actually take care of
  470. 21:54all the Clusters everything right so
  471. 21:59now finally it's time to talk about
  472. 22:04account creation so there are basically
  473. 22:06two ways to create account one is
  474. 22:08Community Edition what is Community
  475. 22:10Edition so basically this fre this is
  476. 22:12the kind of free account that is
  477. 22:13provided by datab break itself when you
  478. 22:15want to learn something when you just
  479. 22:17want to uh have a have have an exposure
  480. 22:20of datab Brak right so this is a kind of
  481. 22:22communication account uh you can also
  482. 22:25create this account but the thing is if
  483. 22:27you want to crack interviews if you want
  484. 22:30to show that you are experienced in data
  485. 22:32breaks you need to show that you are
  486. 22:35well vered with working with data bricks
  487. 22:39along with the cloud storage because
  488. 22:40obviously in the real world we do not
  489. 22:42know we do not need to use Community
  490. 22:44Edition in the real world we do not use
  491. 22:46Community Edition accounts no we do not
  492. 22:48use this we use cloud accounts obviously
  493. 22:53because company data organizations data
  494. 22:56is not available on Community Edition it
  495. 22:58is stored in the data Lakes it is stored
  496. 23:01in the storage accounts of cloud
  497. 23:03providers such as AWS Azure gcp so in
  498. 23:07the real world we work with datab brakes
  499. 23:10and we connect our datab BR account with
  500. 23:12Cloud providers that's why in this
  501. 23:14particular video I will show you how we
  502. 23:17can create data account which is linked
  503. 23:20to a cloud provider and then we will
  504. 23:23learn each and everything linked to that
  505. 23:26cloud provider or let's say cloud
  506. 23:28storage account so that you can actually
  507. 23:30have that exposure you can actually have
  508. 23:33that experience how things are working
  509. 23:36with Cloud because it is totally
  510. 23:38different like not different but yeah
  511. 23:41like you cannot use storage paths which
  512. 23:42is like provided by the cloud and you
  513. 23:45actually cannot see the data because
  514. 23:48that is not shown to you when you use
  515. 23:50Community Edition right so there are
  516. 23:52many things that are missing in
  517. 23:53Community Edition but I will show you
  518. 23:56how you can just create your free uh
  519. 23:58cloud account cloud data account and
  520. 24:01definitely you will learn a lot trust me
  521. 24:03this can be the game changer for you
  522. 24:05because you will feel confident while
  523. 24:06sitting in the interviews and you can
  524. 24:07just tell them that I am experienced
  525. 24:09because I know like how to work with
  526. 24:11Cloud accounts because obviously when
  527. 24:14you sit in the interview and you will
  528. 24:15say I have only worked with Community
  529. 24:17editions obviously they will not
  530. 24:19consider you but now they will consider
  531. 24:23you because you are watching my video
  532. 24:24and I'm just providing the best quality
  533. 24:26of education so so for this particular
  534. 24:30video we will use Azure I love Azure so
  535. 24:33we will be using Azure it doesn't matter
  536. 24:36because you can just use any cloud
  537. 24:37provider because we are learning data
  538. 24:39breaks we are not learning Azure AWS or
  539. 24:41gcp we are learning data breaks along
  540. 24:44with any cloud storage right and as I
  541. 24:48have mentioned that data brakes is
  542. 24:50independent of cloud so when you learn
  543. 24:52data braks connected with any Cloud
  544. 24:54platform that means you have learned
  545. 24:56data brakes with all the platforms this
  546. 24:58is the best thing about data breaks and
  547. 25:01why I have picked data breaks with Azure
  548. 25:03because you need to configure so much
  549. 25:07when you work with Azure you need to
  550. 25:09just use keywords you need to just use
  551. 25:12service principle you need to just uh
  552. 25:14configure let's say a secret Scopes in
  553. 25:17data when you actually want to access
  554. 25:20data stored in the data Lake and that's
  555. 25:23what recruiters want you to know that's
  556. 25:27what they are looking for you should be
  557. 25:29well wored about the all the
  558. 25:32configurations that are required to
  559. 25:33access the data so that's why I have
  560. 25:35picked Microsoft Azure and it will give
  561. 25:38you like a lot of knowledge a lot of
  562. 25:40skills trust me so how this flow will
  563. 25:43work let me just tell you so first of
  564. 25:45all we will just create a free Azure
  565. 25:48account right and once we have that free
  566. 25:51Azure account we can just create a data
  567. 25:53braks resource within that don't mind my
  568. 25:56handwriting because I know it's really
  569. 25:58good so first of all we will create a
  570. 26:01your free account and then we will
  571. 26:02create data bre free account so without
  572. 26:05wasting any time let's get started with
  573. 26:08account creation and yes let's get
  574. 26:11finally started with datab brakes as
  575. 26:13well let's
  576. 26:16see to create in order to create free
  577. 26:20your account so first of all what we
  578. 26:22will do we will just go to Google uh
  579. 26:24let's
  580. 26:25see yeah just write this aure free
  581. 26:28account and then you should just click
  582. 26:30on the first link that you see and here
  583. 26:33here you just need to click on try aure
  584. 26:35for free do not click on this one pay as
  585. 26:37you go because we want to create a free
  586. 26:39account so just click on this and then
  587. 26:42it will just ask you to put your email
  588. 26:45ID so if you do not have any Microsoft
  589. 26:47email accounts you can just click on
  590. 26:49create one and if you already have one
  591. 26:52just put that email ID and then sign in
  592. 26:55with your email ID
  593. 26:58so after
  594. 26:59login you will just see this page so you
  595. 27:03just need to fill this form you just
  596. 27:05need to put your all the details name
  597. 27:08and your email address phone number
  598. 27:09everything and as you can see here on
  599. 27:12this side that you get popular free
  600. 27:14services for 12 months that's great and
  601. 27:1755 services that are always free and the
  602. 27:20best thing is you will get 200 credits
  603. 27:24US dollars to access this account so
  604. 27:26basically aure provides you $200 so that
  605. 27:29you can just use their services and it
  606. 27:31is only available for 30 days and I
  607. 27:33think that is enough to learn this
  608. 27:35lecture to just gain knowledge from this
  609. 27:37lecture and that is fine and the best
  610. 27:40thing you just need to click on sign up
  611. 27:43and that's all that's all just click on
  612. 27:45the sign up button and that's all after
  613. 27:48clicking on this it will just ask you to
  614. 27:50put your C details and all do not afraid
  615. 27:52to put those details because it will
  616. 27:54just ask you to confirm that you are the
  617. 27:56one who will be using their services
  618. 27:58and they will not charge you after 30
  619. 28:00days because they will just
  620. 28:01automatically remove those services that
  621. 28:04you were using and you will not get
  622. 28:05charged just trust aure so you do not
  623. 28:08need to worry just put those details and
  624. 28:10you are good to go so once you have
  625. 28:13created your aure account it's time to
  626. 28:15actually go to a your portal and
  627. 28:18actually see how we can create datab
  628. 28:21brakes workspace within a short data
  629. 28:23break yes let's see that so in order to
  630. 28:25access your portal account you just need
  631. 28:27to go on Google and just write portal.
  632. 28:29azure.com and it will just take you to
  633. 28:32the Microsoft Azure portal account so
  634. 28:35are you excited to see your first aure
  635. 28:37portal account wow this is our aure
  636. 28:41portal account do not need to worry if
  637. 28:43you see these services and not in your
  638. 28:46account because these are like my
  639. 28:48previous resources that I have created
  640. 28:50so far so do not need to worry now it
  641. 28:52should be fine right now I have just
  642. 28:54changed my tab from recent to favorites
  643. 28:57so
  644. 28:58this is the homepage of aure portal and
  645. 29:02this is your aure account where you just
  646. 29:06create all the resources where you just
  647. 29:08manage your your portal account
  648. 29:10everything is done here if you are new
  649. 29:14to a your so this is your first homepage
  650. 29:17congratulations like I was really really
  651. 29:18excited I still remember those days like
  652. 29:21when I was just creating my first
  653. 29:23account and I just landed on this page
  654. 29:26for the first time I was really excited
  655. 29:27and I love love the UI like it is so so
  656. 29:30so good so as I just said like if you
  657. 29:33just see different resources or
  658. 29:35different Services here do not need to
  659. 29:37worry because it just shows the services
  660. 29:39that you use that that you have used
  661. 29:42before so do not need to worry do not
  662. 29:44need to worry so first of all first of
  663. 29:46all first of all first of all before
  664. 29:49just creating a your data break or let's
  665. 29:51say data break service I just want to
  666. 29:53tell you like some of the basics that
  667. 29:55you should know about as y like it is
  668. 29:57like very very Basics so first of all I
  669. 30:00will just tell you what is this Resource
  670. 30:01Group so basically whenever we want to
  671. 30:06store our services what are Services
  672. 30:08services are like whenever you create
  673. 30:10your databas that is a service whenever
  674. 30:12you create a storage account that is a
  675. 30:13service whenever you create anything in
  676. 30:15your that is a service so we need to put
  677. 30:17those services in a folder and that
  678. 30:20folder is also called as Resource Group
  679. 30:23that's it that that is a kind of fancy
  680. 30:25term that we use in a y but that is just
  681. 30:26a folder do not need to work
  682. 30:29so we need to create two resources for
  683. 30:32this master class what are these two
  684. 30:33resources first of all first of all we
  685. 30:37will
  686. 30:38create data Lake obviously nowadays we
  687. 30:42work with data Lake a lot and data lake
  688. 30:45is the future obviously Delta lake is
  689. 30:47the future but Delta L is built on top
  690. 30:49of data l so do not need to worry
  691. 30:51actually Del I will just tell you each
  692. 30:52and everything about Delta L but the
  693. 30:54storage the core storage is data L and
  694. 30:58and I will also show you how you can
  695. 30:59create data l in aure so do not need to
  696. 31:01do not need to worry bro first is data L
  697. 31:04and second thing that we need is
  698. 31:05obviously data brakes data breakes
  699. 31:08account or let's say data brakes
  700. 31:10workspace these are the two things that
  701. 31:11we want to create right now in order to
  702. 31:15access or let's say in order to uh
  703. 31:19proceed with the further steps so these
  704. 31:21are the two things so first of all let's
  705. 31:23create a data link and a quick question
  706. 31:27for you if you want to store your data
  707. 31:28like where you will be storing it we
  708. 31:30just discussed yes in the resource Group
  709. 31:34so we have to create a resource Group so
  710. 31:37actually we need to create first a
  711. 31:39resource Group then these two services
  712. 31:41so how you can create a resource Group
  713. 31:42just go on this search Tab and then just
  714. 31:45write let's say Resource Group it should
  715. 31:47pop up yeah here we have click on
  716. 31:49Resource Group and don't mind my
  717. 31:51previous resource groups just click on
  718. 31:53plus create button here in this corner
  719. 31:56just click on this plus create
  720. 31:59and click on create Resource Group so
  721. 32:01then we need to just name our Resource
  722. 32:02Group so you can just give it a name
  723. 32:04anything like I will just give like data
  724. 32:08breaks Master
  725. 32:12Class simple and I will just add RG in
  726. 32:16the beginning as a prefix so region you
  727. 32:20can just pick any region don't need to
  728. 32:21worry you can just pick any region yep
  729. 32:24so now just click on review plus create
  730. 32:27simple so now it is validated just click
  731. 32:30on create for one more time and your
  732. 32:33group is ready how you can search your
  733. 32:35resource Group so just go to your home
  734. 32:38Tab and then if you see this button you
  735. 32:40can click on it either you can just
  736. 32:42write your resource Group like here
  737. 32:44resource groups and then it should just
  738. 32:47show you the name yeah mine is here so
  739. 32:51as we all all as we all can see that
  740. 32:54this is empty why because we do not have
  741. 32:56anything we do not not have anything
  742. 32:58that's why it is empty right so first of
  743. 33:01all let's create storage account which
  744. 33:03is which is also known as datal not
  745. 33:05really not really so there is a tip that
  746. 33:09I will show you while creating these
  747. 33:10storage account so by default when we
  748. 33:13create a storage account in a j it
  749. 33:15creates The Blob storage but by that tip
  750. 33:18you can just convert your blob storage
  751. 33:19into a data l so let me show you click
  752. 33:23on this plus create by the way this is
  753. 33:24also another interview question so you
  754. 33:26can just note it down so I will be
  755. 33:29sharing like lots of interview questions
  756. 33:30as well so do not need to worry just
  757. 33:32take notes
  758. 33:33and be happy and be excited so first of
  759. 33:37all I will just write storage
  760. 33:40account so and just be careful by
  761. 33:44picking the resources because we just
  762. 33:46need to pick the services provided by
  763. 33:47Microsoft because this is a kind of
  764. 33:49marketplace where external providers
  765. 33:51have already put some of the resources
  766. 33:54or Services as third party services but
  767. 33:56we are just using Microsoft on click on
  768. 33:58this and click on Create and then we
  769. 34:02need to pick our Resource Group and as
  770. 34:04we have already created one and as we
  771. 34:07have already picked that Resource Group
  772. 34:09so it is already filled very good now we
  773. 34:12need to use this box to give a storage
  774. 34:15account name first of all the account
  775. 34:17name that I will be using here you
  776. 34:18cannot use it no I'm not just ordering
  777. 34:21you that's the rule because every
  778. 34:23storage account name should be unique
  779. 34:25throughout the Azure Network so you can
  780. 34:28just uh pick a a unique name or you can
  781. 34:30just follow my tip so what I will do I
  782. 34:33will just say data
  783. 34:36Lake and I will just write
  784. 34:39unch yeah it should be
  785. 34:41unique we do not have much on available
  786. 34:44on this
  787. 34:45Earth so it is fine so you can also
  788. 34:48write like data leg and then your name
  789. 34:50anything right so it's up to you then we
  790. 34:54need to pick the region region is fine
  791. 34:57okay then we have two options standard
  792. 34:59versus premium just pick standard now
  793. 35:01one important thing in case of
  794. 35:03redundancy you need to pick lrs now what
  795. 35:06is
  796. 35:07lrs so basically we have data rency
  797. 35:10options available in a lrs means locally
  798. 35:12R storage where data is replicated
  799. 35:15within the same data
  800. 35:17center do you really need to worry about
  801. 35:19this right now no so I'm just giving you
  802. 35:22this knowledge for your sake so we have
  803. 35:24like four different types of rency
  804. 35:25options lrs GRS and then zrs zzz Z zrs
  805. 35:31and gzrs so the most expensive one is
  806. 35:34like
  807. 35:36gzrs and the cheapest one is lrs so I
  808. 35:39will just pick lrs obviously this is a
  809. 35:41free account and obviously we have like
  810. 35:43us $200 but you should be like aware of
  811. 35:46the money that you are spending because
  812. 35:48obviously once you land as a data
  813. 35:50engineer and any organization you should
  814. 35:52be worry about their cost as well right
  815. 35:54so just click on next instead of click
  816. 35:56on review plus create no no no no if I
  817. 35:58just click on this button it will create
  818. 36:01the blob storage and we do not want to
  819. 36:02do that do that we need to create a data
  820. 36:05lake so just click on next and here is
  821. 36:09that thing so when you just check this
  822. 36:13box when you just check this box you are
  823. 36:16actually saying as your that please
  824. 36:19create a data L for us now what is so
  825. 36:23magical in this box that when we check
  826. 36:26it it will create a data l so the thing
  827. 36:27is in data L we can store hierarchial
  828. 36:31folders hierarchial let's say hierarch
  829. 36:35name space means you can just store
  830. 36:36hierarchial folders so let's say let me
  831. 36:39just show you let's say you have a
  832. 36:41container this is your container right
  833. 36:44and within this container you want to
  834. 36:46create a folder and within this folder
  835. 36:48you want to create another folder within
  836. 36:50this folder you need to create another
  837. 36:51folder then you need to save your files
  838. 36:53you can do this and this is called Data
  839. 36:56L when you can just store folders within
  840. 36:58folders and then you can just save your
  841. 36:59files but in case of blob storage you
  842. 37:02cannot do these steps you will just get
  843. 37:06the opportunity to store data within the
  844. 37:08containers only that's it that's it now
  845. 37:12everything is good now you can just
  846. 37:13click on review plus create that was
  847. 37:15really an important interview question
  848. 37:17just note it down and note all the
  849. 37:19questions
  850. 37:20because in the future we will be
  851. 37:23discussing lots of lots of lots of
  852. 37:24questions so not all the equation all
  853. 37:27the question like take notes of all the
  854. 37:28questions so it is deploying our storage
  855. 37:31account as you can see deployment is in
  856. 37:33progress and it should take just few
  857. 37:34seconds and then we will be having our
  858. 37:36full storage account ready and after
  859. 37:38this we will be creating our data Pricks
  860. 37:43account okay let me just refresh
  861. 37:51it okay this is done this is done this
  862. 37:54is done so now we can just go to our
  863. 37:56resource so if you want to go to your
  864. 37:59resource just click on it okay so this
  865. 38:01is your storage account okay do not feel
  866. 38:05overwhelmed do not feel overwhelmed
  867. 38:07because this is just kind of overview or
  868. 38:09you can say summary of our resource so
  869. 38:11we are just concerned with this thing
  870. 38:14containers this is our data Lake we also
  871. 38:16get three more services within the
  872. 38:17storage account but we are not using
  873. 38:19that one like file shares cues tables so
  874. 38:21file share is like a kind of onetop
  875. 38:23solution when you want to share files
  876. 38:25with all the team members and then cues
  877. 38:28is used for like storing messages when
  878. 38:31we are streaming something and then
  879. 38:32tables is for like no SQL or you can say
  880. 38:35store data in the form of key value
  881. 38:37pairs so yeah but we are concerned with
  882. 38:39data L that is continuous click on it
  883. 38:41now we want to create a container why
  884. 38:44why why why because within this
  885. 38:46container we will create a
  886. 38:48folder simple and we can actually create
  887. 38:51two containers two containers why
  888. 38:54because one container will get treated
  889. 38:56as source and second container will get
  890. 38:59treated as the destination or let's say
  891. 39:03will get treated as the solving layer
  892. 39:05because I will show you to create tables
  893. 39:08Delta tables everything so we will
  894. 39:10create two containers one is like you
  895. 39:12can say source and second one will be as
  896. 39:15destination and within these containers
  897. 39:17we will just read and write our data so
  898. 39:19first of all let's create a container
  899. 39:22okay so I will call it as
  900. 39:25Source oh yes perfect source so now I
  901. 39:30have a container called Source I will
  902. 39:31just create another one called
  903. 39:34destination
  904. 39:37okay so source and destination two
  905. 39:39folders are two containers are created
  906. 39:41so now within this Source we have
  907. 39:43nothing we have nothing but we should
  908. 39:46have some data so that's why I will just
  909. 39:50upload one CSV file here right now and
  910. 39:53do not need to worry I will just provide
  911. 39:54the link of this data set in my just
  912. 39:57description of this video and you can
  913. 39:59just download this data set and you can
  914. 40:01also upload this data so I will show you
  915. 40:02how you can do that the step is very
  916. 40:05simple we just need to click on this
  917. 40:07upload
  918. 40:08button that's it and then we will be
  919. 40:11having some data available in data lake
  920. 40:14so now I know you are getting a why what
  921. 40:17we are trying to do we have our real
  922. 40:20data sitting in a your data link and now
  923. 40:24we will read this data we will work with
  924. 40:26this data in data bricks and yes we will
  925. 40:29follow all these steps how we can
  926. 40:31actually do this yes that's why I picked
  927. 40:34a short that's why I pick the short so
  928. 40:36in order to upload let me just upload
  929. 40:37the
  930. 40:40data so as you can see that I have
  931. 40:42uploaded sales. CSU file and you can
  932. 40:44also upload it and I will just provide
  933. 40:46the link in the description so once you
  934. 40:48have uploaded the file just click on
  935. 40:50this upload button that's it see our
  936. 40:52data is uploaded our data is uploaded if
  937. 40:56you want to have a look with the file
  938. 40:59within aure you can do it just click on
  939. 41:00that file and then click on this edit
  940. 41:03button so this is the data do not worry
  941. 41:06this is a comma separated values file
  942. 41:08that is called CSV which is separated by
  943. 41:10comma if you just click on preview
  944. 41:12button you will actually see the data in
  945. 41:15the structured
  946. 41:18format
  947. 41:21see so now you can just see this data so
  948. 41:24this is the kind of preview that are
  949. 41:26that is available in sure so our
  950. 41:29groundwork is ready we have dat ready
  951. 41:31within our aure Network so now it's time
  952. 41:34to actually create the aure databas
  953. 41:36workspace let's do that so in order to
  954. 41:38create aure databas workspace you simply
  955. 41:40need to go on homepage go there then you
  956. 41:44can just click on resource groups just
  957. 41:46select your resource Group that you
  958. 41:49created just now so now then you can
  959. 41:53just click on create button because we
  960. 41:55want to put our data account datab break
  961. 41:58workspace within this Resource Group
  962. 42:00right so simply search datab
  963. 42:03brakes oops datab brakes search it then
  964. 42:08you should select this one as your data
  965. 42:11break which is provided by Microsoft
  966. 42:13just remember this click on this one and
  967. 42:15then click on create button
  968. 42:18simple okay then same steps same steps
  969. 42:22we just need to name our workspace so I
  970. 42:23will just name it as data
  971. 42:27bricks
  972. 42:30master databas master let's let's call
  973. 42:33it databas master so now the thing is
  974. 42:36pricing deer which one you should pick
  975. 42:38so basically you have two options
  976. 42:41premium and dral why I'm not saying
  977. 42:42standard because standard doesn't
  978. 42:44provide you all the uh functionalities
  979. 42:47so basically you can either pick premium
  980. 42:50because you have like 200 cards and if
  981. 42:52you do not have 200 cards you have
  982. 42:54already spent you can just create trial
  983. 42:55premium which is just the trial version
  984. 42:57of the premium available for 14 days it
  985. 43:00anything should work fine so for this I
  986. 43:03I will just pick premium so you can also
  987. 43:05pick premium so here is the thing why we
  988. 43:07need to put this manage Resource Group
  989. 43:09name
  990. 43:11again good question right so the thing
  991. 43:13is this manage Resource Group name is
  992. 43:16not for us then it is for data PRS
  993. 43:20remember we talked about data braks
  994. 43:22manages our clusters everything it
  995. 43:24manages so it will put all those
  996. 43:27resources all those virtual machines
  997. 43:30within this Resource Group and we should
  998. 43:32not touch this Resource Group because
  999. 43:34this is for aure data this is for aure
  1000. 43:37data bre
  1001. 43:38only simple so we will just name it
  1002. 43:40let's say RG uh RG
  1003. 43:45managed DB
  1004. 43:48Master
  1005. 43:50simple BB Master Class like you can name
  1006. 43:53it anything because we will not be using
  1007. 43:55it don't worry don't worry don't worry
  1008. 43:56don't worry don't worry so now we are
  1009. 43:59good to just create this just click on
  1010. 44:00review plus create and then you can just
  1011. 44:03click on create button for one more time
  1012. 44:05and now it will just take few more
  1013. 44:07seconds and your data workspace will be
  1014. 44:09ready and let me tell you you are just
  1015. 44:12few steps away to actually get started
  1016. 44:15with aure data braks or data braks with
  1017. 44:18Azure so once it is deployed I will just
  1018. 44:21show you the user interface I will just
  1019. 44:24give you a walk through with the data
  1020. 44:26works space and then obviously step by
  1021. 44:28step we will be learning each and
  1022. 44:30everything required for your data bricks
  1023. 44:32and yes Delta Lake in detail because you
  1024. 44:36cannot expect working with data bricks
  1025. 44:39without Delta L without Delta L you
  1026. 44:42cannot expect no no no no no so it will
  1027. 44:45take just few more seconds and after
  1028. 44:47that we are good to explore our databas
  1029. 44:50workspace I know you really excited I
  1030. 44:52know I know I was really excited when I
  1031. 44:55was learning this so we can just just
  1032. 44:57check the status here as well so just
  1033. 44:59click on Resource Group select your
  1034. 45:01resource
  1035. 45:03Group and
  1036. 45:04then here is our data breakes Master
  1037. 45:07Class ready it is ready when you just
  1038. 45:10click on
  1039. 45:13it so here this button is missing which
  1040. 45:16is launch workspace that means it is
  1041. 45:19taking some few more seconds to created
  1042. 45:21once it is ready we can just click on it
  1043. 45:23so just wait for a few more just just
  1044. 45:25wait just take a chill Pell
  1045. 45:28just take a chill pill I'm just
  1046. 45:29refreshing my page as you can see
  1047. 45:31deployment is in progress so yeah we
  1048. 45:33know that and we are waiting so you just
  1049. 45:36need to wait for a few more seconds and
  1050. 45:38once it is done we will just kickart our
  1051. 45:40datab journey
  1052. 45:42so it is deployed so now I'm really
  1053. 45:46excited to hit this button that is
  1054. 45:48launch workspace because this will take
  1055. 45:50us to datab break workspace so without
  1056. 45:53wasting a time let's click on this
  1057. 45:57so this is your first aure data breaks
  1058. 46:01workspace so you're finally working with
  1059. 46:05Cloud oh oh oh okay okay okay okay okay
  1060. 46:09so this is your your data breakes
  1061. 46:13homepage how is it if your if this is
  1062. 46:16your first data break workspace
  1063. 46:18obviously it is like full
  1064. 46:20of questions and at the same time full
  1065. 46:23of excitement as well so do not need to
  1066. 46:26worry because is in the coming
  1067. 46:28sessions or let's say in the next few
  1068. 46:32more minutes you will be well wor with
  1069. 46:35each and everything available in data do
  1070. 46:38not need to worry at all so let me give
  1071. 46:42you a walkth through first of all what
  1072. 46:44is this what is this left pain so it is
  1073. 46:49everything so just kidding so this is
  1074. 46:51your workspace so basically workspace
  1075. 46:56you can just create different different
  1076. 46:58workspaces within datab Brak workspace
  1077. 47:00let's say you want to
  1078. 47:01store um you you want to keep uh data
  1079. 47:07let let me just click on it and let me
  1080. 47:09just show you because that will be
  1081. 47:10better for you to learn instead of just
  1082. 47:13giving you theoretical knowledge so this
  1083. 47:15is your let's say datab Bri workspace
  1084. 47:18within this datab bre workspace you can
  1085. 47:20click on this button this there's a drop
  1086. 47:22down and you can actually create
  1087. 47:25workspaces
  1088. 47:27and workspace is nothing but a kind of
  1089. 47:29you can say repository where you can
  1090. 47:31just actually store the
  1091. 47:33notebooks simple yeah and how you can
  1092. 47:36create it it is very simple let me show
  1093. 47:37you simply click on this workspace
  1094. 47:39button and it will just show you repos
  1095. 47:41shared users just click on this drop
  1096. 47:43down you will see nothing but just click
  1097. 47:46on this create button and then you have
  1098. 47:49these options available but as I just
  1099. 47:53said that first we will create folders
  1100. 47:55because folders are really really handy
  1101. 47:57whenever we want to do something so we
  1102. 48:00can also create notebook we can also
  1103. 48:02create dashboard we can also like create
  1104. 48:04so many things directly within the
  1105. 48:06workspace but it is a recommended
  1106. 48:08approach that we we should first create
  1107. 48:10the folder and then within that folder
  1108. 48:11we should create these resources so
  1109. 48:14first of all I will just click on folder
  1110. 48:16and I will name it as data brakes
  1111. 48:19workspace or let's say master
  1112. 48:22class data breaks Master Class simple um
  1113. 48:26it's to long but yeah it's fine click on
  1114. 48:29create button simple now you can see
  1115. 48:32that if workspace is created data bricks
  1116. 48:34master class now you can create
  1117. 48:36notebooks and different different stuff
  1118. 48:38within this particular folder yes we
  1119. 48:40will create it let me just give you a
  1120. 48:42work through with all the things as well
  1121. 48:45then we have recent stab so recent tab
  1122. 48:47is recent tab is like really handy when
  1123. 48:49you want to open something that you have
  1124. 48:52recently opened so this will just show
  1125. 48:54you everything and for now if I just
  1126. 48:56click on it uh it will just show me
  1127. 48:58nothing because I haven't opened
  1128. 48:59anything then within the catalog tab so
  1129. 49:04basically when we just click on this
  1130. 49:06catalog button it shows us like all the
  1131. 49:08data catalog all the uh let's
  1132. 49:12say data basically data catalog is like
  1133. 49:16one stop solution for your all the
  1134. 49:19metadata metadata is like data about
  1135. 49:21data so all those things like data types
  1136. 49:23table schema database everything Under
  1137. 49:27One Roof that is called like data
  1138. 49:28catalog so you can just monitor each and
  1139. 49:30everything from this tab if I just click
  1140. 49:33on workflow so workflows
  1141. 49:35is a feature that allows us to
  1142. 49:38orchestrate our notebooks within data
  1143. 49:40break so we can just orchestrate we can
  1144. 49:42just run our notebooks after like in a
  1145. 49:45sequence or in a flow using datab break
  1146. 49:47workflows then then then then the very
  1147. 49:51important thing which is this compute
  1148. 49:53button what is this compute button so
  1149. 49:55basically we talked about cluster right
  1150. 49:58so now this
  1151. 50:00compute button or let's say let's this
  1152. 50:03compute tab this create compute button
  1153. 50:07will allow us to create a cluster yes
  1154. 50:10this will allow us to create a cluster
  1155. 50:12and we just need to configure it and
  1156. 50:14everything will be managed by data brex
  1157. 50:16itself that's it this is so so so good
  1158. 50:19so we will do it just just hold on hold
  1159. 50:21on hold on then we have like tabs such
  1160. 50:23as CQ data engineering machine learning
  1161. 50:25so these are some of the pack packages
  1162. 50:27that we have available under every tab
  1163. 50:29so if you are like more inclined towards
  1164. 50:31data engineering then it will just show
  1165. 50:33us these things like data inje it will
  1166. 50:34show us the connectors and in case of
  1167. 50:37machine learnings it will just give us
  1168. 50:38some of the these model buildings and
  1169. 50:41these let's say machine learning model
  1170. 50:43building capabilities so it has give you
  1171. 50:46a customized tab as well so you can just
  1172. 50:49focus on these Services align to your
  1173. 50:52role simple then we have Marketplace so
  1174. 50:56this Market places like third party uh
  1175. 50:58connectors or let's say third party
  1176. 51:00services that you can use within datax
  1177. 51:03then at the end we have partner connect
  1178. 51:05this is very handy because whatever data
  1179. 51:08whatever data lak house you will be
  1180. 51:09building within data brakes you can
  1181. 51:11actually connect with the third party
  1182. 51:13Solutions let's say I will click on part
  1183. 51:15partner connect and I will see like bi
  1184. 51:17tools such as this cross this such as
  1185. 51:21you can say powerbi table click view so
  1186. 51:24you can actually connect with these
  1187. 51:26third party Solutions and at the end I I
  1188. 51:29think I can just show you like how you
  1189. 51:30can just connect this once we have like
  1190. 51:32everything set up so you can just
  1191. 51:34efficiently create uh create your powerb
  1192. 51:37dashboards T dashboards connecting your
  1193. 51:39data within the data bricks so
  1194. 51:41everything is available Under One Roof
  1195. 51:43and that's why data brakes is very much
  1196. 51:45in demand yes that is the sole reason so
  1197. 51:50now I want to create cluster I want to
  1198. 51:52create cluster so I will simply go to
  1199. 51:54compute Tab and I will just click on
  1200. 51:56this compute but I will create create a
  1201. 51:58cluster so to create a cluster simply
  1202. 52:00click on this compute button and just
  1203. 52:02need to click on create compute this
  1204. 52:04step is very important and this is not a
  1205. 52:06rocket science but still like you should
  1206. 52:09be aware of this step as well so first
  1207. 52:12of all we will pick the policy first
  1208. 52:15first of all first of all you can just
  1209. 52:16rename your cluster but I just like to
  1210. 52:18keep this name like an lambas cluster
  1211. 52:21you can just like name it anything but I
  1212. 52:23do like this thing but you can just
  1213. 52:24click on this pencil button you can just
  1214. 52:26change it as well do not need to worry
  1215. 52:29about anything till the time you are on
  1216. 52:32my channel so click on this policy I
  1217. 52:34will keep it as unrestricted so here are
  1218. 52:39the thing like multi- node and single
  1219. 52:41node for this particular master class we
  1220. 52:44do not need multi nodes because we are
  1221. 52:47not processing large amount of data but
  1222. 52:49in real world you will just click on
  1223. 52:50Multi node but for now you can just
  1224. 52:51click on single node this will not
  1225. 52:54affect your learning because we are not
  1226. 52:55managing any clust I told you data
  1227. 52:57brakes manages everything for us click
  1228. 52:59on single node then access mode is
  1229. 53:02single user single user access done then
  1230. 53:05databas run time okay let's pick one
  1231. 53:07data breas run time so I can just pick
  1232. 53:09this 14.3 LTS that is for long time
  1233. 53:11support and I have like worked with this
  1234. 53:14run time like so many times so it is
  1235. 53:16good so then we have like Photon
  1236. 53:18acceleration there's no need to check
  1237. 53:20this then node type node type we will
  1238. 53:23just keep the basic node with in which
  1239. 53:25we have like four course so I will pick
  1240. 53:27DS3 V2 14gb memory that is enough now
  1241. 53:30what is this terminate after button so
  1242. 53:32basically we do not want our cluster to
  1243. 53:34run for 2 hours that is for like 120
  1244. 53:36Minutes like if our cluster is inactive
  1245. 53:39for 120 minutes and after that it will
  1246. 53:42be disabled automatically but we need to
  1247. 53:44cut this time we can just say only 30
  1248. 53:47minutes of inactivity is enough if I'm
  1249. 53:50inactive for like 30
  1250. 53:52minutes BR what you are doing brow yeah
  1251. 53:56so so if I'm just inactive for like 30
  1252. 53:58minutes it can disable my cluster to
  1253. 54:00save my cost obviously for now we do not
  1254. 54:02need to worry about cost but in real
  1255. 54:04world you should be aware of this step
  1256. 54:05as well because at the end you can make
  1257. 54:08a lot of impact if you are saving a lot
  1258. 54:10of
  1259. 54:12money for the organization so tags we
  1260. 54:15are good now it's simple it's done just
  1261. 54:17click on create compute done it will
  1262. 54:20take like few minutes to create our
  1263. 54:21cluster so as you can see it is rotating
  1264. 54:26so once it is done we will see one green
  1265. 54:28button that is also called as online
  1266. 54:31button but yeah in this world in spark
  1267. 54:33world we have like cluster is ready that
  1268. 54:36means it is green so once it is green
  1269. 54:39like meanwhile we can do one thing we
  1270. 54:41can just create our notebook we can
  1271. 54:43create our notebook yeah so how we can
  1272. 54:45create it simply go to
  1273. 54:47workspace and just select your workspace
  1274. 54:50by clicking on this button and just
  1275. 54:52click on your workspace that you have
  1276. 54:54created and then just click on this
  1277. 54:57create button click on this create
  1278. 54:58button and this time we want to create a
  1279. 55:01notebook okay
  1280. 55:03yeah so this will open a canvas in which
  1281. 55:08we will be seeing notebook and if this
  1282. 55:10is your first notebook then you will
  1283. 55:12have lots of questions so yeah that's
  1284. 55:14good that's good so wow this is our
  1285. 55:17notebook this is our notebook this is
  1286. 55:19our notebook don't worry don't worry
  1287. 55:22don't worry I'm here to answer your all
  1288. 55:23the questions so first thing first just
  1289. 55:26rename your notebook because you will
  1290. 55:28forget it when you will be just coding
  1291. 55:31it and after some time you will see Hey
  1292. 55:33where's my notebook and I don't know and
  1293. 55:35then you will you would need to just
  1294. 55:37check all the notebooks manually and I
  1295. 55:39don't know I I don't want that so first
  1296. 55:41of all just click on this
  1297. 55:43and just press backspace and then you
  1298. 55:47can just give any name let's say I want
  1299. 55:49to give
  1300. 55:53tutorial simple hit enter now your
  1301. 55:56notbook is named as tutorial simple
  1302. 55:59simple simple so first of all what is
  1303. 56:00this file button so basically datab
  1304. 56:03braks allows us so many options like we
  1305. 56:05can just create new notebook obviously
  1306. 56:07we can import a notebook as well yes if
  1307. 56:09you already have a notebook saved okay
  1308. 56:13so what does it mean so basically I will
  1309. 56:15just provide the link of this notebook
  1310. 56:18of my notebook as well so if you want to
  1311. 56:20refer it you can simply click on import
  1312. 56:22and that's it you can have my notebook
  1313. 56:25in your workspace C then you have like
  1314. 56:28share schedule CH defa sell language we
  1315. 56:32will just talk about it don't worry then
  1316. 56:33we have clone if you want to clone your
  1317. 56:35notebook then rename obviously we
  1318. 56:37there's a there's I think better way to
  1319. 56:40do it directly from here then export
  1320. 56:42what is what does this mean export now
  1321. 56:45when I will be uploading my notebook in
  1322. 56:47my GitHub repository I will use this
  1323. 56:49option I will use this option so I can
  1324. 56:52export my notebook into my personal
  1325. 56:56computer and I can just share it with
  1326. 56:58anyone I can even export the whole
  1327. 57:00folder let me just show you let me just
  1328. 57:02click on it so now as you can see DBC
  1329. 57:05archive source
  1330. 57:08file python notebook
  1331. 57:11HTML so you can create anything you want
  1332. 57:14so DBC archive means I can just download
  1333. 57:18this DBC archive so whenever you want to
  1334. 57:20import a notebook you can just click on
  1335. 57:22this and it will open it in the datab
  1336. 57:25briak workspace
  1337. 57:26right and this IPython notebook you can
  1338. 57:29just uh open this notebook in any IDE
  1339. 57:33let's say Jupiter or anything but DB
  1340. 57:36kive is really good let me just click on
  1341. 57:37this import button then you will know
  1342. 57:39when you click on import then obviously
  1343. 57:42when you will click on browse you can
  1344. 57:44either pick DRC or any I python notebook
  1345. 57:46do not need to worry I will just provide
  1346. 57:48the link and you can just click on
  1347. 57:49import and you can just download my
  1348. 57:51notebook from GitHub repository and then
  1349. 57:53you can just upload using my notebook
  1350. 57:55and and obviously using your PC simple
  1351. 57:59so this was all about
  1352. 58:01file now what is this edit button so
  1353. 58:04basically like delete cell insert cell
  1354. 58:06select cell and do not need to worry
  1355. 58:08because we do not use this edit tab to
  1356. 58:12run the cell to delete it we just use
  1357. 58:14the shortcuts and I will tell you what
  1358. 58:15are those shortcuts now this view but
  1359. 58:18button is very important for some so the
  1360. 58:21best feature of this button is like
  1361. 58:23editor theme not editor theme workspace
  1362. 58:25theme if if you want to use dark theme
  1363. 58:27you can just click on it and you will
  1364. 58:29have dark theme but I do like dark theme
  1365. 58:32but while working with data Bri I like
  1366. 58:34White theme it's up to you if you want
  1367. 58:36to keep it dark you can keep it dark but
  1368. 58:38I really like light theme while working
  1369. 58:40with data I don't know why but yeah it
  1370. 58:43is what it is simple and then this was
  1371. 58:46all about like some some of the basic
  1372. 58:48things that you should see in the
  1373. 58:49notebooks and now now now now what is
  1374. 58:52this connect button so basically
  1375. 58:54whenever you run your notebooks you
  1376. 58:56should connect your notebooks to a
  1377. 58:58cluster because obviously whatever code
  1378. 58:59you will be writing you need some
  1379. 59:01computation to actually access your code
  1380. 59:04simply click on this connect button and
  1381. 59:06it will show all the available clusters
  1382. 59:08right now so as you can see my cluster
  1383. 59:10is also ready it it is showing green and
  1384. 59:12I can simply click on it and it will
  1385. 59:14connect my cluster connect my notebook
  1386. 59:16with the cluster simple now I can just
  1387. 59:18write anything I can just run anything
  1388. 59:21and everything will be run by this
  1389. 59:22cluster these machines in this case this
  1390. 59:24machine because there is single LOE
  1391. 59:27simple simple so this was an overview of
  1392. 59:31data Pricks notebook now it's time to
  1393. 59:36create chapters yeah chapters because it
  1394. 59:39will be really handy when you will be
  1395. 59:40creating chapters so what is the chapter
  1396. 59:42number one okay let me show you so the
  1397. 59:45chapter number one is Magic commands and
  1398. 59:49why we call it as like magic commands
  1399. 59:52what is the magic Behind These commands
  1400. 59:54and what are these commands
  1401. 59:58so basically as we all know as we just
  1402. 1:00:01talked about that we can just use
  1403. 1:00:02multiple languages within databas
  1404. 1:00:05notebook we didn't talk about it I know
  1405. 1:00:08so the thing is we can use multiple
  1406. 1:00:10languages within the databas notebook
  1407. 1:00:13yes you can use Python you can use SQL
  1408. 1:00:17you can use R I personally hate
  1409. 1:00:21R you can use MD what is MD MD is also
  1410. 1:00:25called called as markdown which is very
  1411. 1:00:27handy when you want to create headings
  1412. 1:00:29subheadings titles within those notebook
  1413. 1:00:31cells then FS file system there are like
  1414. 1:00:34much more magic commands so why we call
  1415. 1:00:36them as magic command so basically let's
  1416. 1:00:39say this is your cell we just saw like
  1417. 1:00:41how cell looks like let's say in this
  1418. 1:00:44cell you want to use Python okay and
  1419. 1:00:49then you want to use SQL you can use
  1420. 1:00:51this magic command you can use this
  1421. 1:00:54magic command
  1422. 1:00:56you can just switch among different
  1423. 1:00:58different languages like
  1424. 1:01:00this like this so you do not need to
  1425. 1:01:03change the default language every time
  1426. 1:01:06we just saw default language right now
  1427. 1:01:07we are just going to cover that as well
  1428. 1:01:09so there's a default language written
  1429. 1:01:11here for all these CS by default it keep
  1430. 1:01:13it as python because ppar is a very
  1431. 1:01:15popular uh API right now and everyone
  1432. 1:01:18prefers writing P code in pypar which is
  1433. 1:01:21python API of spark so it shows python
  1434. 1:01:24by default so by default def it will
  1435. 1:01:26execute our code in Python language but
  1436. 1:01:29let's say in this said you want to
  1437. 1:01:30execute a code in SQL you can instead of
  1438. 1:01:32changing your default language every
  1439. 1:01:34time you can just use magic command and
  1440. 1:01:36it will do magic for you it will just
  1441. 1:01:39treat it as your SQL
  1442. 1:01:41command simple let's cover these magic
  1443. 1:01:44commands first let's let's let's see
  1444. 1:01:47so so I'm in my databas notebook so the
  1445. 1:01:51default language I was talking about is
  1446. 1:01:52this one python it is already written
  1447. 1:01:55python in your scenario as well it is
  1448. 1:01:56python now someone among like someone
  1449. 1:01:59from you like will say hey if I just
  1450. 1:02:01want to change my default language yeah
  1451. 1:02:03you can do that how you can just click
  1452. 1:02:05on this file
  1453. 1:02:07button and here you can see this change
  1454. 1:02:10default cell language this one and when
  1455. 1:02:14you click on it it will show you python
  1456. 1:02:16equal Scala R so some of you like will
  1457. 1:02:18prefer doing coding is Scala I'm not a
  1458. 1:02:21fan of Scala I just like python mode so
  1459. 1:02:24it's up to you so by default it gives us
  1460. 1:02:26the option as python so if you want to
  1461. 1:02:27change it you can just change it from
  1462. 1:02:28here so then it will just show here
  1463. 1:02:30Scala or r or SQL if you want to change
  1464. 1:02:33it so if I just write anything let's say
  1465. 1:02:35I want to write any python code
  1466. 1:02:37print hello sir then if I run it now
  1467. 1:02:41another shortcut key if you want to run
  1468. 1:02:43the cell there are two ways so basically
  1469. 1:02:45you can just run it from here as well
  1470. 1:02:47like by going to edit and then just run
  1471. 1:02:49cell every time so other way of doing it
  1472. 1:02:52just click on shift plus enter just just
  1473. 1:02:54press shift plus enter
  1474. 1:02:57yeah it it ran yeah it is running see it
  1475. 1:03:01is running yeah and it print it it gave
  1476. 1:03:03me the output as well hello sir simple
  1477. 1:03:06and you saw by default it ran my code AS
  1478. 1:03:10under like Python language now if I just
  1479. 1:03:14run something like let's say I want to
  1480. 1:03:16run a SQL command so I can just type
  1481. 1:03:18percentage SQL and default language is
  1482. 1:03:21still python now it is changed because
  1483. 1:03:23it recognized it because I wrot magic
  1484. 1:03:25command this is this is the magic so if
  1485. 1:03:28I just type select
  1486. 1:03:30hello
  1487. 1:03:32sir that's it if I run it it will return
  1488. 1:03:36me a table like hello sir column name
  1489. 1:03:38and value is hello sir simple see this
  1490. 1:03:40is this is the magic this is the magic
  1491. 1:03:42that it does this is the magic now I
  1492. 1:03:45know you are really excited to uh try MD
  1493. 1:03:48what is MD so MD is a markdown first of
  1494. 1:03:50all let me write percentage MD so if I
  1495. 1:03:53just write anything if I want to create
  1496. 1:03:55a heading it gave me so many options
  1497. 1:03:56like heading one heading two heading
  1498. 1:03:58three bardic everything if I just want
  1499. 1:04:00to make a heading let's say H1 it will
  1500. 1:04:03add one hashtag and if I just write
  1501. 1:04:05anything let's say data
  1502. 1:04:09bricks
  1503. 1:04:11data bricks master
  1504. 1:04:14class and the same way you can run it
  1505. 1:04:17Shi plus enter see you can just create a
  1506. 1:04:20heading and under this heading you can
  1507. 1:04:22just create sales and I know now you
  1508. 1:04:25know why it is important because it
  1509. 1:04:28promotes readability of the notebook you
  1510. 1:04:31would know which cell is doing what it
  1511. 1:04:34is like adding comment but with better
  1512. 1:04:37UI you can even add text something like
  1513. 1:04:40this like percentage MD wait wait wait
  1514. 1:04:42percentage
  1515. 1:04:44MD and then you can just say I want to
  1516. 1:04:47make any text bold without making a
  1517. 1:04:50bigger heading so let's
  1518. 1:04:51say data reading let's say so it will
  1519. 1:04:56create a title simple and if you want to
  1520. 1:05:00create a heading of different size so
  1521. 1:05:02just click on it and let me hit enter
  1522. 1:05:04let's say heading two I will say data
  1523. 1:05:08bricks it will create a heading of a
  1524. 1:05:10little bit smaller size see heading
  1525. 1:05:13to you can do anything like you want and
  1526. 1:05:16it's up to you like how you want to
  1527. 1:05:18create your notebooks how you want to
  1528. 1:05:20keep the readability of your notebook
  1529. 1:05:23and obviously more the readability
  1530. 1:05:25better the performance because whenever
  1531. 1:05:27you will be revisiting your notebooks
  1532. 1:05:29you can easily debug your code so it's
  1533. 1:05:31not about the performance of The
  1534. 1:05:34Notebook but it's like your uh your
  1535. 1:05:36personal performance so let me just
  1536. 1:05:38remove it so this was all about magic
  1537. 1:05:41commands let me just run it because I
  1538. 1:05:43want to keep it yeah that was all about
  1539. 1:05:45magic commands so now I want you to
  1540. 1:05:49create your Force data frame using your
  1541. 1:05:51own customized data yeah you can do that
  1542. 1:05:54so obviously we create data frame on top
  1543. 1:05:56of the data setting in the data lake so
  1544. 1:05:58what do I mean let's say this is our
  1545. 1:05:59data
  1546. 1:06:01Lake and this is our data Lake container
  1547. 1:06:05obviously we create data
  1548. 1:06:09frame on top of this data but you can
  1549. 1:06:13also create data frame like with
  1550. 1:06:15customized data with the data that you
  1551. 1:06:17want to put and for that you do not need
  1552. 1:06:20to read any data and how you can create
  1553. 1:06:22it it is very simple first of all you
  1554. 1:06:24need to create one data it like simple
  1555. 1:06:26data a list of tles or list of record
  1556. 1:06:30simple I will create a list and I will
  1557. 1:06:32say like one and then name one is my ID
  1558. 1:06:36AA is my name and then I want to put
  1559. 1:06:39their marks let's say 30 I know it's
  1560. 1:06:42less but still let's keep it oh so datab
  1561. 1:06:45Brak has all so this that is the reason
  1562. 1:06:47I love datab Brak so it monitors our
  1563. 1:06:50code continuously as we are writing so
  1564. 1:06:53it has identified a pattern that I'm
  1565. 1:06:55using this kind of pattern so it has
  1566. 1:06:57given me suggestion see that I can use
  1567. 1:07:00these things I love data so I will just
  1568. 1:07:03write two and I can just click on Tab
  1569. 1:07:06button to just fill the data no I don't
  1570. 1:07:09want more data I just want three records
  1571. 1:07:11thank you so much for your help so now I
  1572. 1:07:13can just Define schema so how you can
  1573. 1:07:15Define schema schema basically is like
  1574. 1:07:18the column names and the data types
  1575. 1:07:19simple so in our scenario we have three
  1576. 1:07:22columns like one is ID
  1577. 1:07:25then we have name and then their Mark
  1578. 1:07:29simple so I will Define I will call it
  1579. 1:07:31as my
  1580. 1:07:32data my
  1581. 1:07:35data and I will call it as my
  1582. 1:07:39schema simple and how we can do it just
  1583. 1:07:42use a string and let's say ID own he's
  1584. 1:07:45so smart but not 100% because it has
  1585. 1:07:48suggested me a column with age and by
  1586. 1:07:50the way it is not age it is
  1587. 1:07:52marks obviously how does it know so
  1588. 1:07:55simple so this is our groundwork for it
  1589. 1:07:59and we just need to use a function
  1590. 1:08:02called create data frame let me write it
  1591. 1:08:04for you it's create data frame this
  1592. 1:08:08function helps us to create our own data
  1593. 1:08:10frame using our customized data so I can
  1594. 1:08:13simply say DF equals to spark dot create
  1595. 1:08:17data frame see it gave me suggestions
  1596. 1:08:20okay okay it gave me some more
  1597. 1:08:21suggestions okay okay we do not need
  1598. 1:08:23your suggestion let me let me let me
  1599. 1:08:24provide the knowledge okay my
  1600. 1:08:26data comma schema equals to my
  1601. 1:08:32schema simple so as you can see let me
  1602. 1:08:36just make it a little bit
  1603. 1:08:38zoomed not this much yeah this much is
  1604. 1:08:40an yeah so as you can see that I have
  1605. 1:08:44provided the schema here and my data
  1606. 1:08:48here now I just want to run it and how
  1607. 1:08:51you can run it shift plus enter I won
  1608. 1:08:53repeat this because I have already
  1609. 1:08:54repeated this so many times so you
  1610. 1:08:56should remember it so if you want to
  1611. 1:08:58display your data how you can display
  1612. 1:09:00your data so there's a function called
  1613. 1:09:03display display and then you can just
  1614. 1:09:06write your DF you can just encapsulate
  1615. 1:09:08your DF inside this or there's another
  1616. 1:09:10way called DF dot
  1617. 1:09:14display the suggested way is this
  1618. 1:09:18but I don't know I like using this it's
  1619. 1:09:22up to you I'm just kidding so yeah that
  1620. 1:09:24I'm not kidding about this justed I
  1621. 1:09:25suggested as the previous one because it
  1622. 1:09:26is very handy when you want to build
  1623. 1:09:28visualizations yes yeah you you you can
  1624. 1:09:31just build visualizations as well I will
  1625. 1:09:33show you don't worry bro don't worry
  1626. 1:09:34just just stay calm just stay here so I
  1627. 1:09:37can just run this command and then you
  1628. 1:09:40should see your data frame this is your
  1629. 1:09:41first data frame that you have created
  1630. 1:09:43in data breaks 1 a a 30 2 BB 40 3
  1631. 1:09:50cc50 simple simple simple simple this is
  1632. 1:09:52your like data frame like columns
  1633. 1:09:55records and everything this is your
  1634. 1:09:56customized data frame that you have
  1635. 1:09:58created using your own data and now it's
  1636. 1:10:02time to jump on the chapter 2 in which
  1637. 1:10:05we'll be covering much more than the
  1638. 1:10:07basics and yes let's start with that now
  1639. 1:10:12let's discuss this chapter so this is a
  1640. 1:10:15part of that chapter so dbfs what is
  1641. 1:10:18this dbfs this is really really
  1642. 1:10:20important concept so basically dbfs
  1643. 1:10:24stands for
  1644. 1:10:29data
  1645. 1:10:31breaks file system
  1646. 1:10:34okay what's that that sounds fancy but
  1647. 1:10:37what's that datab braak file system so
  1648. 1:10:40basically let me give you a scenario so
  1649. 1:10:44our data is in the Raw container as we
  1650. 1:10:47know right and I'm telling you how you
  1651. 1:10:50can access it but before that just think
  1652. 1:10:52so this is in a container right this is
  1653. 1:10:55in a container and this is the data
  1654. 1:10:59L this is the oh my hand
  1655. 1:11:04writing this is data
  1656. 1:11:08Lake right this is data lake so if you
  1657. 1:11:12want to access this data if you want to
  1658. 1:11:15access this data you need to provide the
  1659. 1:11:18URL you need to
  1660. 1:11:21provide
  1661. 1:11:23URL simple see
  1662. 1:11:26to access this data because obviously
  1663. 1:11:28you need to give the URL where the data
  1664. 1:11:30is residing right in which container and
  1665. 1:11:32which storage account so instead of
  1666. 1:11:35providing that URL again and again dbfs
  1667. 1:11:39that's datab Brak file system is
  1668. 1:11:42basically a distributed file system
  1669. 1:11:45which acts as an abstraction layer which
  1670. 1:11:48acts as an abstraction layer what does
  1671. 1:11:51it mean so it will create an abstraction
  1672. 1:11:58layer like this
  1673. 1:12:03see like this now this is an abstraction
  1674. 1:12:08layer on top of the data L this is my
  1675. 1:12:11abstraction
  1676. 1:12:14layer see now this will create an
  1677. 1:12:18abstraction layer so what does it mean
  1678. 1:12:21instead of providing URL we can use file
  1679. 1:12:26semantics let me repeat we can
  1680. 1:12:30use file
  1681. 1:12:33semantics what are file semantics so
  1682. 1:12:37file semantics are similar to file
  1683. 1:12:38system so instead of writing URL you can
  1684. 1:12:44write something like this file
  1685. 1:12:49store then your container let's say raw
  1686. 1:12:53and then your let's file. CSV
  1687. 1:12:56anything so instead of writing URLs you
  1688. 1:12:59can use these semantics you can use
  1689. 1:13:02these semantics that's called
  1690. 1:13:05dbfs so you do not need to provide the
  1691. 1:13:08full URS actually you can point your
  1692. 1:13:10data to this thing but this is just an
  1693. 1:13:12abstraction layer this is just an
  1694. 1:13:14abstraction layer the actual data is
  1695. 1:13:17residing in data Lake but it will act as
  1696. 1:13:20it is residing in this particular folder
  1697. 1:13:22in your data bricks notebook
  1698. 1:13:25this is very handy because you do not
  1699. 1:13:27need to provide URLs again and again and
  1700. 1:13:29obviously you do not need to
  1701. 1:13:32uh I think devote much time to find data
  1702. 1:13:35as well because you can just go to file
  1703. 1:13:36store folder and you can just get to
  1704. 1:13:38know like where data is
  1705. 1:13:39residing simple this is dbfs data break
  1706. 1:13:43file system or distributed file
  1707. 1:13:46system yes this was all about dbfs this
  1708. 1:13:50is really important and yes when we are
  1709. 1:13:53just reading data and we can and we want
  1710. 1:13:56to just use the file systems or you can
  1711. 1:13:58say folders We can just use file system
  1712. 1:14:00dbfs it's your personal choice if you
  1713. 1:14:02want to use uh like my responsibility is
  1714. 1:14:05to just give you all the information I
  1715. 1:14:07personally like using URLs I don't know
  1716. 1:14:09why but yeah you have the uh option
  1717. 1:14:13available to use these file semantics to
  1718. 1:14:16read the data from the data bricks or
  1719. 1:14:19let's say read the data from the data
  1720. 1:14:21bricks but that data is residing in the
  1721. 1:14:23data like actually it is residing in
  1722. 1:14:25data
  1723. 1:14:26Lake understood I hope you are just
  1724. 1:14:29taking notes of these
  1725. 1:14:31things yes yes yes just take notes and
  1726. 1:14:35that's where we have another concept
  1727. 1:14:37called mounting so what does that mean
  1728. 1:14:40so we just Mount the external location
  1729. 1:14:42and we we create the dbfs on top of it
  1730. 1:14:45so that we can just use the same things
  1731. 1:14:47do not worry we will discuss everything
  1732. 1:14:49in detail so this was all about dbfs so
  1733. 1:14:52now it's time to cover another another
  1734. 1:14:55thing which is accessing the data from
  1735. 1:14:59data breaks and data is in our data Lake
  1736. 1:15:04okay this this is the major step and
  1737. 1:15:06this is the step I think that you should
  1738. 1:15:09be aware of if you want to be an outlier
  1739. 1:15:12in the
  1740. 1:15:13crowd yes because that is the sole point
  1741. 1:15:17I have picked as your because you need
  1742. 1:15:19to be proficient enough to actually
  1743. 1:15:22perform the step so now let me just EXP
  1744. 1:15:24explain you this with the simplest
  1745. 1:15:26example or this with like how with the
  1746. 1:15:29let's say simplest analogy so this is
  1747. 1:15:32your datab Bri workpace right and we
  1748. 1:15:33have a notebook created in this datab
  1749. 1:15:35workspace and you want to read the data
  1750. 1:15:37sitting in this data L and we have
  1751. 1:15:39already created the container right how
  1752. 1:15:42you can read the data sitting in this
  1753. 1:15:45data Lake
  1754. 1:15:46how you will say I want to read I know
  1755. 1:15:49but this data is in
  1756. 1:15:53Azure this data is in aure data Lake
  1757. 1:15:56this data is secured not everyone can
  1758. 1:15:59access it it is not available for
  1759. 1:16:02everyone how this data briak workspace
  1760. 1:16:05can read it let me tell you this is
  1761. 1:16:09exactly same as we follow the steps in
  1762. 1:16:12real life how let me tell you so let's
  1763. 1:16:15say if you want to enter into a college
  1764. 1:16:19bro from where we have included College
  1765. 1:16:21just hold on because that's the simplest
  1766. 1:16:23analogy so
  1767. 1:16:25if you enter into a
  1768. 1:16:28college not enter you want to enter like
  1769. 1:16:31you want to just uh enter into your
  1770. 1:16:33college or let's say to attend your
  1771. 1:16:36class so this is your college and this
  1772. 1:16:39is
  1773. 1:16:40you this is you
  1774. 1:16:44right and this college is not a public
  1775. 1:16:48park similarly this data leg is not a
  1776. 1:16:51public like data available for public
  1777. 1:16:54this is
  1778. 1:16:55secured and here they have a security
  1779. 1:16:58guard
  1780. 1:17:00right it's fun man but it's really
  1781. 1:17:03helpful to for you to understand it and
  1782. 1:17:06they have a security guard they have a
  1783. 1:17:08stick as well in the hand
  1784. 1:17:11okay so here they have a security guard
  1785. 1:17:14you try
  1786. 1:17:17to go there enter there and it stops you
  1787. 1:17:22it stops you why he says
  1788. 1:17:25show me your ID
  1789. 1:17:27card he says show me your ID card and
  1790. 1:17:29you say I do not have this ID card let's
  1791. 1:17:34say you say this you do not have this ID
  1792. 1:17:37card so it will ask you just go back
  1793. 1:17:41just go
  1794. 1:17:43back then similarly data braks will go
  1795. 1:17:46to this data Lake data L will say hey
  1796. 1:17:50show me your ID card show me something
  1797. 1:17:52that you are eligible to read my data
  1798. 1:17:55he will say I do not have
  1799. 1:17:58anything he will say okay then go back
  1800. 1:18:03then go back but but but this time he
  1801. 1:18:09says I have this ID card this is a let's
  1802. 1:18:13suppose this is an ID card he says hey
  1803. 1:18:15this time I have an ID card then it will
  1804. 1:18:18say okay you can read my data you are
  1805. 1:18:21welcome understood so how we can get
  1806. 1:18:24give this particular ID
  1807. 1:18:26card to our datab break so we will
  1808. 1:18:29include something called service
  1809. 1:18:32principle
  1810. 1:18:35oops service principle so we will
  1811. 1:18:39include something called as service
  1812. 1:18:41principle which is a kind of an
  1813. 1:18:43application which is kind of an
  1814. 1:18:49application which have the access to
  1815. 1:18:52read this
  1816. 1:18:53data which
  1817. 1:18:55have the access to read this data this
  1818. 1:18:58data this data this has the access this
  1819. 1:19:00is an our
  1820. 1:19:01application and how we will give this
  1821. 1:19:03access I will show you there's a way to
  1822. 1:19:05do that so once this has the eligibility
  1823. 1:19:09or access to read this data we will use
  1824. 1:19:11this key in our datab break workspace
  1825. 1:19:14here and then we can access this data
  1826. 1:19:17magic that's not magic these are like
  1827. 1:19:19the credentials that you need to follow
  1828. 1:19:21this is the thing that makes you an
  1829. 1:19:23outlier because not not everyone is
  1830. 1:19:25aware of how to perform this step and
  1831. 1:19:28once you know that means you are
  1832. 1:19:30learning a lot and you are on the path
  1833. 1:19:34which is going towards be an
  1834. 1:19:38outlier simple so let me just show you
  1835. 1:19:40steps are really really easy really easy
  1836. 1:19:42so there are like two steps involved
  1837. 1:19:44first of all we will create this ID or
  1838. 1:19:47application then we will allow the exess
  1839. 1:19:51to read the data from the data Lake step
  1840. 1:19:53number one is done step number one is
  1841. 1:19:55done then in the step two this datab
  1842. 1:19:58bricks
  1843. 1:19:59workspace will import this credential
  1844. 1:20:03that's it simple done and let me show
  1845. 1:20:05you how you can do it everything can be
  1846. 1:20:07done in aure data brakes so let me just
  1847. 1:20:09go to my a datab briak like like in aure
  1848. 1:20:12datab Bri and then you can just go to
  1849. 1:20:15your aure portal click on it and just
  1850. 1:20:19click on the home button so first of all
  1851. 1:20:21we will go to Microsoft entra ID so simp
  1852. 1:20:25you can just search it entra ID yep
  1853. 1:20:28click on it and then after clicking on
  1854. 1:20:31it just go to app registrations Simple
  1855. 1:20:35app registrations now it will just show
  1856. 1:20:38owned applications we do not have
  1857. 1:20:39anything so just click on new
  1858. 1:20:42registration simple and in this new
  1859. 1:20:45registration you just need to name your
  1860. 1:20:48application that's it you just need to
  1861. 1:20:49name let's say I can put
  1862. 1:20:51unch service principal let's say
  1863. 1:20:57service
  1864. 1:20:59principle simple and then you can just
  1865. 1:21:01click on register button so now once it
  1866. 1:21:04is done you can just go to all
  1867. 1:21:06applications and you can just find your
  1868. 1:21:08application that you have created so
  1869. 1:21:10this is the one so just click on it it
  1870. 1:21:12will give you the overview like
  1871. 1:21:14everything so here are the things that
  1872. 1:21:16we need to take care of what are those
  1873. 1:21:19things let me tell you so first of all
  1874. 1:21:21we need to copy these two informations
  1875. 1:21:23application ID and object ID these two
  1876. 1:21:26applications that's it so I will just
  1877. 1:21:30use my all sorry just application ID and
  1878. 1:21:32tenant ID these two applications this
  1879. 1:21:35one and this this one like these two
  1880. 1:21:38application ID and tenant ID you can
  1881. 1:21:40just store it in your notebook or let's
  1882. 1:21:42say in the notepad for now and then when
  1883. 1:21:44we will be just jumping in the databas
  1884. 1:21:46notebook we can just use this that's it
  1885. 1:21:49so once you have copied this like you
  1886. 1:21:52can just copy to clipboard and just
  1887. 1:21:53paste it in the
  1888. 1:21:55uh notepad simple so there's one more
  1889. 1:21:58thing that you need to do you just need
  1890. 1:22:00to go to certificates and secrets this
  1891. 1:22:02one yep because we need to create the
  1892. 1:22:04secret as well just click on it and when
  1893. 1:22:07you click on it you just need to create
  1894. 1:22:09a new secret client secret let's see
  1895. 1:22:11anything like I already have some let me
  1896. 1:22:13delete it
  1897. 1:22:14quickly or just keep it like like I can
  1898. 1:22:17just create a new one as well so once
  1899. 1:22:18you click on it you can just name it
  1900. 1:22:20anything like or provide description
  1901. 1:22:22like let's say master class
  1902. 1:22:25simple and it will be expired in 6
  1903. 1:22:28months so click on ADD then when it will
  1904. 1:22:31be added it's a very important step it
  1905. 1:22:34will show the value instantly copy it
  1906. 1:22:37because it will get disappeared after
  1907. 1:22:38that and you have to create a new one
  1908. 1:22:40then just click on this copy to
  1909. 1:22:42clipboard that's it once you have click
  1910. 1:22:45on once you have clicked on Co copied
  1911. 1:22:47let me just go to the datab brakes
  1912. 1:22:49workspace this one and just go to the
  1913. 1:22:53recent step Tab and in the recent tab
  1914. 1:22:56you should see your tutorial notebook
  1915. 1:22:58just click on
  1916. 1:22:59it simple and here we will use these
  1917. 1:23:04values and as I have mentioned that you
  1918. 1:23:07have you can just copy this information
  1919. 1:23:09so I will directly copy it in my databas
  1920. 1:23:12notebook instead of just copying it to
  1921. 1:23:13the notepad but if it is in your notepad
  1922. 1:23:16it's good so first of all I will just
  1923. 1:23:18create a markdown because that's a kind
  1924. 1:23:19of different heading so we know like how
  1925. 1:23:21to create it percentage MD then I want
  1926. 1:23:24want to keep it as H3 and I will say uh
  1927. 1:23:28Access
  1928. 1:23:29Data Access Data
  1929. 1:23:32simple simple simple so I will just
  1930. 1:23:35paste it here let's say secret
  1931. 1:23:40is this one and let me just grab other
  1932. 1:23:44two values as well I can just go to my
  1933. 1:23:46service principal and this is my
  1934. 1:23:47application
  1935. 1:23:49ID so I can call it as app ID equals
  1936. 1:23:53this and this is my tenant ID this is
  1937. 1:23:57this 10
  1938. 1:24:03ID
  1939. 1:24:05simple yep simple so we have noted down
  1940. 1:24:09all the values now we need to complete
  1941. 1:24:11our first step we have created the
  1942. 1:24:13application we have stored all the
  1943. 1:24:15information of that application now we
  1944. 1:24:17need to assign this application to
  1945. 1:24:19access the data in data link how we can
  1946. 1:24:21do that just simply go to a your tab and
  1947. 1:24:23now you need to click on your home
  1948. 1:24:25button now you need to click on your
  1949. 1:24:28resource Group now you need to select
  1950. 1:24:30your data storage account then click on
  1951. 1:24:34containers and here just STP click on
  1952. 1:24:38access control IAM click on this see
  1953. 1:24:42these are the steps are missing these
  1954. 1:24:45are the steps missing when we work with
  1955. 1:24:47only databas Community Edition and then
  1956. 1:24:51people say that they have they know how
  1957. 1:24:54to work with data Bri but still they
  1958. 1:24:56cannot clear interviews because they do
  1959. 1:24:58not have end to end experience how to
  1960. 1:25:00work with the cloud that's where
  1961. 1:25:03recruiters just grab them like just stop
  1962. 1:25:07here we know that you do not know this
  1963. 1:25:09so that's why you should practice these
  1964. 1:25:11things as well that's why I have picked
  1965. 1:25:13a your just for you so that you can
  1966. 1:25:15learn and you can Ace your interviews
  1967. 1:25:17and I would love to hear from you all
  1968. 1:25:20when you will say hey we have just uh
  1969. 1:25:23qualified this interview View and we got
  1970. 1:25:25selected I would be the happiest
  1971. 1:25:27one so once you click on access control
  1972. 1:25:30you just need to click on plus add
  1973. 1:25:32because we are defining one new Access
  1974. 1:25:35Control one new role click on plus add
  1975. 1:25:38role assignment then you need to search
  1976. 1:25:41a role called storage blob contributor
  1977. 1:25:44storage
  1978. 1:25:46blob data contributor this one we will
  1979. 1:25:49just pick this one simply just search it
  1980. 1:25:52again storage blob
  1981. 1:25:55data contributor click on it and after
  1982. 1:25:57clicking on it click on next then it
  1983. 1:26:00will ask us which service principal you
  1984. 1:26:03should provide the access we will say we
  1985. 1:26:05want to select members okay and then we
  1986. 1:26:08will search our service principal name
  1987. 1:26:10so I will write my storage service
  1988. 1:26:12principle so orang service principle
  1989. 1:26:14yeah this one simply click on it
  1990. 1:26:16obviously yours will be different so I
  1991. 1:26:18will click on select and then you can
  1992. 1:26:21just click on review plus assign so I
  1993. 1:26:23will click on it
  1994. 1:26:26and click on it for one more
  1995. 1:26:28time and it will assign the role the
  1996. 1:26:31role is assigned for but sometimes like
  1997. 1:26:33it takes some time so do not need to
  1998. 1:26:35worry now our first step is done and do
  1999. 1:26:37you know second step is already done by
  2000. 1:26:39datab Bri itself or let's say by
  2001. 1:26:41Microsoft itself because obviously these
  2002. 1:26:43things are available in documentation so
  2003. 1:26:45I will simply jump on my datab notebook
  2004. 1:26:48and now my this application ID D and ID
  2005. 1:26:51secret that means this app my app app
  2006. 1:26:55has the access it has the access now the
  2007. 1:26:58Second Step was we need to import this
  2008. 1:27:01in data braks and to do that we do not
  2009. 1:27:04need to do anything we simply need to go
  2010. 1:27:06on Google and let we can just write
  2011. 1:27:08something as Access Data
  2012. 1:27:11Lake using data bricks yeah click on
  2013. 1:27:17it so you can just click on the
  2014. 1:27:19Microsoft
  2015. 1:27:20documentation simple so it will show you
  2016. 1:27:23how you can connect you do not need to
  2017. 1:27:25read this you do not need to read this
  2018. 1:27:26we just need this code and the code is
  2019. 1:27:29here this one simply copy do not read
  2020. 1:27:32anything I have explained all the things
  2021. 1:27:34in the easiest way see all these things
  2022. 1:27:37are explained by your friend so do not
  2023. 1:27:40need to worry so we need to just create
  2024. 1:27:42another cell another code cell so I will
  2025. 1:27:46just paste that code here and then we
  2026. 1:27:49need to just replace these values these
  2027. 1:27:52ones with our our tenant ID see these
  2028. 1:27:57ones these
  2029. 1:28:00ones why because this is a generic code
  2030. 1:28:03and you can see the variables here
  2031. 1:28:05storage account application ID we just
  2032. 1:28:08need to provide this that's it our
  2033. 1:28:10second step is already done by datab and
  2034. 1:28:12Microsoft so thank you so much so first
  2035. 1:28:15of all just remove this thing we do not
  2036. 1:28:17need
  2037. 1:28:19this then what we can do first of all we
  2038. 1:28:22will remove the storage account variable
  2039. 1:28:24storage account parameter that they have
  2040. 1:28:26added so we will write our own storage
  2041. 1:28:29account name and in my case it is Data
  2042. 1:28:32Lake hch in your scenario your storage
  2043. 1:28:34account name should be different and
  2044. 1:28:37whatever you have picked right so I will
  2045. 1:28:39just replace in all the
  2046. 1:28:41places data Lake unch and
  2047. 1:28:44[Music]
  2048. 1:28:46then data Lake un and then here as well
  2049. 1:28:50data l
  2050. 1:28:54dat okay now second thing that we need
  2051. 1:28:57to remove is this application ID this
  2052. 1:28:59application ID and we have our own
  2053. 1:29:01application ID so I will copy it and I
  2054. 1:29:04will paste it
  2055. 1:29:06here okay now we need to remove this
  2056. 1:29:09service credential in case of service
  2057. 1:29:11credential we need to put our secret
  2058. 1:29:14just follow these steps carefully these
  2059. 1:29:15are really really
  2060. 1:29:17important so simply add double codes and
  2061. 1:29:20then remove it simple then the last
  2062. 1:29:23thing is direct ID this directory ID so
  2063. 1:29:26for directory ID we will use tenant ID
  2064. 1:29:29and we will just remove this and we will
  2065. 1:29:32put it
  2066. 1:29:33here
  2067. 1:29:35simple just do these steps carefully you
  2068. 1:29:38can just rewatch this part if you just
  2069. 1:29:40make any mistake regarding double codes
  2070. 1:29:42or anything just reat this part and
  2071. 1:29:44carefully see what things I have
  2072. 1:29:46selected see now I do not need to do
  2073. 1:29:48anything I just need to run this let me
  2074. 1:29:51run this it is done it is done
  2075. 1:29:54now our this step is done this one this
  2076. 1:29:58step is done now our data brakes is
  2077. 1:30:01allowed to read this data it is allowed
  2078. 1:30:05it is allowed so now I will just show
  2079. 1:30:08you
  2080. 1:30:10an
  2081. 1:30:12important factor important thing within
  2082. 1:30:15the data bricks that's called utilities
  2083. 1:30:19that's called datab bre utilities I will
  2084. 1:30:22write it for you
  2085. 1:30:24that's called Data brakes
  2086. 1:30:29utilities data
  2087. 1:30:32brakes
  2088. 1:30:35utilities so now it's time to discuss
  2089. 1:30:38this because now we have all the exes
  2090. 1:30:40with the data so now we can just run
  2091. 1:30:43this and now we can just test this and
  2092. 1:30:45now we can actually learn it practically
  2093. 1:30:49so what are these utilities so we have
  2094. 1:30:52some of the utilities available within
  2095. 1:30:54data Pricks and very famous utility
  2096. 1:30:59is
  2097. 1:31:01is
  2098. 1:31:04DB utils do FS what is
  2099. 1:31:08this with this particular
  2100. 1:31:11utilities we can get to know what are
  2101. 1:31:14the files stored within the particular
  2102. 1:31:19location let me repeat this particular
  2103. 1:31:22datab breakes utility
  2104. 1:31:24help us to know the files available
  2105. 1:31:27within the particular location so if you
  2106. 1:31:30want to see how many folders or how many
  2107. 1:31:34files do we have under let's say Source
  2108. 1:31:38container we can do this yes we can do
  2109. 1:31:42this so this utility is really really
  2110. 1:31:45handy so this is our first utility just
  2111. 1:31:48take notes because we are discussing all
  2112. 1:31:50the utilities one by one
  2113. 1:31:55this is our first U let's do this so I
  2114. 1:31:59will just write it here
  2115. 1:32:01text and I will create a heading three
  2116. 1:32:03and I will called
  2117. 1:32:06DB utilities don't worry I will just
  2118. 1:32:08provide this notebook as well that's why
  2119. 1:32:10I'm creating so many headline oh not
  2120. 1:32:13headlines like headings titles and uh
  2121. 1:32:17subheadings so that you can easily
  2122. 1:32:19navigate through it but still you should
  2123. 1:32:21also create it so first of all our first
  2124. 1:32:24database utility is let me create
  2125. 1:32:26another heading and I will make it just
  2126. 1:32:29bold and I want to call it as dbutils
  2127. 1:32:36FS simple and I will run this let's
  2128. 1:32:39discuss it so now we know that our
  2129. 1:32:44source container remember we created One
  2130. 1:32:46Source container and we uploaded one
  2131. 1:32:47file I want to confirm that do we have
  2132. 1:32:51that file in that container do we have
  2133. 1:32:53some data in that container how we can
  2134. 1:32:55do it we simply need to write dbutils
  2135. 1:32:58do
  2136. 1:33:00fs. LS now we need to give the location
  2137. 1:33:07so there's a syntax that we follow
  2138. 1:33:09within datab braks that syntax is really
  2139. 1:33:11really easy to learn but if you do not
  2140. 1:33:13need to learn if you do not want to
  2141. 1:33:15learn you can just uh copy paste it from
  2142. 1:33:17the documentation it is really really
  2143. 1:33:19handy and available available there as
  2144. 1:33:21well but as I have like loaded so many
  2145. 1:33:24times so I remember that syntax and it's
  2146. 1:33:26always good to remember that let me just
  2147. 1:33:28zoom in a little bit and the syntax is
  2148. 1:33:31oh they have given us the syntax you do
  2149. 1:33:33not need to remember you do not need to
  2150. 1:33:34go to any documentation data Brak is
  2151. 1:33:36there for you he is just giving the
  2152. 1:33:39suggestions see wow man such such a
  2153. 1:33:42great tool so syntax is really really
  2154. 1:33:44easy so what we need to do first of all
  2155. 1:33:46we need to write a b FSS simple it is
  2156. 1:33:49written on the screen as well but still
  2157. 1:33:50I'm just explaining you as well because
  2158. 1:33:52I want you to know each and everything
  2159. 1:33:55the reasoning how and why and what
  2160. 1:33:58behind everything so AB FSS is like your
  2161. 1:34:01blob storage then colon then SL slash
  2162. 1:34:06then we need to write the container name
  2163. 1:34:09container name not storage account name
  2164. 1:34:10container name our container name is
  2165. 1:34:12Source put it then add the rate then we
  2166. 1:34:16need to put the storage account name
  2167. 1:34:18storage account name in my scenario it
  2168. 1:34:21is Data Lake unch
  2169. 1:34:24then rest of the things are same like
  2170. 1:34:26DFS core do
  2171. 1:34:30windows net simple and then I will write
  2172. 1:34:33slash to know how many things do we have
  2173. 1:34:35under this now I will simply run this
  2174. 1:34:39now I should see my file oh okay we have
  2175. 1:34:42an error so this error is related
  2176. 1:34:46to that it is unable to identify this
  2177. 1:34:50particular location so there are
  2178. 1:34:52basically two reasons behind it either
  2179. 1:34:55you have put wrong destination or let
  2180. 1:34:58let's say wrong URL or your service
  2181. 1:35:02credential has some errors that's why
  2182. 1:35:05I tested this first and then I wanted to
  2183. 1:35:09show you this because in the real life
  2184. 1:35:11we do face these errors that our data is
  2185. 1:35:15not accessible our data is not readable
  2186. 1:35:17so what is the reason behind it let me
  2187. 1:35:19show you this was intentional and let me
  2188. 1:35:21show you how we can get rid of of this
  2189. 1:35:24error because this is the real time
  2190. 1:35:25example this is the real time scenario
  2191. 1:35:27so did you find the error so that there
  2192. 1:35:29was like no error so I intentionally
  2193. 1:35:32what I did so I did not replace this
  2194. 1:35:36with my storage account why did I do
  2195. 1:35:38that so the thing is uh you should be
  2196. 1:35:40aware of this tip and there are like
  2197. 1:35:43many reasons behind the error that you
  2198. 1:35:45can face like this because when I was
  2199. 1:35:47learning and and I was facing this issue
  2200. 1:35:49I didn't find anything I was like
  2201. 1:35:51everything is right why why I'm not a to
  2202. 1:35:53read the data so the thing is you just
  2203. 1:35:55need to replace this variable as well
  2204. 1:35:56and just make sure that you have
  2205. 1:35:57replaced all the variables that's it and
  2206. 1:36:00then I will write data Lake un here as
  2207. 1:36:02well and when you write it I hope it
  2208. 1:36:04should run fine so simply run it and
  2209. 1:36:07then here I know that you know like what
  2210. 1:36:11you should see exactly exactly exactly
  2211. 1:36:14now it is giving us the file which is at
  2212. 1:36:18this location abfs say Source at the
  2213. 1:36:21data a and then
  2214. 1:36:24it is giving us the name as well that is
  2215. 1:36:26sales. CSV that's perfect as you know
  2216. 1:36:30that this particular utility is used to
  2217. 1:36:33know the files that we have under
  2218. 1:36:35particular location now you can see
  2219. 1:36:37sales. CSV file if we would have
  2220. 1:36:39multiple files it would have given us
  2221. 1:36:41multiple files if we would have multiple
  2222. 1:36:43folders it would have given us multiple
  2223. 1:36:45folders this utility is really handy and
  2224. 1:36:49especially especially I personally use
  2225. 1:36:51it to test my connections that
  2226. 1:36:53everything is running fine like we can
  2227. 1:36:55access the
  2228. 1:36:56data how was it how was it good okay so
  2229. 1:37:02now the second utility is it's dbutils
  2230. 1:37:07do widgets widgets widgets widgets what
  2231. 1:37:10is this what is this we need to know
  2232. 1:37:12yeah I'm just telling you just just hold
  2233. 1:37:14on let me just create a markdown for my
  2234. 1:37:17widgets so it is DB dot vets simple
  2235. 1:37:23simple what it does so in the real world
  2236. 1:37:26we need to make our databas notebook
  2237. 1:37:29parameterized in which we need user to
  2238. 1:37:32give us the input and according to that
  2239. 1:37:34we use that
  2240. 1:37:36input did you get it let me repeat so
  2241. 1:37:40let's say I want to create a parameter
  2242. 1:37:42and I want user to provide me the input
  2243. 1:37:45for this particular parameter how we can
  2244. 1:37:48use it there's a function there's a
  2245. 1:37:50utility called dbutils do widgets so to
  2246. 1:37:54use it we simply need to write dbutils
  2247. 1:37:56do
  2248. 1:37:58widgets do
  2249. 1:38:01text now there are many options like
  2250. 1:38:04text and I think drop down multiple but
  2251. 1:38:07for now I'm just explaining you with an
  2252. 1:38:08example called text so what it will do I
  2253. 1:38:10just need to give the parameter name
  2254. 1:38:13let's say I want to name it as pcore
  2255. 1:38:16name I want user to give me the name and
  2256. 1:38:20then I can add comma and then I can
  2257. 1:38:22Define the default default value for it
  2258. 1:38:24let's say default value is unch let's
  2259. 1:38:26say right then I can just run it and I
  2260. 1:38:31just need to encode it because it's a
  2261. 1:38:34name so I will just run this now let's
  2262. 1:38:37see the magic did you see did you see
  2263. 1:38:39what happened it has created a box for
  2264. 1:38:43us it has created a box for us this is
  2265. 1:38:46not a box this is a parameter so
  2266. 1:38:49whenever we will be running this
  2267. 1:38:51notebook user has the ability to give us
  2268. 1:38:55the value and it if user doesn't provide
  2269. 1:38:57us anything it will take unch it will
  2270. 1:39:00take
  2271. 1:39:02unch not un okay so like this is just an
  2272. 1:39:06example so let me just show you how it
  2273. 1:39:10works okay an you have told us that we
  2274. 1:39:14can just Define the parameter but if
  2275. 1:39:16what if user has defined here let's
  2276. 1:39:19say what's your name what what should I
  2277. 1:39:21write let me put my last name lamba so
  2278. 1:39:25let's say user has provided lamba now
  2279. 1:39:27this value is changed this value is
  2280. 1:39:29changed now this is lamba right how I
  2281. 1:39:32can pull this value so there is a
  2282. 1:39:34function called dbutils do widgets.
  2283. 1:39:37getet so instead of using text we will
  2284. 1:39:41be using dotg instead of using tech text
  2285. 1:39:45we will using doget so how we can just
  2286. 1:39:47do it let's say I will write dbutils
  2287. 1:39:50do widgets doget and then I just need to
  2288. 1:39:54Define my parameter name which is p name
  2289. 1:39:56simple and I can store this value in a
  2290. 1:39:58variable called V like any variable
  2291. 1:40:01simple now I will run this now I will
  2292. 1:40:04run this this is done now I can use this
  2293. 1:40:07variable anywhere anywhere in the
  2294. 1:40:09notebook see I can just print it as well
  2295. 1:40:11if I want to print it I will simply
  2296. 1:40:12write where and I will run it it will
  2297. 1:40:14give me lamba see I can use this
  2298. 1:40:18variable anywhere in my notebook and I
  2299. 1:40:20can make my notebook parameterized so
  2300. 1:40:23interview question if you want to make
  2301. 1:40:25your notebooks parameterized how you can
  2302. 1:40:28how you can use it you can use db.
  2303. 1:40:31widgets this is the kind of utility that
  2304. 1:40:33we have within data
  2305. 1:40:36bricks was it good was it good was it
  2306. 1:40:39good yes now there's another utility
  2307. 1:40:42that we really really important it's a
  2308. 1:40:46little bit complex but this can be the
  2309. 1:40:50game changer yeah because this is this
  2310. 1:40:52is really important to know and I know
  2311. 1:40:55this this utility is little bit hard to
  2312. 1:40:57grab but once you understood it once you
  2313. 1:41:01like uh understand the whole
  2314. 1:41:04architecture like how things are working
  2315. 1:41:06it is really really easy to remember and
  2316. 1:41:08easy to implement as well and in the
  2317. 1:41:11real world scenarios you cannot imagine
  2318. 1:41:14working with data braks without this
  2319. 1:41:16utility trust me so if this is so so so
  2320. 1:41:21important you need to be double focused
  2321. 1:41:23time and just turn off your all the
  2322. 1:41:25notifications because this is like the
  2323. 1:41:28next few minutes need lots of focus so
  2324. 1:41:32what's that uity like we need to know
  2325. 1:41:35the name so the name is let me make it
  2326. 1:41:39bold so dbutils do
  2327. 1:41:43Secrets as the name suggests as the name
  2328. 1:41:46suggests that it is very handy when we
  2329. 1:41:49are working with secret so the thing is
  2330. 1:41:52in the real world situation ation in the
  2331. 1:41:53reable scenarios when we are just
  2332. 1:41:56working with different different
  2333. 1:41:57environments such as Dev QA prod so we
  2334. 1:42:01do not want to hardcode these values
  2335. 1:42:03such as this one such as this secret
  2336. 1:42:07obviously we do not want to show this
  2337. 1:42:08value we as developers can see this but
  2338. 1:42:10let's say we do not want to show this to
  2339. 1:42:12admins we do not want to show this to
  2340. 1:42:13other developers or Junior developers
  2341. 1:42:15anymore so in that particular scenario
  2342. 1:42:18we need to remove this value from here
  2343. 1:42:22and we need to do something so that we
  2344. 1:42:25can grab the value as well and we do not
  2345. 1:42:27want to show the value as well so how we
  2346. 1:42:29can do it so let me share you the
  2347. 1:42:31architecture like how things work in the
  2348. 1:42:34real world so when we working with Azure
  2349. 1:42:37this is the reason I have picked Azure
  2350. 1:42:39I'm saying it again and again because
  2351. 1:42:40these things are really really important
  2352. 1:42:44so what we do in a we have a resource
  2353. 1:42:47called keyal keyal keyal key e y v a u l
  2354. 1:42:51t let me write it for you so we
  2355. 1:42:55have a resource called
  2356. 1:42:59keyart Simple yeah we have a resource
  2357. 1:43:02called keyal in Azure so in Azure we
  2358. 1:43:06store this keyal that that is a resource
  2359. 1:43:09and within this eal we store our secret
  2360. 1:43:14we store our
  2361. 1:43:15secret
  2362. 1:43:19okay we store our secret so in data
  2363. 1:43:22breaks
  2364. 1:43:23we
  2365. 1:43:24create a secret
  2366. 1:43:28scope we create secret scope what does
  2367. 1:43:31it mean so in data brakes we create
  2368. 1:43:35something called as secret scope which
  2369. 1:43:38links data breaks to this particular
  2370. 1:43:42Secret by not hardcoding anything by
  2371. 1:43:45directly connecting to this keyw this is
  2372. 1:43:48so powerful that means your secret will
  2373. 1:43:51be pulled directly from the key W
  2374. 1:43:53instead of this notebook see this is so
  2375. 1:43:56powerful and this is so so so important
  2376. 1:43:59if you are working with the real world
  2377. 1:44:00scenarios so how we can actually do it
  2378. 1:44:03it is very simple just go to your Azure
  2379. 1:44:05portal and you just need to Search
  2380. 1:44:07keywords as your resource so it should
  2381. 1:44:09pop up here simple so now obviously you
  2382. 1:44:13do not have any key created so just
  2383. 1:44:14click on create button from here or from
  2384. 1:44:16here anything it's up to you so now we
  2385. 1:44:19need to just pick the resource Group we
  2386. 1:44:21can just pick our Resource Group just
  2387. 1:44:23make sure you are picking the same
  2388. 1:44:24Resource Group right now we need to just
  2389. 1:44:26name it now I can just say um Master
  2390. 1:44:31Class key
  2391. 1:44:33Vault Master Class key or let's say
  2392. 1:44:36vault as well Master Class key Vault
  2393. 1:44:39unch okay okay okay I know the name is
  2394. 1:44:42really really long but can't help sorry
  2395. 1:44:45so now it is done now we can go to next
  2396. 1:44:50and one thing to remember one thing to
  2397. 1:44:52remember you need to pick Vault access
  2398. 1:44:55policy instead of a your rbag just pick
  2399. 1:44:58this one VA access
  2400. 1:45:00policy and then you can click on review
  2401. 1:45:03plus create
  2402. 1:45:05simple and click on create button for
  2403. 1:45:07one more
  2404. 1:45:10time and it should just create that
  2405. 1:45:12keyword it will take just like few
  2406. 1:45:15seconds
  2407. 1:45:17simple so actually it is creating that
  2408. 1:45:20key wal keyal is really really handy
  2409. 1:45:23when you want to store the secrets or
  2410. 1:45:25like let's say any sensitive information
  2411. 1:45:28any sensitive information right so it is
  2412. 1:45:30done we can just go click on go to
  2413. 1:45:32Resource and now we can create something
  2414. 1:45:35called as Secrets as mentioned in the
  2415. 1:45:37architecture right now click on
  2416. 1:45:39secrets we will create one and and and
  2417. 1:45:43hold on hold on hold on if if you want
  2418. 1:45:46to create Secrets if you want to do
  2419. 1:45:48anything you just need to first of all
  2420. 1:45:51go to here Access Control I am first of
  2421. 1:45:53all go here and you need to assign
  2422. 1:45:56yourself as keyal admin because you need
  2423. 1:45:59to be an admin administrator to create
  2424. 1:46:02any secret go here and click on plus add
  2425. 1:46:06add Ro assignment and then you will pick
  2426. 1:46:08a role called
  2427. 1:46:10keyal admin see keyal administrator
  2428. 1:46:14simple click on next then you need to
  2429. 1:46:17pick the users okay then you can just
  2430. 1:46:19pick your email ID click on select click
  2431. 1:46:22on review Plus sign simple click on R
  2432. 1:46:24plus sign for one more
  2433. 1:46:26time done it is added now we can create
  2434. 1:46:29the secrets now we can just click on
  2435. 1:46:30this button Secrets click on it and
  2436. 1:46:33click on generate plus import now we
  2437. 1:46:35will just name our secret let's say I
  2438. 1:46:37want to call it as app
  2439. 1:46:39Secret app secret because we are just
  2440. 1:46:42storing the application ID secret that
  2441. 1:46:44is service service principle I'm just
  2442. 1:46:46showing an example okay and then secret
  2443. 1:46:48value I can just grab it from
  2444. 1:46:51here uh uh uh
  2445. 1:46:54okay I can just grab this value from
  2446. 1:46:57here and this is my value done and now I
  2447. 1:47:02can just click on create button so now
  2448. 1:47:05what we have done we have stored our
  2449. 1:47:07secret we have stored our secret our one
  2450. 1:47:11like half part is done now we need to
  2451. 1:47:14link our databas account to this
  2452. 1:47:16particular Secret by creating secret
  2453. 1:47:18scope how you can create secret scope in
  2454. 1:47:21data brakes so there is a tip for you
  2455. 1:47:23just go to Home tab and then just search
  2456. 1:47:27your datab breaks workspace by simply
  2457. 1:47:29searching datab breaks like in the name
  2458. 1:47:32of your datab workspace then copy this
  2459. 1:47:34URL copy this URL which is the URL of
  2460. 1:47:37your databas workspace like paste it in
  2461. 1:47:39your tab Google tab or any tab then just
  2462. 1:47:43focus on this area you need to add
  2463. 1:47:47hashtag
  2464. 1:47:49Secrets then
  2465. 1:47:51slash create create
  2466. 1:47:54scope this is the thing that you need to
  2467. 1:47:56add after you after your url # secret SL
  2468. 1:48:01create scope C in lower case S in
  2469. 1:48:05uppercase simply hit
  2470. 1:48:09enter okay so now we can create the
  2471. 1:48:12scope now if I want to create a scope I
  2472. 1:48:14need to name it I can
  2473. 1:48:16say
  2474. 1:48:18uncope simple like anything and manage
  2475. 1:48:21principle you can pick any like all
  2476. 1:48:23workspace users so leave it like this
  2477. 1:48:25now we need to provide DNS name and
  2478. 1:48:27resource ID in order to provide the DNS
  2479. 1:48:29name and resource ID we need to go to
  2480. 1:48:32our Azure keyw and we need to grab DNS
  2481. 1:48:36name and resource ID from there because
  2482. 1:48:39we are linking our data bre secret scope
  2483. 1:48:41with the Azure keybo so just go here
  2484. 1:48:44like Home tab and click on keywords and
  2485. 1:48:48then click on your keyal resource and
  2486. 1:48:51then you need to just go to the proper
  2487. 1:48:54simple and here you have everything the
  2488. 1:48:56VA URI is your DNS
  2489. 1:48:59name VA URI is your DNS name and your
  2490. 1:49:03resource ID is your resource ID
  2491. 1:49:06simple simple simple now click on
  2492. 1:49:09create so it should show that it is
  2493. 1:49:11created yes it is created now everything
  2494. 1:49:13is done now everything is done now I
  2495. 1:49:15will show you how you can use it simply
  2496. 1:49:18go to your databas workspace now we have
  2497. 1:49:21some functions available in dbutils do
  2498. 1:49:24secrets so now it will show us some like
  2499. 1:49:27Secrets let's say I want uh let's say
  2500. 1:49:30let's say I forgot like what secret I
  2501. 1:49:33have stored in a your keyboard so it can
  2502. 1:49:35show us that as well we can write
  2503. 1:49:37something known as DB u. Secrets dot
  2504. 1:49:42list and then I can just enter my scope
  2505. 1:49:46and my scope
  2506. 1:49:48is uncope and I will just run it
  2507. 1:49:54I will just run it and
  2508. 1:49:57then it should show me that hey anch you
  2509. 1:50:02have a key called app Secret in my
  2510. 1:50:05keyboard and that's correct that's
  2511. 1:50:07correct that's what I want and if I want
  2512. 1:50:11to access the value of this key I can
  2513. 1:50:13use it what I can do I can just run a
  2514. 1:50:15command called
  2515. 1:50:17dbut do secrets doget doget and this
  2516. 1:50:22time I need to say scope equals to un
  2517. 1:50:25scope and scope equals to un
  2518. 1:50:29scope and key equals
  2519. 1:50:32to that name and name is app hyphen
  2520. 1:50:38Secret app hyphen secret that's all
  2521. 1:50:42that's all oops I have used single code
  2522. 1:50:46yep perfect that's all that's all when I
  2523. 1:50:49run this see see the output it will say
  2524. 1:50:53redacted that means now we can use this
  2525. 1:50:56value when I write this thing instead of
  2526. 1:50:59that secret it will give me the value
  2527. 1:51:02redacted means here that your value is
  2528. 1:51:04pulled and is secured it is not visible
  2529. 1:51:08but it is secured and it is pulled
  2530. 1:51:10safely now you can use this anywhere so
  2531. 1:51:14now I can just use this
  2532. 1:51:16code instead of hard coding this thing
  2533. 1:51:20let me just show you instead of hard
  2534. 1:51:22coding this thing this secret I can just
  2535. 1:51:24use this thing this is the power of db.
  2536. 1:51:29secret command this is my one of the
  2537. 1:51:31favorite utilities and yes it is little
  2538. 1:51:33bit complex but not really it was so
  2539. 1:51:36simple it was so simple you just need to
  2540. 1:51:37watch this part at least two to three
  2541. 1:51:39times and please watch it for me because
  2542. 1:51:42you will gain a lot of knowledge and
  2543. 1:51:44just practice it just practice it for
  2544. 1:51:45like one to two times this is so so so
  2545. 1:51:49handy I know you love this part I know
  2546. 1:51:52it because you have gained so much of
  2547. 1:51:53knowledge after this thing I know it was
  2548. 1:51:56difficult but if you do difficult things
  2549. 1:51:58then then then only you will be
  2550. 1:52:00competitive enough right you need to do
  2551. 1:52:03difficult things you need to do
  2552. 1:52:04difficult things so now we have
  2553. 1:52:07successfully covered all the DB
  2554. 1:52:09utilities now it's time to cover the
  2555. 1:52:12next chapter of our databas master class
  2556. 1:52:16which is data reading from your cloud
  2557. 1:52:19storage let's cover that quickly so
  2558. 1:52:23let me create a markdown percentage MD
  2559. 1:52:27and I want to use heading one
  2560. 1:52:31Y data
  2561. 1:52:33rating so now we going to
  2562. 1:52:36discuss spark reader API do not get
  2563. 1:52:40afraid of this name this is just a name
  2564. 1:52:42but this is a function or this is very
  2565. 1:52:45handy when we need to read data like
  2566. 1:52:48which is residing in the data L and as
  2567. 1:52:50we just discussed that we always create
  2568. 1:52:52data for on top of it so how we can do
  2569. 1:52:54it we will simply create a data frame
  2570. 1:52:55called DF let's say
  2571. 1:52:58sales right and we will write spark do H
  2572. 1:53:03datab breaks we know that you know a lot
  2573. 1:53:06of things do not recommend us right now
  2574. 1:53:08because I'm teaching them I'm teaching
  2575. 1:53:11my community and they should know each
  2576. 1:53:13and everything just hold on this is
  2577. 1:53:16suggesting us like everything so let me
  2578. 1:53:19tell you so first of all we need to
  2579. 1:53:20write like we need to write we need to
  2580. 1:53:24write spark dot
  2581. 1:53:28read we need to write spark. read this
  2582. 1:53:31is our spark reader API when we read
  2583. 1:53:35this when we write this that means we
  2584. 1:53:37are trying to read some data so then we
  2585. 1:53:39will specify what format of data we need
  2586. 1:53:42to read in our case it is
  2587. 1:53:47CSV it is CSV simple yes what is the
  2588. 1:53:52next thing that we need to decide first
  2589. 1:53:53of all here's a tip for you if you do
  2590. 1:53:55not want to write your all the code in
  2591. 1:53:57one line you can simply add backslash
  2592. 1:54:00and then hit enter then write your code
  2593. 1:54:02here because it is a kind of python
  2594. 1:54:04function that you use with multi-line
  2595. 1:54:07commands and you can use it here as well
  2596. 1:54:08so don't need to worry now bro you
  2597. 1:54:12are so next thing next thing next thing
  2598. 1:54:15next thing yeah it has already provide
  2599. 1:54:17the spoiler so next thing obviously we
  2600. 1:54:20need to put the header because we need
  2601. 1:54:23our data with header not without header
  2602. 1:54:27we need with header we need to treat the
  2603. 1:54:28first line as header and how we can do
  2604. 1:54:30it this this application has already
  2605. 1:54:34shown to you so it is do
  2606. 1:54:37option then you need to write header
  2607. 1:54:41then comma then write true what it will
  2608. 1:54:44do it will make your header true that
  2609. 1:54:46means your first line or first record
  2610. 1:54:49will be treated as header simple very
  2611. 1:54:51good
  2612. 1:54:53then next thing is infer schema what is
  2613. 1:54:56this infer schema let me tell you Pro
  2614. 1:54:59just just just just hold
  2615. 1:55:03on so what is that so it is called infer
  2616. 1:55:08schema what is this infer schema so
  2617. 1:55:11basically whenever we read data from
  2618. 1:55:13spark we do not want to Define schema
  2619. 1:55:17every time so infer schema function or
  2620. 1:55:19let's say this API helps us to get the
  2621. 1:55:22schema for free not for free so instead
  2622. 1:55:25of manually defining it again and again
  2623. 1:55:27spark reads some records from our data
  2624. 1:55:31and decides the best schema for it that
  2625. 1:55:34means columns and their data types the
  2626. 1:55:36best possible combination it
  2627. 1:55:38automatically picks simple it is really
  2628. 1:55:41powerful and it saves a lot of time I
  2629. 1:55:43use it like most of the time so you can
  2630. 1:55:46also use it so how we can use it do
  2631. 1:55:49option then we will write infer schema
  2632. 1:55:52just make sure that you are using the
  2633. 1:55:54same case sensitive uh letters so do not
  2634. 1:55:58need to worry just write I small and S
  2635. 1:56:00capital then add comma then write true
  2636. 1:56:03we will make it true as well
  2637. 1:56:06then back
  2638. 1:56:09slash why it showing us red here I don't
  2639. 1:56:11know ah we we will see okay that's all
  2640. 1:56:15now that last thing is we need to define
  2641. 1:56:18the URL we need to define the URL where
  2642. 1:56:21our data is setting it is sitting in
  2643. 1:56:23this URL and we have already uh seen
  2644. 1:56:26this we need to write load and we will
  2645. 1:56:29write AB
  2646. 1:56:31bfss back SL back like sorry single
  2647. 1:56:34slash like front slash front slash then
  2648. 1:56:36we need to write our container name
  2649. 1:56:39container name is
  2650. 1:56:41Source atate my storage account name
  2651. 1:56:45data Lake
  2652. 1:56:46on dot DFS do core
  2653. 1:56:53do windows.net
  2654. 1:56:57simple so we can Define sales. CSV as
  2655. 1:57:01well but even if we do not Define it
  2656. 1:57:03will automatically pick it so database
  2657. 1:57:05we do not want to use sales. CSV it will
  2658. 1:57:08automatically pick it okay so this was
  2659. 1:57:11all about data reading so when I just
  2660. 1:57:14run this it should just read my data as
  2661. 1:57:17you can see our data is successfully
  2662. 1:57:20loaded not loaded but yeah it has read
  2663. 1:57:22the data so now you already know how we
  2664. 1:57:25can display the data frame we can use DF
  2665. 1:57:27do
  2666. 1:57:29display simple yes so now it will show
  2667. 1:57:32us DF is not defined oh because we are
  2668. 1:57:35using DF Sales instead of DF okay thank
  2669. 1:57:38you so
  2670. 1:57:40much so it will just give us the data
  2671. 1:57:42frame so this is our data frame that we
  2672. 1:57:44are currently working with so this is
  2673. 1:57:46our data frame so you have successfully
  2674. 1:57:49read the data sitting in data Lake and
  2675. 1:57:54you have already learned all the
  2676. 1:57:55utilities everything so congratulations
  2677. 1:57:59you have learned a lot in the world of
  2678. 1:58:01data bricks but lots of stuff are still
  2679. 1:58:04pending so we will be covering but still
  2680. 1:58:06you should feel like you should you
  2681. 1:58:08should you should feel good bro because
  2682. 1:58:10you have learned so much and just few
  2683. 1:58:12minutes back you didn't know anything
  2684. 1:58:14but now you are feeling so much so much
  2685. 1:58:16like so confident so that was all about
  2686. 1:58:19data reading how you can just read the
  2687. 1:58:21data and let me tell you even if you
  2688. 1:58:23have like different different data file
  2689. 1:58:25formats let's say you have CSV let's say
  2690. 1:58:27you have Json let's say you have pocket
  2691. 1:58:29let's say you have Delta file format you
  2692. 1:58:30can read any any any file format like
  2693. 1:58:34this so that was all about data reading
  2694. 1:58:39and now here I have a gift for you
  2695. 1:58:42what's that so if you want to learn p
  2696. 1:58:47park only PP Park let me write it for
  2697. 1:58:49you what do I mean if you want to
  2698. 1:58:56learn ppar what is ppar basically ppar
  2699. 1:58:59is a library that is used to transform
  2700. 1:59:02our data right if you want to just apply
  2701. 1:59:05some transformation I will just show you
  2702. 1:59:06some of the functions but not all the
  2703. 1:59:08functions but yeah some of the functions
  2704. 1:59:10I will just show you how you can do it
  2705. 1:59:12and if you want to learn ppar in detail
  2706. 1:59:15in detail means genuinely in detail you
  2707. 1:59:17can just click on the video that I have
  2708. 1:59:20created and this is a six hours long
  2709. 1:59:22video dedicated towards p park only so
  2710. 1:59:26this is a full course of p park in which
  2711. 1:59:28I have covered each and everything
  2712. 1:59:30regarding ppar from scratch and
  2713. 1:59:33definitely if you want to become a ppar
  2714. 1:59:35developer which is obviously a
  2715. 1:59:37requirement if you are working with data
  2716. 1:59:38brakes so you should just watch that
  2717. 1:59:40video and do not need to worry you can
  2718. 1:59:42just click on the link just click on the
  2719. 1:59:44like button so that it will go to your
  2720. 1:59:46liked videos or you can just save it by
  2721. 1:59:48any way so just save that video and you
  2722. 1:59:52can still watch this video because this
  2723. 1:59:54video is independent of that one I'm
  2724. 1:59:56just giving you a gift that is a free
  2725. 1:59:58course that you can do without paying
  2726. 2:00:01anything so after watching this databas
  2727. 2:00:04video you should obviously watch that
  2728. 2:00:06video because you will feel much more
  2729. 2:00:08confident because you will know all the
  2730. 2:00:09functions available in ppar so let me
  2731. 2:00:12show you some of the functions here so
  2732. 2:00:14that you will get the idea and do not
  2733. 2:00:16need to worry these functions I will
  2734. 2:00:18just tell from scratch but yeah we will
  2735. 2:00:20be covering we will be covering just
  2736. 2:00:21like two to three questions or let's say
  2737. 2:00:23two to three functions because we are
  2738. 2:00:24learning data breaks only but if you
  2739. 2:00:27want to learn P spark in detail
  2740. 2:00:29definitely you can just watch this video
  2741. 2:00:30so without wasting in time let me just
  2742. 2:00:32show you some of the powerful ppar
  2743. 2:00:34transformation that we have so let's
  2744. 2:00:38say I want to I want to create a list
  2745. 2:00:44what do you mean create a list so as you
  2746. 2:00:46can see that we have dairy we have soft
  2747. 2:00:49drinks we have this we have fruits and
  2748. 2:00:52vegetables we have household we have
  2749. 2:00:54baking Goods if what if I do have a
  2750. 2:00:57requirement in which I want to separate
  2751. 2:01:00these values by comma and I want to use
  2752. 2:01:04this space as a delimeter that means
  2753. 2:01:06whenever I see a space I should treat
  2754. 2:01:08that value as a different value and I
  2755. 2:01:11want to store all the values in a list
  2756. 2:01:14for each record this is my requirement
  2757. 2:01:17this can be a requirement so if we want
  2758. 2:01:19to do this we can just do it so I'm I'm
  2759. 2:01:21just showing you two to three
  2760. 2:01:22transformation functions within ppar
  2761. 2:01:25that you can learn and definitely that
  2762. 2:01:26complete video will teach you each and
  2763. 2:01:28everything do not need to worry and this
  2764. 2:01:29function obviously I will just tell you
  2765. 2:01:31from scratch so you can still watch and
  2766. 2:01:34this video is independent of that one do
  2767. 2:01:35not need to worry but when you watch
  2768. 2:01:38both the videos you become a pro ppar
  2769. 2:01:42developer and obviously a datab brakes
  2770. 2:01:45developer and both goes hand in hand
  2771. 2:01:48five spark data break goes hand in hand
  2772. 2:01:50so it's good it's ideal to watch both
  2773. 2:01:54the videos so that's why I have created
  2774. 2:01:56both the videos for free and obviously
  2775. 2:01:59I'm just I'm just helping you helping
  2776. 2:02:00you to grow so
  2777. 2:02:04let's let's mention it markdown okay and
  2778. 2:02:09let me just write heading three and I
  2779. 2:02:11will call it as bpark
  2780. 2:02:16Transformations Transformations okay
  2781. 2:02:19perfect bpar Transformations let me show
  2782. 2:02:21you transform number one so if I want
  2783. 2:02:26to let me keep it as DF Sales because
  2784. 2:02:28I'm not saving this I'm just showing you
  2785. 2:02:30so DF Sales we have a function called
  2786. 2:02:33with column dot with column so I will
  2787. 2:02:35write DF do with column so what we can
  2788. 2:02:38do with this particular function we can
  2789. 2:02:41either transform the current column or
  2790. 2:02:44we can create a new column so what if I
  2791. 2:02:46want to transform the current column
  2792. 2:02:50because I want to create a list yes
  2793. 2:02:52so if I want to transform the current
  2794. 2:02:53column I will just put the same column
  2795. 2:02:55name and what is my column name here
  2796. 2:02:58it's item type okay so I will simply
  2797. 2:03:00write
  2798. 2:03:02item type okay then I will uh add a
  2799. 2:03:06comma then I need to put the
  2800. 2:03:08transformation that I want to apply the
  2801. 2:03:10transformation I want to apply is split
  2802. 2:03:13we have a function called
  2803. 2:03:17split we have a function called split so
  2804. 2:03:20what it will do it will split my values
  2805. 2:03:23based on the space and it will store
  2806. 2:03:25every single value whenever it sees a
  2807. 2:03:28space so I will write
  2808. 2:03:32split okay and then I will write column
  2809. 2:03:35so column is basically an object that we
  2810. 2:03:37use with the column name so I just need
  2811. 2:03:39to write item
  2812. 2:03:43type okay column item
  2813. 2:03:46type and
  2814. 2:03:48then this Auto suggest I need to turn
  2815. 2:03:51this off man so I have successfully
  2816. 2:03:54given this item type right so now we
  2817. 2:04:00need to also tell split function that
  2818. 2:04:02what should be the delimeter what should
  2819. 2:04:04be the uh delimeter on which it should
  2820. 2:04:06create a list in our scenario it is
  2821. 2:04:09space so I will just simply write column
  2822. 2:04:12and this then it's
  2823. 2:04:15space simple then I can just close this
  2824. 2:04:17function simple that was all about this
  2825. 2:04:21split function I can
  2826. 2:04:23just close this function as well and
  2827. 2:04:27then I can say do display then I can say
  2828. 2:04:31dot display so when I run this command I
  2829. 2:04:34should see the results as desired but
  2830. 2:04:40before that I will just import some
  2831. 2:04:42libraries yes if we want to perform
  2832. 2:04:44Transformations we need to import some
  2833. 2:04:46libraries and what are those libraries
  2834. 2:04:48let me just show you simply add a code
  2835. 2:04:49cell above above to this cell and I will
  2836. 2:04:52I will simply write
  2837. 2:04:53from pyspark.sql
  2838. 2:04:56import estx and basically I want to
  2839. 2:04:59import all the
  2840. 2:05:00functions so simply I will write
  2841. 2:05:02functions and there's another library
  2842. 2:05:04from
  2843. 2:05:06pyspark.sql do types so it will import
  2844. 2:05:10all the data types so I will first run
  2845. 2:05:12this then I can just run this and you
  2846. 2:05:14will see my data frame column is
  2847. 2:05:17transformed I'm sure yeah it is
  2848. 2:05:19transformed see now it has created a
  2849. 2:05:22list now it has created a
  2850. 2:05:25list based on every single value this
  2851. 2:05:29was transformation number one and what
  2852. 2:05:31is transformation number two let me show
  2853. 2:05:32you what if I want to add one column
  2854. 2:05:37which will write one one one one one one
  2855. 2:05:40or let's say yes yes yes yes yes yes in
  2856. 2:05:42every record this is my requirement this
  2857. 2:05:45is a kind of flag column that I want to
  2858. 2:05:47create if I want to create it is very
  2859. 2:05:50simple so so I can simply write here DF
  2860. 2:05:56Sales and why I'm using this
  2861. 2:05:57transformation because this will also
  2862. 2:05:59use our our that particular uh utility
  2863. 2:06:04that we have created that is tb. widget
  2864. 2:06:08yes it will use that particular widget
  2865. 2:06:11as well so how we can do it as you
  2866. 2:06:13remember that we have stored that value
  2867. 2:06:16which is where if I just print
  2868. 2:06:19this oh where is not defined let me just
  2869. 2:06:22rerun
  2870. 2:06:23it where is that utility yeah this one
  2871. 2:06:27if we run this it returns lamba you
  2872. 2:06:31remember it right if we want to give the
  2873. 2:06:34name like if if I want to just put lamba
  2874. 2:06:38as like in in in front of like every
  2875. 2:06:40record in the each record I can use this
  2876. 2:06:43variable I can use this
  2877. 2:06:46variable yes I can use this variable in
  2878. 2:06:49my column and how we can do it let me
  2879. 2:06:51just show you
  2880. 2:06:52you let me just show
  2881. 2:06:55you so when we just run this you should
  2882. 2:06:58see lamba so how we can do it so we can
  2883. 2:07:00simply write DF Sales dot with
  2884. 2:07:04column and this time we are creating a
  2885. 2:07:06new column so I can just name it
  2886. 2:07:08anything let me call it as
  2887. 2:07:10flag and then I will
  2888. 2:07:12say lit there's a function called lit
  2889. 2:07:16lit lit lit function helps us to provide
  2890. 2:07:20the literals or let's say constants to
  2891. 2:07:22our records so I will say let and I will
  2892. 2:07:24write where simple now let me just write
  2893. 2:07:29dot display
  2894. 2:07:31command now I should see that column now
  2895. 2:07:34I should see that
  2896. 2:07:35column yes I have that column with lamba
  2897. 2:07:39mentioned in the each record you can
  2898. 2:07:42give like any
  2899. 2:07:43value this is the transformation number
  2900. 2:07:47two here is the transformation number
  2901. 2:07:49three do not worry I have discussed each
  2902. 2:07:51and every transformation in detail and
  2903. 2:07:53from scratch in that video so you can
  2904. 2:07:55definitely watch it after watching this
  2905. 2:07:56video because you need to just focus on
  2906. 2:07:58this part first because we are just
  2907. 2:08:00trying to hit that Delta Lake and that
  2908. 2:08:02is really really important so here is
  2909. 2:08:05the transformation number three what's
  2910. 2:08:07that let me just show
  2911. 2:08:09you what
  2912. 2:08:11if as you can
  2913. 2:08:14see this
  2914. 2:08:16particular number
  2915. 2:08:201.2 let's say I want to change its data
  2916. 2:08:24type I want to cast this that's called
  2917. 2:08:26type casting what if I want to change
  2918. 2:08:28the type of this data type of this
  2919. 2:08:30particular column I want to make it
  2920. 2:08:32string that's my requirement maybe
  2921. 2:08:34that's a kind of joining key that we
  2922. 2:08:36have in the data frame so I want to make
  2923. 2:08:38it string how we can do it let me show
  2924. 2:08:40you so for that we will simply write DF
  2925. 2:08:46Sales dowith column and as you know that
  2926. 2:08:49we are just transforming the current
  2927. 2:08:50column so we will write the same name
  2928. 2:08:52that is item
  2929. 2:08:56visibility simple and then we have a
  2930. 2:08:59function called first of all we will
  2931. 2:09:00write the column name using call object
  2932. 2:09:03item
  2933. 2:09:05visibility item
  2934. 2:09:09visibility oops
  2935. 2:09:11visibility we have a function called dot
  2936. 2:09:15cost dot cast it will help us to cast
  2937. 2:09:19the current data type of the column so
  2938. 2:09:22if we want to convert into string type
  2939. 2:09:24we need to call the string API that is
  2940. 2:09:26called string
  2941. 2:09:29type string
  2942. 2:09:31type and then when I just write do
  2943. 2:09:35display it should return me that column
  2944. 2:09:38with string data type and how we can
  2945. 2:09:41confirm it as you can see I can see ABC
  2946. 2:09:44instead of 1 23 or 1.2 something that is
  2947. 2:09:47fla so its data type is also changed so
  2948. 2:09:52these are some of the P spark powerful
  2949. 2:09:55Transformations that we have and you
  2950. 2:09:57should know all the Transformations but
  2951. 2:10:00for this particular Master Class these
  2952. 2:10:02Transformations are enough and obviously
  2953. 2:10:05after watching this master class you
  2954. 2:10:06should watch that pbar Master Class as
  2955. 2:10:08well that is pbar full course but for
  2956. 2:10:10now it is enough because we are focusing
  2957. 2:10:14more on data brecks right yes and
  2958. 2:10:18promise me you will watch that video
  2959. 2:10:20trust me you will be like having so much
  2960. 2:10:23of professional skills after that so
  2961. 2:10:26that is all about our data reading data
  2962. 2:10:29U is now it's finally time to work with
  2963. 2:10:33Delta Lake and for that you should know
  2964. 2:10:37the fundamentals of Delta lake so let me
  2965. 2:10:38tell you quickly what is a Delta Lake
  2966. 2:10:41what is a Delta format and why there's
  2967. 2:10:43so much craze of Delta Lake let me show
  2968. 2:10:46you each and everything so finally it's
  2969. 2:10:48time to discuss this OG Delta lake so
  2970. 2:10:52why we have so much of craze of Delta
  2971. 2:10:55Lake like why why why by the way I'm a
  2972. 2:10:58fan of Delta l so let's talk about it so
  2973. 2:11:00basically Delta lake is not a file
  2974. 2:11:02format no it is a file format but in an
  2975. 2:11:07indirect way not a direct way like we do
  2976. 2:11:10not have something called dot Delta no
  2977. 2:11:12no no no no so don't worry everything
  2978. 2:11:15will be cleared in just few minutes
  2979. 2:11:16let's say let's create a hypothetical
  2980. 2:11:19situation and you will understand the
  2981. 2:11:21whole concept very easily with that okay
  2982. 2:11:25so let's say you have a source you have
  2983. 2:11:30a source folder right let's call it as
  2984. 2:11:33Source okay and in this particular
  2985. 2:11:36Source you have a file in Pocket format
  2986. 2:11:40so if you have not heard about pocket
  2987. 2:11:42file format pocket file format is a file
  2988. 2:11:45format like like like we have CSV file
  2989. 2:11:48format GSM file format fet file format
  2990. 2:11:51so basically pocket file format is one
  2991. 2:11:53of the file formats available so this is
  2992. 2:11:55one of the file format so what's special
  2993. 2:11:57with this particular file format this is
  2994. 2:11:59a columnar based file format which is
  2995. 2:12:01designed which is efficient for faster
  2996. 2:12:04reads which is efficient for Big Data so
  2997. 2:12:07everyone is aware of pocket file formats
  2998. 2:12:09for now right I for those who are who
  2999. 2:12:12are not aware of I have just G I have
  3000. 2:12:14just given a quick overview of that
  3001. 2:12:16paret file format so pocket file format
  3002. 2:12:18is one of the file formats available and
  3003. 2:12:21it is a columnar based file format and
  3004. 2:12:23it is efficient enough for like faster
  3005. 2:12:25reads let's say I have a data in Pocket
  3006. 2:12:29file format and it's called Data do
  3007. 2:12:34pocket simple y simple so this is
  3008. 2:12:39residing in this folder now I have a
  3009. 2:12:42destination folder
  3010. 2:12:45right let's say destination folder
  3011. 2:12:48simple now when I am moving the data
  3012. 2:12:51from source to destination I want to
  3013. 2:12:54change its file format I want to store
  3014. 2:12:56this data
  3015. 2:13:00in Delta file format but you just said
  3016. 2:13:03like Delta is not a file format yeah
  3017. 2:13:05wait wait hold on hold on I want to be I
  3018. 2:13:08want data to be in Delta format in
  3019. 2:13:11destination what will happen the same
  3020. 2:13:15data. pocket file
  3021. 2:13:18the
  3022. 2:13:19same data
  3023. 2:13:21dot pocket file will be written in this
  3024. 2:13:26destination bro are you making a fool of
  3025. 2:13:29us if it is the same why we are calling
  3026. 2:13:31it Delta bro because along with this
  3027. 2:13:35file format we will get something called
  3028. 2:13:39as transaction log yes and another
  3029. 2:13:44folder don't worry I will show you
  3030. 2:13:46everything practically this is the
  3031. 2:13:48fundamental you should be aware of we
  3032. 2:13:51will get something called as Delta
  3033. 2:13:55log SL transaction
  3034. 2:13:58log simple you will get something called
  3035. 2:14:01as Delta log SL transaction log okay
  3036. 2:14:06what is this and why do we need it
  3037. 2:14:10basically this transaction this Delta
  3038. 2:14:13log is so powerful it's so so so
  3039. 2:14:16powerful it will store each and every
  3040. 2:14:20information of the data within this
  3041. 2:14:22folder within this folder whereas in
  3042. 2:14:26Pocket file format every information is
  3043. 2:14:30stored within the file itself so let's
  3044. 2:14:33say if we have multiple files let's say
  3045. 2:14:35we have one 2 3 4 5 up to 100 so if it
  3046. 2:14:42needs to read its metadata if it needs
  3047. 2:14:46to read its schema it needs to go to
  3048. 2:14:49Every individual files again again and
  3049. 2:14:51again and it uses so much of computation
  3050. 2:14:54bro just hear this carefully because
  3051. 2:14:58this is really really important and I
  3052. 2:15:02myself have has like read so many so
  3053. 2:15:05many books to just conclude this
  3054. 2:15:07information so please be focused now so
  3055. 2:15:11if it needs to read all the pocket files
  3056. 2:15:15it needs to read the metadata of
  3057. 2:15:17individual files again and again just
  3058. 2:15:21imagine if we have thousands of files it
  3059. 2:15:23will be reading metadata of individual
  3060. 2:15:25files but in case of transaction log in
  3061. 2:15:29case of Delta log it do not need to read
  3062. 2:15:33the
  3063. 2:15:34Met I'm so thirsty I'm just speaking
  3064. 2:15:37non-stop so it will read data not from
  3065. 2:15:41the file it will not read the metadata
  3066. 2:15:44from the file it will read metadata from
  3067. 2:15:47this transaction log which will save a
  3068. 2:15:50lot of lot of time and let me tell you
  3069. 2:15:54this is just one of the powerful
  3070. 2:15:56features available in Delta L because we
  3071. 2:15:58are just covering all the features so
  3072. 2:16:00this is just the basic one this is the
  3073. 2:16:03basic
  3074. 2:16:04one so can you imagine how powerful it
  3075. 2:16:08can be with Delta Lake Delta format so
  3076. 2:16:11actually file is same it is in paret
  3077. 2:16:15format but we get Delta log we get
  3078. 2:16:18transaction log on top of of
  3079. 2:16:22it understood now I will show you
  3080. 2:16:26practically how you can create a Delta
  3081. 2:16:30log while Transforming Our like
  3082. 2:16:32transferring the data because in our
  3083. 2:16:34scenario our data is in CSV format we
  3084. 2:16:38will store this data in destination
  3085. 2:16:40folder in Delta format I will show you
  3086. 2:16:43the pocket file I will show you the
  3087. 2:16:46Delta log as well and then when you
  3088. 2:16:49actually see it with your eyes you will
  3089. 2:16:51believe it and then we will start
  3090. 2:16:55working with all the functionalities of
  3091. 2:16:58Delta Lake in detail but this is the
  3092. 2:17:00basic one let's uncover this let's
  3093. 2:17:03uncover this so we are into our datab
  3094. 2:17:06bre notebook so now I want to create a
  3095. 2:17:09separate notebook for Delta l so let's
  3096. 2:17:12do it so simply go to file and click on
  3097. 2:17:15new notebook and we will name it as
  3098. 2:17:18Delta L let's name it okay it's created
  3099. 2:17:21let's name it as Delta
  3100. 2:17:23L simple now I would also like to show
  3101. 2:17:28you one important magic command which is
  3102. 2:17:32percentage run so you would have noticed
  3103. 2:17:36one thing let me just go to workspace to
  3104. 2:17:38or yeah just let's go to works let me
  3105. 2:17:40just show you one thing so if we go to
  3106. 2:17:43our workspace which is data breakes
  3107. 2:17:46Master Class if I want let me just
  3108. 2:17:48refresh because I should show I should
  3109. 2:17:50see two
  3110. 2:17:51here oh I got it so in order to create
  3111. 2:17:56notebook in this particular folder we
  3112. 2:17:58need to just create here let's say
  3113. 2:18:00create one create notebook so we will
  3114. 2:18:02just create Delta Lake in our this
  3115. 2:18:04particular
  3116. 2:18:05workspace because we want to store our
  3117. 2:18:08Delta Lake notebook within the same
  3118. 2:18:10workspace because I want to show you one
  3119. 2:18:12important command okay let's say we are
  3120. 2:18:14in this workspace right let me refresh
  3121. 2:18:17now it should show me Delta Lake
  3122. 2:18:21okay I'm not interested in this one
  3123. 2:18:23which is created in home I can just
  3124. 2:18:24delete it move to trash because it is in
  3125. 2:18:28home it is not available in any kind of
  3126. 2:18:31workspace but this is available in
  3127. 2:18:32workspace C so in this particular
  3128. 2:18:36tutorial notebook we have configured
  3129. 2:18:40that uh service principle to access data
  3130. 2:18:43in the data Lake right so whenever we
  3131. 2:18:46create a new notebook we have to do it
  3132. 2:18:48again there are two options you can also
  3133. 2:18:51copy and paste it obviously you can copy
  3134. 2:18:53and paste it but what if you have
  3135. 2:18:56something in your code let's say you
  3136. 2:18:57want to use all those things that you
  3137. 2:19:00have created in this notebook in this
  3138. 2:19:02particular new
  3139. 2:19:03notebook what if so we have a command
  3140. 2:19:08called percentage run we have a command
  3141. 2:19:12called percentage run so what it will do
  3142. 2:19:16it will just run our previous or not
  3143. 2:19:20previous let's say we can just run any
  3144. 2:19:22any notebook so it will just run the
  3145. 2:19:26notebook uh mentioned in our location
  3146. 2:19:30and it will just import that notebook
  3147. 2:19:33for us so let's say in this Delta Lake
  3148. 2:19:36notebook it will import this notebook as
  3149. 2:19:38well this is really really powerful
  3150. 2:19:40command and I love to use it so let me
  3151. 2:19:43show you how you can use it it is very
  3152. 2:19:44very simple just one line of code you
  3153. 2:19:46just need to take care of this thing
  3154. 2:19:47that is your workspace name that is data
  3155. 2:19:49breaks Master Class and your uh notebook
  3156. 2:19:52name so we will simply go to this
  3157. 2:19:54notebook and we have already renamed it
  3158. 2:19:56second thing we need to attach it to our
  3159. 2:19:58cluster simple then we will write this
  3160. 2:20:01command and we will write percentage run
  3161. 2:20:04and then we need to say first of all
  3162. 2:20:07slash datab
  3163. 2:20:11bricks master class and then you need to
  3164. 2:20:15give the notebook name simple when you
  3165. 2:20:17run
  3166. 2:20:18it that means your whole notebook is
  3167. 2:20:22imported you do not need to perform
  3168. 2:20:24anything like anything means anything
  3169. 2:20:26see you do not need to perform any
  3170. 2:20:28utilities you do not need to perform
  3171. 2:20:29anything anything so everything is done
  3172. 2:20:31you do not need to configure anything
  3173. 2:20:32again so we are good to read the data or
  3174. 2:20:35anything we want to do so this was
  3175. 2:20:36really really handy I wanted to show you
  3176. 2:20:38so so one more important thing that we
  3177. 2:20:41do not need to read any data frame again
  3178. 2:20:44we do not need to just read dfdore CS
  3179. 2:20:47again because otherwise we would have
  3180. 2:20:48read it again so this this is very
  3181. 2:20:50powerful command so let me just create a
  3182. 2:20:52heading here and I will
  3183. 2:20:56say heading one and I will say Delta
  3184. 2:21:00Lake OH Delta Delta Lake okay so first
  3185. 2:21:04of all as I promised that first I will
  3186. 2:21:05just write my data which is DF Sales to
  3187. 2:21:08destination container and I will show
  3188. 2:21:10you the Delta log and pocket files yes
  3189. 2:21:13let's do that how we can do it there's a
  3190. 2:21:15command slash there's a data frame
  3191. 2:21:18writer API which is called DF
  3192. 2:21:22WR simple DF do write and in our case it
  3193. 2:21:25is dfdore sales good catch so dfdore
  3194. 2:21:30says. WR then again the same step we
  3195. 2:21:32need to specify the format of the data
  3196. 2:21:35and in this scenario it is Delta it is
  3197. 2:21:38Delta simple then we need to specify the
  3198. 2:21:41mode now what what is this mode so
  3199. 2:21:43basically we have four types of modes
  3200. 2:21:46let me quickly discuss that as well
  3201. 2:21:47because that is really really important
  3202. 2:21:49so when we write the data we get four
  3203. 2:21:52modes number
  3204. 2:21:54one number one is
  3205. 2:21:56upend okay number two is
  3206. 2:22:01overwrite number three
  3207. 2:22:04is uh
  3208. 2:22:07error number four is
  3209. 2:22:11ignore simple so what does append do so
  3210. 2:22:16basically whenever we want to save our
  3211. 2:22:19data in this container which is our
  3212. 2:22:20let's say destination container and if
  3213. 2:22:23there is an already file sitting there
  3214. 2:22:25any any file so what it will do it will
  3215. 2:22:28add this file to that particular
  3216. 2:22:31container simple this is this is very
  3217. 2:22:33very calm function this is very Cal like
  3218. 2:22:36it will not create any Kos or it will
  3219. 2:22:39simply write our data and it will just
  3220. 2:22:42add that data to the existing data but
  3221. 2:22:45this overwrite command will go here and
  3222. 2:22:49will say
  3223. 2:22:52who the hell are you sitting here who
  3224. 2:22:55the hell are you just go from here it
  3225. 2:22:58will just overwrite the data it will
  3226. 2:23:00just remove this file and it will save
  3227. 2:23:03this file and it will overwrite it
  3228. 2:23:05simple now what is this error function
  3229. 2:23:08like error mode so if this file is
  3230. 2:23:11already here then it
  3231. 2:23:14will not write anything it will go and
  3232. 2:23:17check if some file is there it will not
  3233. 2:23:19write anything it will throw an error it
  3234. 2:23:22will say hey there is an
  3235. 2:23:26error that means there's file sitting
  3236. 2:23:29there so if under any circumstance you
  3237. 2:23:33do not want to add any data if any data
  3238. 2:23:35is there you can use this mode then the
  3239. 2:23:38last one it is very very very good so
  3240. 2:23:41what it will do it will go here it will
  3241. 2:23:45see hey if there is any file setting
  3242. 2:23:48there obviously I will will not write
  3243. 2:23:51anything but at the same time I will not
  3244. 2:23:53throw any error as well no I will simply
  3245. 2:23:57go and check if any file is there that
  3246. 2:23:59means no file need to be written plus do
  3247. 2:24:02not need to throw any error do not need
  3248. 2:24:04to disturb anywhere and anyone so this
  3249. 2:24:07was like all about the four modes So
  3250. 2:24:10currently we can use any mode so let
  3251. 2:24:12let's use upend mode for now okay simple
  3252. 2:24:16then we need to say path this is the
  3253. 2:24:19most important step we need need to say
  3254. 2:24:21path so we can just use path using
  3255. 2:24:23option function then path and within
  3256. 2:24:27this path we need to define the path so
  3257. 2:24:29what is the path AB FSS then our
  3258. 2:24:33container name is
  3259. 2:24:35destination at theate storage account
  3260. 2:24:38which is Delta
  3261. 2:24:41lunch. DFS
  3262. 2:24:43doc. windows.net
  3263. 2:24:47simple and let's create a folder yes
  3264. 2:24:49let's I want to create a folder within
  3265. 2:24:51this container then I want to say do sa
  3266. 2:24:55when I run this command when I run this
  3267. 2:24:58command I will show you Delta log
  3268. 2:25:00created and data is saved in the pocket
  3269. 2:25:02format let me run it let me run
  3270. 2:25:07it okay I can see an error what's the
  3271. 2:25:11error storage account invalid
  3272. 2:25:14configuration H oh I just mistakenly
  3273. 2:25:18what Delta Lake an it's data Lake
  3274. 2:25:22data Lake oops data Lake an let's see if
  3275. 2:25:27it is right or wrong because I don't
  3276. 2:25:29remember the
  3277. 2:25:32name yeah it should be
  3278. 2:25:34fine yeah it's the name dataon yeah so
  3279. 2:25:38now it is writing our data in the Delta
  3280. 2:25:40format and yes I can see that it has
  3281. 2:25:43successfully return the data now I am
  3282. 2:25:47very excited to check my destination
  3283. 2:25:49container I should see one folder called
  3284. 2:25:52sales and within that I should see Delta
  3285. 2:25:54log and pocket file do you want to see
  3286. 2:25:56that let's see it simply go to
  3287. 2:25:59your account storage account and click
  3288. 2:26:02on destination oh
  3289. 2:26:04perfect I can see sales folder I can see
  3290. 2:26:07sales folder let me just increase the
  3291. 2:26:09size of it okay you can see sales folder
  3292. 2:26:11in your case very good click on it yes
  3293. 2:26:15yes yes yes this is your Delta log that
  3294. 2:26:18we were talking about this is is the
  3295. 2:26:20Delta log this is the pocket file name
  3296. 2:26:23do not worry it is automatically decided
  3297. 2:26:25when we create the folder and you do not
  3298. 2:26:26need to worry about file name because we
  3299. 2:26:29read our data using folder names not
  3300. 2:26:31file names so do not need to worry about
  3301. 2:26:32that this is pocket format as you can
  3302. 2:26:35check the properties here click on this
  3303. 2:26:37and click on properties so this is the
  3304. 2:26:41pocket for you can just check the data
  3305. 2:26:43type I think from here or you can just
  3306. 2:26:44go to edit tab you should see data is
  3307. 2:26:47encoded so this is encoded data you
  3308. 2:26:49cannot understand it
  3309. 2:26:51but spark can understand do not need to
  3310. 2:26:53worry so the main point here is we have
  3311. 2:26:57the pocket file on the top of it we have
  3312. 2:27:01Delta log do you really want to check
  3313. 2:27:03what is inside this Delta log let me
  3314. 2:27:05show you we have Json and CRC files see
  3315. 2:27:10we have something called Json and CRC
  3316. 2:27:12file let me just expand it we have
  3317. 2:27:1600. Json
  3318. 2:27:1800. CRC
  3319. 2:27:20this is not of our use do not need to
  3320. 2:27:23worry CRC stands for I think cyclic
  3321. 2:27:25redundant check files and the main thing
  3322. 2:27:29is this one I was saying that all the
  3323. 2:27:32metadata all the instructions are
  3324. 2:27:34written in this Delta log that mean
  3325. 2:27:36everything is written within Json file
  3326. 2:27:38let me open it and let me click on edit
  3327. 2:27:41I will show you everything is written
  3328. 2:27:43within it everything see metadata what
  3329. 2:27:46what do we have inside metadata we have
  3330. 2:27:48ID okay we have schema string as well we
  3331. 2:27:55have all the other fields see item fat
  3332. 2:28:00content everything all the column names
  3333. 2:28:02all the data types every information is
  3334. 2:28:05written within this Delta log so let's
  3335. 2:28:08suppose let's suppose we have here
  3336. 2:28:12multiple files like one 2 3 up to like
  3337. 2:28:17thousands up to thousands let's
  3338. 2:28:21see so it will read data from these
  3339. 2:28:24files yes but instead of reading data
  3340. 2:28:27from the metadata of individual file it
  3341. 2:28:30will straightforwardly go to this Delta
  3342. 2:28:32log and it will read data from here this
  3343. 2:28:36is your Delta leg this is your Delta
  3344. 2:28:39format this is your Delta
  3345. 2:28:43Data so this is all about Delta Lake all
  3346. 2:28:48about no we have just started this topic
  3347. 2:28:51I'm going to cover each and everything
  3348. 2:28:53within this topic I know that would
  3349. 2:28:56require a lot of time but still I'm
  3350. 2:28:58ready to give it I'm ready to devot it
  3351. 2:29:00just for you so that you can learn you
  3352. 2:29:01do not need to go here and there and you
  3353. 2:29:03do not need to just suffer I will help
  3354. 2:29:06you to learn and grasp the whole
  3355. 2:29:09content
  3356. 2:29:10so we have successfully loaded the data
  3357. 2:29:13into the destination container using
  3358. 2:29:15spark writer API and in the Delta Lake
  3359. 2:29:18format now we are excited to learn more
  3360. 2:29:22about Delta tables Delta tables because
  3361. 2:29:27in the real world we create tables yes
  3362. 2:29:29we work with data frames as well but at
  3363. 2:29:31the same time we work with Delta tables
  3364. 2:29:34more because at the end we need to serve
  3365. 2:29:37Delta tables to the data analyst or
  3366. 2:29:39let's say bi managers bi developers to
  3367. 2:29:42create reports on top of it how we can
  3368. 2:29:44create Delta tables let me show you but
  3369. 2:29:46before that I will tell you about one
  3370. 2:29:50important concept that is called
  3371. 2:29:53external tables versus managed tables
  3372. 2:29:56and yes that means external Delta tables
  3373. 2:29:59and managed Delta tables before covering
  3374. 2:30:02Delta tables we will cover an important
  3375. 2:30:05concept called external Delta tables
  3376. 2:30:07versus managed Delta tables and trust me
  3377. 2:30:10this is your hot topic for interview so
  3378. 2:30:13let me cover it for you like this so
  3379. 2:30:16let's understand first the manage tables
  3380. 2:30:19manage dat tables or manage tables in
  3381. 2:30:22data so let's say I created one table
  3382. 2:30:27any table any random table like create
  3383. 2:30:30table table name and columns anything
  3384. 2:30:32like I just created this random table
  3385. 2:30:35right so this is my random table okay I
  3386. 2:30:40have like let's say three columns ID
  3387. 2:30:42name and marks right this is my random
  3388. 2:30:46table if I create map manage tables if I
  3389. 2:30:51create manage table first of all I want
  3390. 2:30:55to create a database obviously I need a
  3391. 2:30:58database under which I can register my
  3392. 2:31:00table so first of all I will create a
  3393. 2:31:04database oops database okay I will
  3394. 2:31:08create one
  3395. 2:31:09database within this database I will
  3396. 2:31:12create something called as
  3397. 2:31:16table and I will name it as table one
  3398. 2:31:20simple yes I will name it as table
  3399. 2:31:23one within this database right within
  3400. 2:31:27this
  3401. 2:31:28database what will happen what will
  3402. 2:31:31happen what will happen just guess just
  3403. 2:31:33just just make some guess so this is a
  3404. 2:31:37meta store this can be your hive meta
  3405. 2:31:40store this can be your Unity meta store
  3406. 2:31:42So Meta store is basically the
  3407. 2:31:45repository where we store all the uh
  3408. 2:31:48definitions database definition
  3409. 2:31:50schema definitions table definitions all
  3410. 2:31:53the definitions all the metadata right
  3411. 2:31:56so this is the meta
  3412. 2:31:58store okay when we create any table in
  3413. 2:32:02data bricks manage table let's talk
  3414. 2:32:04about manage table when we create any
  3415. 2:32:06manage table what will happen let's say
  3416. 2:32:09this is the table one right so in this
  3417. 2:32:12particular meta store in this particular
  3418. 2:32:15meta store our database definition will
  3419. 2:32:18be stored
  3420. 2:32:20let's say our database name is sales
  3421. 2:32:22like sales DB right let's let's say
  3422. 2:32:24let's call it as sales DB okay and
  3423. 2:32:28within this we have a table
  3424. 2:32:30called table
  3425. 2:32:33one so this information will be stored
  3426. 2:32:37here yes this information will be stored
  3427. 2:32:40here that under this
  3428. 2:32:43database we have a
  3429. 2:32:45table but but but but but but this is
  3430. 2:32:50our cloud storage this is our data Lake
  3431. 2:32:52this is our your cloud storage or maybe
  3432. 2:32:54awss 3 or anything this is the cloud
  3433. 2:32:57storage actually the data brakes
  3434. 2:33:01workspace have one default storage
  3435. 2:33:03account as you remember we created
  3436. 2:33:05manage Resource Group in the beginning
  3437. 2:33:08for just for the uh datab Brak workspace
  3438. 2:33:10and I told you that datab braks manages
  3439. 2:33:12it and we do not touch it this is the
  3440. 2:33:15part of that Resource Group in that
  3441. 2:33:17particular Resource Group it will create
  3442. 2:33:19one storage account as
  3443. 2:33:21well and when we say store our manage
  3444. 2:33:26Delta table store our managed table it
  3445. 2:33:30will store the metad data in The Meta
  3446. 2:33:33store and the actual data that means
  3447. 2:33:37records ID marks um like names
  3448. 2:33:41everything will be stored in
  3449. 2:33:44this actual data Lake yes data will get
  3450. 2:33:50stored in cloud storage which is the
  3451. 2:33:53default account which is the default
  3452. 2:33:56storage account or default data Lake
  3453. 2:33:58which is given to datab Brees
  3454. 2:34:01workspace interesting yeah it is
  3455. 2:34:04interesting because we just store the
  3456. 2:34:06metadata in meta store it can be your
  3457. 2:34:09hive metast store I will show you don't
  3458. 2:34:10worry I will show you everything I'm
  3459. 2:34:11just giving you the concepts I just
  3460. 2:34:13giving you the knowledge right now so
  3461. 2:34:17this is the meta store and act data is
  3462. 2:34:20residing in the data
  3463. 2:34:23Lake yes so if we want to that is the
  3464. 2:34:30difference between manage and external
  3465. 2:34:31as well just listen it carefully if we
  3466. 2:34:34want
  3467. 2:34:35to delete this table let's say I want to
  3468. 2:34:38drop this table after creating it so and
  3469. 2:34:42as we know that this is the real data
  3470. 2:34:43sitting inside
  3471. 2:34:44this data bricks will delete the table
  3472. 2:34:49definition obviously and this will
  3473. 2:34:52delete the data as well because this is
  3474. 2:34:55managed by the data breaks that's why it
  3475. 2:34:58is called managed table managed Delta
  3476. 2:35:04table got it this is the managed table
  3477. 2:35:08in data bricks and let me tell you the
  3478. 2:35:12external table now and it is so easy for
  3479. 2:35:15you now to grasp the concept of external
  3480. 2:35:17table I'm so sure you will just grasp it
  3481. 2:35:19like this
  3482. 2:35:41so in case of external Delta tables I
  3483. 2:35:45know you have noticed one thing that our
  3484. 2:35:48cloud storage is change from default to
  3485. 2:35:51our own now in this particular
  3486. 2:35:55scenario in this particular scenario we
  3487. 2:35:59have we have here default storage as
  3488. 2:36:02well yeah we have let me write it for
  3489. 2:36:04you we have because it is attached to
  3490. 2:36:07the datab brakes workspace yes so I will
  3491. 2:36:10just write
  3492. 2:36:12Cloud
  3493. 2:36:14default we have Cloud default as well
  3494. 2:36:18and at the same time we we have external
  3495. 2:36:20storage account as well obviously we
  3496. 2:36:23have created storage account but listen
  3497. 2:36:25it carefully let's say this time we have
  3498. 2:36:28data we have table right and we
  3499. 2:36:32have the database let's say let's keep
  3500. 2:36:35the database name same which is sales
  3501. 2:36:39DB and table name is table
  3502. 2:36:43one
  3503. 2:36:45okay okay
  3504. 2:36:47so when we Define when we create
  3505. 2:36:50external table obviously this
  3506. 2:36:53information will be stored in the meta
  3507. 2:36:56store let me write it for you bro please
  3508. 2:36:59make notes bro bro bro I'm repeating it
  3509. 2:37:03again and again and bro means boys and
  3510. 2:37:06girls both men and ladies both so just
  3511. 2:37:10create your notes on your own just take
  3512. 2:37:13your not take notes on your own please
  3513. 2:37:16I'm repeating this again and again
  3514. 2:37:17because this knowledge is something that
  3515. 2:37:19you you need to revise again and again
  3516. 2:37:21so please please please take notes
  3517. 2:37:23please take notes so this data will be
  3518. 2:37:27stored in the meta store which data Only
  3519. 2:37:30The Meta data so we will simply
  3520. 2:37:35write sales DB
  3521. 2:37:39and table one perfect table one this
  3522. 2:37:43definition is here but but in the
  3523. 2:37:47previous scenario our data was residing
  3524. 2:37:50in this default storage but this time
  3525. 2:37:53our data will be residing here in our
  3526. 2:37:56storage account okay but why you are so
  3527. 2:37:59happy with this information because let
  3528. 2:38:01me tell you the answer so this is the
  3529. 2:38:04data that is sitting here let me just
  3530. 2:38:05create the data okay now if I want to
  3531. 2:38:09drop this table if I want to delete this
  3532. 2:38:12whole table it will obviously remove the
  3533. 2:38:16metadata from The Meta store because we
  3534. 2:38:17do not need it but but but but but but
  3535. 2:38:21this data will not get deleted because
  3536. 2:38:24this is my own storage account data
  3537. 2:38:27breaks is not allowed to drop data from
  3538. 2:38:30my storage account this is the power of
  3539. 2:38:33external table this is the reason that
  3540. 2:38:35we most of the times deal with external
  3541. 2:38:38tables in the organization because we do
  3542. 2:38:40not want to drop the data yes in some
  3543. 2:38:42scenarios we want but in most of the
  3544. 2:38:44scenarios we do not want so this is the
  3545. 2:38:47external table it will not not drop the
  3546. 2:38:50data from my storage account I know you
  3547. 2:38:52really excited to actually see these
  3548. 2:38:54Concepts live in Practical yes I'm just
  3549. 2:38:58about to show you all these things
  3550. 2:39:00practically and let's get started with
  3551. 2:39:03this concept manage Delta tables versus
  3552. 2:39:06external Delta tables let's see so if we
  3553. 2:39:10just go to our datab notebook and here I
  3554. 2:39:14will just add one heading or let's say a
  3555. 2:39:18markdown percentage MD and let's create
  3556. 2:39:21heading to so here we will write
  3557. 2:39:25managed
  3558. 2:39:26versus external Delta
  3559. 2:39:30tables I'm so so so thirsty right now
  3560. 2:39:35so I just want you to learn I just want
  3561. 2:39:38you to learn so that's why like I I just
  3562. 2:39:41want to devote my all the time to just
  3563. 2:39:44mention all the things that are relevant
  3564. 2:39:46for this particular topic data brakes
  3565. 2:39:48obviously Delta leg is like one of the
  3566. 2:39:50most in demand tool in demand technology
  3567. 2:39:54in demand file format it is like
  3568. 2:39:56everything so first of all let's create
  3569. 2:39:58one manage table so now you will ask me
  3570. 2:40:00like how we can create manage table
  3571. 2:40:02syntax is really really easy it is
  3572. 2:40:05similar to SQL let me show you how you
  3573. 2:40:07can create so let's create our manage
  3574. 2:40:09table so I will simply write one more
  3575. 2:40:13markdown and I will make it bold and I
  3576. 2:40:16will call it as manage table
  3577. 2:40:19perfect okay let me write the code so
  3578. 2:40:22first of all you can uh switch the
  3579. 2:40:25default language from here and you know
  3580. 2:40:26the magic command now now you're smart
  3581. 2:40:28you can simply write poage SQL hit enter
  3582. 2:40:31now you can just write your uh SQL code
  3583. 2:40:33because obviously we use SQL to create
  3584. 2:40:36uh let's say Delta tables you can also
  3585. 2:40:38use uh data frame API as well there's no
  3586. 2:40:40need to just say okay okay we just want
  3587. 2:40:43to use SQL no you can use data frame API
  3588. 2:40:45as well but Mo but most of the times we
  3589. 2:40:47use SQL and it is really easy to grasp
  3590. 2:40:49the concept once you know the concept
  3591. 2:40:51then you can just play with every
  3592. 2:40:52possible scenario but it is really
  3593. 2:40:55important for the understanding you
  3594. 2:40:56learn it from SQL point of view why
  3595. 2:40:59because you are already familiar with
  3596. 2:41:00SQL obviously you would have like
  3597. 2:41:02created tables in SQL right so that's
  3598. 2:41:04why just telling you for your benefits
  3599. 2:41:09okay let's create it create and oh okay
  3600. 2:41:13okay first of all we need to create
  3601. 2:41:15database you are smart you are smart
  3602. 2:41:17first of all we need to create database
  3603. 2:41:18so first of all I just add one cell here
  3604. 2:41:21and I will make markdown for my database
  3605. 2:41:24make it bold so I
  3606. 2:41:26will say
  3607. 2:41:29database
  3608. 2:41:31database and done and I will simply
  3609. 2:41:34write percentage SQL let's first create
  3610. 2:41:36database
  3611. 2:41:39man so what's this index for creating
  3612. 2:41:41database it is as similar to SQL
  3613. 2:41:44create
  3614. 2:41:46database and then database name will be
  3615. 2:41:48sales DB let's keep it same so that you
  3616. 2:41:50can learn and you can relate let's run
  3617. 2:41:52it let's run it okay it's done it's done
  3618. 2:41:57okay now we have successfully created
  3619. 2:41:58database and now we know our database
  3620. 2:42:01will get stored in the meta store right
  3621. 2:42:04right now we will create manage table
  3622. 2:42:07first okay
  3623. 2:42:09create table table name will be
  3624. 2:42:13obviously starting with sales DB because
  3625. 2:42:15this is our database now what table name
  3626. 2:42:17you need to select let's say I want to
  3627. 2:42:22keep it as man table that is manage
  3628. 2:42:24table right man
  3629. 2:42:26table man table man table short and like
  3630. 2:42:30to the point to the point then once you
  3631. 2:42:33write this now what we need to do we
  3632. 2:42:35need to define the columns within it
  3633. 2:42:37okay I will simply hit enter and open
  3634. 2:42:39the braces I will simply create three
  3635. 2:42:42columns ID data is very smart he knows
  3636. 2:42:45like I love ID columns next will be my
  3637. 2:42:47name not my name
  3638. 2:42:49name String and then let's say marks
  3639. 2:42:53right marks will be int okay now we need
  3640. 2:42:57to Define delta we will write using
  3641. 2:43:02Delta why because we are creating Delta
  3642. 2:43:04tables now here's the thing bro just
  3643. 2:43:08hold on so here's the thing if you want
  3644. 2:43:11to create external table using any
  3645. 2:43:13different file format let's say pocket
  3646. 2:43:15you can create that if you want to
  3647. 2:43:17create external table like manage table
  3648. 2:43:19with CSV you can create with CSV but
  3649. 2:43:21nowadays we most of the times create Del
  3650. 2:43:24uh Delta tables so that's why we use
  3651. 2:43:26Delta and data brakes has also adapted
  3652. 2:43:29this so it has seen that most of the
  3653. 2:43:31times people do create tables using
  3654. 2:43:33Delta format so it has created this as
  3655. 2:43:37default table format so if we do not
  3656. 2:43:40Define anything it will automatically
  3657. 2:43:41create Delta table format but being an
  3658. 2:43:44efficient data engineer you should
  3659. 2:43:45always write using Delta because it
  3660. 2:43:49promotes readability because you are
  3661. 2:43:51writing code for yourself as well as for
  3662. 2:43:54others as well so that they can read and
  3663. 2:43:56understand so here see it is suggesting
  3664. 2:43:58me pocket bro we do not work with pocket
  3665. 2:44:01we are Delta
  3666. 2:44:02peeps so it is done it is done it has
  3667. 2:44:05created our Delta table I will run
  3668. 2:44:10it whoa sales DV okay I just used a
  3669. 2:44:13different spelling like SES
  3670. 2:44:16TV okay okay my my bad okay okay I
  3671. 2:44:19accept it bro okay now it is creating a
  3672. 2:44:21Delta table wow it is created we have
  3673. 2:44:23created our first Delta table we want to
  3674. 2:44:25query it wait hold on let just insert
  3675. 2:44:28some data in this so that you can query
  3676. 2:44:30it and actually feel
  3677. 2:44:32it okay so how we can just insert the
  3678. 2:44:35data it is same as SQL exact same that's
  3679. 2:44:38why I picked like SQL API to just
  3680. 2:44:40explain you these Concepts so that you
  3681. 2:44:41do not need to suffer of the concept
  3682. 2:44:43that you already know you will only
  3683. 2:44:45focus on the concept that are new right
  3684. 2:44:48right
  3685. 2:44:50okay we will write insert into and then
  3686. 2:44:53obviously sales DB dot table name table
  3687. 2:44:57name is man
  3688. 2:44:59table then same way we need to just
  3689. 2:45:02insert the values like one and name will
  3690. 2:45:04be AA then marks will be let's say 30
  3691. 2:45:08who is this guy with 30 marks
  3692. 2:45:10man okay let's two and then BB let's say
  3693. 2:45:15then
  3694. 2:45:1633 then oh
  3695. 2:45:19I ran it by mistake wait wait wait I ran
  3696. 2:45:23it by mistake I just hit like shift plus
  3697. 2:45:24enter instead of enter wait wait wait
  3698. 2:45:26wait wait hold on hold on hold on okay
  3699. 2:45:29just hold on
  3700. 2:45:33so
  3701. 2:45:34[Music]
  3702. 2:45:36uhuh okay perfect so now I will say
  3703. 2:45:39three do
  3704. 2:45:42CC and then let's say
  3705. 2:45:4735 okay okay perfect and
  3706. 2:45:51now why is throwing error here why why
  3707. 2:45:54why let me run it
  3708. 2:45:58now near
  3709. 2:46:01one oh I didn't add values keyword oh
  3710. 2:46:05bro see it also suggests as the uh right
  3711. 2:46:08thing I I love data brakes I love data
  3712. 2:46:10brakes so instead of accept and we can
  3713. 2:46:13use accept and run command as well but I
  3714. 2:46:15will reject it and I will hardcode it so
  3715. 2:46:17you need to just write values
  3716. 2:46:20my bad because I was just discussing
  3717. 2:46:22something unimportant which was like who
  3718. 2:46:25scored like marks 30 so I want to insert
  3719. 2:46:28one more value let's say four and then
  3720. 2:46:31DD and then 40 who scored 40
  3721. 2:46:37mons okay let's not be judgmental so I
  3722. 2:46:41will just run this command and it should
  3723. 2:46:43just insert the values in my table now I
  3724. 2:46:46am excited to see the output how you can
  3725. 2:46:49query this table you can use select
  3726. 2:46:52statement as you use in SQL yes exactly
  3727. 2:46:55same so I would like to query this I
  3728. 2:46:58would like to query this first of all I
  3729. 2:47:01will write percentage SQL then I will
  3730. 2:47:03say select
  3731. 2:47:05ax oops from
  3732. 2:47:09sales
  3733. 2:47:10db.
  3734. 2:47:12manable I want to run this I will run
  3735. 2:47:14this and you will see your Delta table
  3736. 2:47:17you will see your Delta table
  3737. 2:47:20wow wow wow wow and this is your managed
  3738. 2:47:24table this is your managed table yes
  3739. 2:47:29this is not your external table this is
  3740. 2:47:31your managed
  3741. 2:47:33table right okay so now here is the
  3742. 2:47:37thing this data is stored in this
  3743. 2:47:41catalog if you go to catalog I will show
  3744. 2:47:43you the meta store just click on
  3745. 2:47:46it okay and then when you you just click
  3746. 2:47:49on this so now you can see sales DB now
  3747. 2:47:53you can see sales DB this is your
  3748. 2:47:55definition this is your repeat repeat
  3749. 2:47:58with me this is your only definition
  3750. 2:48:00when I click on it I should see the
  3751. 2:48:02table okay I should see the table this
  3752. 2:48:06is our meta store this is also called as
  3753. 2:48:09hi meta store and nowadays you you would
  3754. 2:48:12also see like Unity meta
  3755. 2:48:13store this is the meta store where is
  3756. 2:48:16the data written where is the actual ual
  3757. 2:48:19data actual data is stored in the data
  3758. 2:48:22Lake SL storage account of this data
  3759. 2:48:26bricks workspace which was created at
  3760. 2:48:29the time of this workspace
  3761. 2:48:32creation simple that means we do not
  3762. 2:48:35have any control over that data do you
  3763. 2:48:38want to test it let me show you bro let
  3764. 2:48:41me go to this recents and let me just go
  3765. 2:48:44to Delta Lake
  3766. 2:48:46and now if if I
  3767. 2:48:50just if I just drop this table I want to
  3768. 2:48:54drop this table I want to drop this
  3769. 2:48:56table this will drop the data as well
  3770. 2:49:00because I do not have any control data
  3771. 2:49:02briak is managing the data for me let me
  3772. 2:49:04show
  3773. 2:49:05you let me
  3774. 2:49:08write percentage
  3775. 2:49:10SQL
  3776. 2:49:12drop
  3777. 2:49:15table uh sales DB man table let me drop
  3778. 2:49:20it let me drop it it is dropped it is
  3779. 2:49:25dropped now if I just run this command
  3780. 2:49:27select srix from it it should not run it
  3781. 2:49:30should not
  3782. 2:49:31run it should not run it will throw an
  3783. 2:49:34error that there's not table because it
  3784. 2:49:36is dropped and data is also dropped
  3785. 2:49:37because I do not have any control over
  3786. 2:49:39that data but but but but oh man I'm so
  3787. 2:49:44tired ah
  3788. 2:49:47but here's the thing when we create
  3789. 2:49:50external table when we create external
  3790. 2:49:54table our data will not get deleted
  3791. 2:49:57let's create external table let's create
  3792. 2:49:59it and how you can create external table
  3793. 2:50:01it is same same you just need to add one
  3794. 2:50:03line of code it is same let me show you
  3795. 2:50:06so let's create external table I need
  3796. 2:50:09water I will definitely have full glass
  3797. 2:50:12of water after this this this session
  3798. 2:50:14like this uh external table okay so let
  3799. 2:50:18me just add add a heading so percentage
  3800. 2:50:20MD then we will write something called
  3801. 2:50:22as external table let me make it
  3802. 2:50:25bold external table okay perfect
  3803. 2:50:30external table let me run it so now I
  3804. 2:50:34will create external table first of all
  3805. 2:50:35I will write percentage SQL then I will
  3806. 2:50:38say create
  3807. 2:50:39table sales DB under the same database
  3808. 2:50:43obviously sales DB dot external table
  3809. 2:50:47instead of man table it not now this
  3810. 2:50:48time is external table now I will Define
  3811. 2:50:52the same thing ID integer right
  3812. 2:50:58name and
  3813. 2:51:00string then we have
  3814. 2:51:03marks not
  3815. 2:51:04marks I'm not Elon
  3816. 2:51:07Musk marks and then we have int by the
  3817. 2:51:12way I love Elon Musk I love I love that
  3818. 2:51:15math so now everything is same obviously
  3819. 2:51:18we need to Define delta using Delta
  3820. 2:51:21what's that what's after this I know
  3821. 2:51:23like this is the same step we have done
  3822. 2:51:25for manage table when you write one more
  3823. 2:51:28line it will become external table what
  3824. 2:51:30was the fundamental in external table we
  3825. 2:51:33stored the data in our own storage
  3826. 2:51:36account what does it mean it means we
  3827. 2:51:39need to provide the location where we
  3828. 2:51:41need to save our data so we will simply
  3829. 2:51:43write location and then I will write the
  3830. 2:51:46location AB FSS
  3831. 2:51:49and this time I want to save it at
  3832. 2:51:52destination and obviously my storage
  3833. 2:51:55account name which is datal
  3834. 2:51:58lunch.
  3835. 2:52:00DFS doc. windows.net
  3836. 2:52:03and then I will create a folder called
  3837. 2:52:06sales
  3838. 2:52:08DB then within that I will call this at
  3839. 2:52:11as external table external table let's
  3840. 2:52:14let's do it okay once it is done we want
  3841. 2:52:18to run it and you will see the magic I I
  3842. 2:52:20will show you the magic not the magic it
  3843. 2:52:22is just like the functionality of
  3844. 2:52:25external table now it is creating
  3845. 2:52:27external table it has created external
  3846. 2:52:29table right now I want to insert the
  3847. 2:52:33data as we have inserted the data for
  3848. 2:52:35this table so I will just copy it from
  3849. 2:52:36here and I will insert the same values
  3850. 2:52:39here within our external
  3851. 2:52:41table okay and obviously we're inserting
  3852. 2:52:45the values in external table
  3853. 2:52:48okay let's insert
  3854. 2:52:51it values are inserted values are
  3855. 2:52:54inserted
  3856. 2:52:56now I want to query
  3857. 2:52:58this percentage
  3858. 2:53:03SQL
  3859. 2:53:06select Ax
  3860. 2:53:09from csdb do external table do external
  3861. 2:53:14table let's run this
  3862. 2:53:18perfect perfect perfect perfect perfect
  3863. 2:53:21and if you want to see this data this
  3864. 2:53:24table we need to just go to the catalog
  3865. 2:53:27then within the high meta store we
  3866. 2:53:28should see this table external table now
  3867. 2:53:30it is now it is external table okay this
  3868. 2:53:34is here we know but an you told us that
  3869. 2:53:38our data is residing in our data L yeah
  3870. 2:53:40I'm not lying I'm not
  3871. 2:53:43lying so H I need to stretch so if you
  3872. 2:53:48want to see the data I can just show you
  3873. 2:53:50okay so if you just go to your storage
  3874. 2:53:53account just go to your storage account
  3875. 2:53:55and just select your destination
  3876. 2:53:57container within that container you will
  3877. 2:53:59see a new folder created it's called
  3878. 2:54:02sales DB it's called sales
  3879. 2:54:05DB what is this this is our database
  3880. 2:54:09when you click in this like when you
  3881. 2:54:11click on this folder you will see
  3882. 2:54:13another folder in this folder external
  3883. 2:54:16table this is our table when you just
  3884. 2:54:18click on this table you will see the
  3885. 2:54:22Delta Theta this is your Delta
  3886. 2:54:25log this is your actual data actual
  3887. 2:54:29actual physical data which is in our
  3888. 2:54:31control now I will show you the command
  3889. 2:54:34I will just run the drop command let me
  3890. 2:54:36just show
  3891. 2:54:38it so when you just run the drop command
  3892. 2:54:42now when you just run the drop command
  3893. 2:54:44let me just run the drop command drop
  3894. 2:54:49table and what was the schema oh ssdb do
  3895. 2:54:54external
  3896. 2:54:55table now when you just do this oh I
  3897. 2:54:58just provided the wrong
  3898. 2:55:00spelling table Yeah I was a little bit
  3899. 2:55:04more excited so now what T like like our
  3900. 2:55:06table is dropped right if I just go to
  3901. 2:55:08my catalog or not even go to catalog I
  3902. 2:55:10can just query it when I just query it
  3903. 2:55:14it should not give me the table because
  3904. 2:55:16it is dropped from the meta store as
  3905. 2:55:18well but you will see the data residing
  3906. 2:55:20here let me just open the destination
  3907. 2:55:22table again I will still see the sales
  3908. 2:55:24DB I will still see the external table I
  3909. 2:55:26will still see the data and Delta log
  3910. 2:55:29bro you are just making us a fool just
  3911. 2:55:31refresh it okay let me click on refresh
  3912. 2:55:34it is still here it is in our control
  3913. 2:55:36that's called external table external
  3914. 2:55:38Delta
  3915. 2:55:41table was it helpful I think so so this
  3916. 2:55:45is all about manage versus external
  3917. 2:55:48Delta
  3918. 2:55:49tables now we will level up our skills
  3919. 2:55:55how let me tell you let me tell you let
  3920. 2:55:58me tell you so now what we will be doing
  3921. 2:56:01we will discuss the functionalities of
  3922. 2:56:03Delta L what you can do with Delta
  3923. 2:56:06tables now you are clear with manage
  3924. 2:56:08versus external tables now obviously you
  3925. 2:56:11will just work with external table why
  3926. 2:56:13because you will see the results at the
  3927. 2:56:15same time because you can look at the
  3928. 2:56:16data but in case of manage table you can
  3929. 2:56:19so we will carry forward our lessons
  3930. 2:56:21with external tabl so that you can grasp
  3931. 2:56:23the knowledge so that you can just
  3932. 2:56:25compare the data now now now now it's
  3933. 2:56:28time to discuss the functionalities of
  3934. 2:56:31Delta tables and before that let me
  3935. 2:56:34drink some water I'll be come back in
  3936. 2:56:37just a few minutes all good all good all
  3937. 2:56:39good yeah I just made my protein shake
  3938. 2:56:43that was really really
  3939. 2:56:46required no worries that will get
  3940. 2:56:48compensated when you will show lots of
  3941. 2:56:51lots of love so that's what I want so
  3942. 2:56:55now we will discuss Delta table's
  3943. 2:56:57functionalities and we will cover all
  3944. 2:57:00all all the functionalities and you will
  3945. 2:57:02be amazed by the knowledge that you will
  3946. 2:57:04get right now so I was also amazed when
  3947. 2:57:07I got to know okay this is like this is
  3948. 2:57:10the thing like how things are working
  3949. 2:57:12let me give you a hint let me give you a
  3950. 2:57:14hint okay let's not give you a hint let
  3951. 2:57:17let me show you okay let me just write a
  3952. 2:57:19heading percentage MD and we'll call it
  3953. 2:57:23as first of all it would be heading
  3954. 2:57:26three or let's say heading two okay
  3955. 2:57:29let's say heading two and we will call
  3956. 2:57:31it as Delta
  3957. 2:57:32tables don't worry I will provide this
  3958. 2:57:34notebook so that you can just keep it
  3959. 2:57:36for reference and you can just give like
  3960. 2:57:38make notes out of it Delta tables
  3961. 2:57:43functionalities functionalities
  3962. 2:57:50okay so what we will be discussing in
  3963. 2:57:54this almost everything almost everything
  3964. 2:57:57okay first of all let's perform like I
  3965. 2:58:00will I will perform like all the DML
  3966. 2:58:02operations that we perform like delete
  3967. 2:58:04update insert then alter table like
  3968. 2:58:07everything and we will learn everything
  3969. 2:58:10one by one and I will also tell you a
  3970. 2:58:12concept called tombstoning don't worry
  3971. 2:58:14don't worry don't worry I will just
  3972. 2:58:16discuss everything first of all let's
  3973. 2:58:17perform one function that is insert
  3974. 2:58:20right percentage MD and I will make it
  3975. 2:58:22bold and let's call it as insert right
  3976. 2:58:26perfect so I want to insert some more
  3977. 2:58:29data in my Delta table and I want to see
  3978. 2:58:31the uh like how it will write my data
  3979. 2:58:35right like how it will store my data
  3980. 2:58:36behind the scenes so first of all I need
  3981. 2:58:39to recreate the data so for that I can
  3982. 2:58:43just copy the command that is what
  3983. 2:58:44create table so that it can create the
  3984. 2:58:47data again
  3985. 2:58:50right or I can just rerun it from here
  3986. 2:58:52as well there's no need to worry about
  3987. 2:58:55it and I can just remove this drop
  3988. 2:58:58command where it is here I can just
  3989. 2:59:00remove this drop command and I can just
  3990. 2:59:02rerun those steps and before that I can
  3991. 2:59:04just delete that folder as well like
  3992. 2:59:07which is external table because I'm just
  3993. 2:59:09recreating this table so do not need to
  3994. 2:59:11worry just delete this table because I
  3995. 2:59:14just wanted to show you that data
  3996. 2:59:16resides there so I'm just recreating
  3997. 2:59:17this table
  3998. 2:59:18this one let me run
  3999. 2:59:21this
  4000. 2:59:30mhm it is creating our Delta table again
  4001. 2:59:33with the same
  4002. 2:59:38location uh uh
  4003. 2:59:41uh do it fast bro do it fast
  4004. 3:00:06H okay yeah sometimes like I just
  4005. 3:00:09restarted my cluster because I just I
  4006. 3:00:11just went to make my protein shake so
  4007. 3:00:14that's why so whenever we just run the
  4008. 3:00:17very first after that like after
  4009. 3:00:19restarting the cluster it takes some
  4010. 3:00:20time but no need to worry no need to
  4011. 3:00:21worry so obviously I will just insert
  4012. 3:00:23this data
  4013. 3:00:25yeah data is inserted perfect now I will
  4014. 3:00:29just see this data yeah I want to see it
  4015. 3:00:37[Music]
  4016. 3:00:52H why it is
  4017. 3:00:54waiting let me just rerun
  4018. 3:00:57it yeah it is
  4019. 3:01:00done what problem has occurred oh I just
  4020. 3:01:02reran it
  4021. 3:01:04okay let me wait until it has done
  4022. 3:01:25let's canel it reload page let's reload
  4023. 3:01:28the page make like giving some fishy
  4024. 3:01:32errors let's reload the whole page so
  4025. 3:01:34now it is
  4026. 3:01:36refreshed I don't know it was like due
  4027. 3:01:39to maybe internet connection or maybe
  4028. 3:01:40internal error I don't know so I just
  4029. 3:01:41refreshed it so now it is working fine
  4030. 3:01:43so as we can see that our data is there
  4031. 3:01:46and it has recreated the external TB on
  4032. 3:01:47top of it that's good that's good so now
  4033. 3:01:50we want to perform a function or let's
  4034. 3:01:53say a DML command that is insert so I
  4035. 3:01:57will just copy this code insert
  4036. 3:01:59obviously I will update the values don't
  4037. 3:02:01worry so now I want to insert more
  4038. 3:02:04records can it allow us to do that
  4039. 3:02:07obviously bro you can so let's say I
  4040. 3:02:10want to insert
  4041. 3:02:13five four six 54 wow wow wow wow wow
  4042. 3:02:17punch hats off man you have done
  4043. 3:02:20Bachelor of Science in mathematics and
  4044. 3:02:21you are saying four after five very very
  4045. 3:02:25well done very well done okay very well
  4046. 3:02:28done
  4047. 3:02:29so basically we will now insert the
  4048. 3:02:33values inside the table so it can allow
  4049. 3:02:36us but the whole intention is totally
  4050. 3:02:39different and I will tell you what's
  4051. 3:02:41that let me just first run this and it
  4052. 3:02:44ran successfully as expected and now I
  4053. 3:02:47want to quer quer the data select ASX
  4054. 3:02:50from sales DB do external table perfect
  4055. 3:02:54I will query
  4056. 3:02:56it obviously I can see four new records
  4057. 3:02:595 6 7 8
  4058. 3:03:00yes like can you imagine like you know
  4059. 3:03:04that we have parket
  4060. 3:03:07files behind this table right behind
  4061. 3:03:10this external tables so what just
  4062. 3:03:14happened with that pocket file let me
  4063. 3:03:16show you when you just check
  4064. 3:03:20the data L and you just go to your
  4065. 3:03:23container which is
  4066. 3:03:25destination and within the destination
  4067. 3:03:27just go to your ssdb which is your
  4068. 3:03:29database external table is your table
  4069. 3:03:31now a new file is added see now new file
  4070. 3:03:35is added new file is added part 00
  4071. 3:03:40hyphen e a44
  4072. 3:03:43e so it has inserted a new pocket file
  4073. 3:03:48right and do you want to know what has
  4074. 3:03:50just happened in Delta log let me tell
  4075. 3:03:52you a new Json file is inserted which is
  4076. 3:03:56called this
  4077. 3:03:59one which is this one
  4078. 3:04:02Jason yes so what it has done let me
  4079. 3:04:06just open it for
  4080. 3:04:07you if you go to edit you will see it
  4081. 3:04:11said add part
  4082. 3:04:150000 ea4 44 that is our latest data in
  4083. 3:04:21Json 1 you will see something called
  4084. 3:04:26as something just got into my eyes
  4085. 3:04:31wait
  4086. 3:04:33bro what was that man yeah it's fixed
  4087. 3:04:39so now this is the pocket file which was
  4088. 3:04:43initially added when we just inserted
  4089. 3:04:45values 1 2 3 4 so this is that thing
  4090. 3:04:50that means that means how it reads our
  4091. 3:04:54data how it reads our data so this is
  4092. 3:04:58our table EXT table folder right so how
  4093. 3:05:02it Delta table read our data so it will
  4094. 3:05:06not go to these partitions
  4095. 3:05:09no it will go to Delta log it will read
  4096. 3:05:14all the Json files Json 0000 that
  4097. 3:05:17consist our metadata 01 had our initial
  4098. 3:05:21load then adjacent 2 had the incremental
  4099. 3:05:24load that is 5678 then after all those
  4100. 3:05:28logs it will read the data accordingly
  4101. 3:05:32this Insight this knowledge will get
  4102. 3:05:34more clear when I will show you the next
  4103. 3:05:37thing which is the delete command which
  4104. 3:05:41is the delete
  4105. 3:05:42command and we will also learn the
  4106. 3:05:45concept called tomb stoning let me just
  4107. 3:05:47just write it
  4108. 3:05:48here tomb
  4109. 3:05:53stoning tomb stoning oops yep
  4110. 3:05:57tombstoning we will also learn this Con
  4111. 3:06:00concept tombstoning let me show you so
  4112. 3:06:04our insert is done let me show you the
  4113. 3:06:08delete percentage MD and let me make it
  4114. 3:06:13bold delete let's say let's say I want
  4115. 3:06:18to delete this record which is record
  4116. 3:06:20number eight let's say I want to delete
  4117. 3:06:23this record okay let's delete it let's
  4118. 3:06:26delete it syntax is simple right we need
  4119. 3:06:28to just write delete oops let me first
  4120. 3:06:31add percentage SQL then we need we can
  4121. 3:06:34say delete from table which is sales db.
  4122. 3:06:38external table let me tell you what just
  4123. 3:06:40happened so first of all to understand
  4124. 3:06:42what just happened let's go to the Delta
  4125. 3:06:44log okay here's the Delta log
  4126. 3:06:48first of all in the Delta log Json 0000
  4127. 3:06:51this is created this was created when we
  4128. 3:06:54defined the table when we didn't have
  4129. 3:06:55any data okay let's skip this now in
  4130. 3:06:58Json 1 what we have what we have we have
  4131. 3:07:03the information that add this partition
  4132. 3:07:06what is this partition just remember the
  4133. 3:07:07name 42b just remember this name
  4134. 3:07:1142b add this partition okay okay and we
  4135. 3:07:15just know we just got to know that
  4136. 3:07:17whenever we read the data in Delta
  4137. 3:07:19tables it first goes to to the Delta log
  4138. 3:07:22it read all the logs and then it read
  4139. 3:07:24the partitions it do not like it does
  4140. 3:07:27not care if there are like 300
  4141. 3:07:29partitions or 3,000 partitions or like
  4142. 3:07:31three lakh poket files no it will only
  4143. 3:07:34read the Delta log whatever it is
  4144. 3:07:37written in the Delta log it will read
  4145. 3:07:39only those pocket files okay it says add
  4146. 3:07:43part 42b remember this 42b okay we added
  4147. 3:07:46it in Json 2 it
  4148. 3:07:49says it in Json 2 it says add c92 as
  4149. 3:07:54well 42b c92 both the partitions were
  4150. 3:07:57headed yeah yeah we we are fine till
  4151. 3:08:00till now okay what just happened then I
  4152. 3:08:05gave the command which is
  4153. 3:08:08delete which is delete command here now
  4154. 3:08:13what pocket or let's say what Delta
  4155. 3:08:15table has done for us it went to all the
  4156. 3:08:19partitions it went here and let me go to
  4157. 3:08:22the folder sales TB external table so
  4158. 3:08:25these three partitions and we know that
  4159. 3:08:28this is the first partition 1 2 3 4 this
  4160. 3:08:30is the second partition 5 6 78 now we
  4161. 3:08:35know that this particular partition had
  4162. 3:08:39the ID equals to
  4163. 3:08:418 right we added 56 78 in the second
  4164. 3:08:45iteration and this partition of or let's
  4165. 3:08:47say this pocket file whenever I say
  4166. 3:08:49partition it's it's called part it's
  4167. 3:08:51called pocket file right so in this
  4168. 3:08:53pocket file it had ID equals to
  4169. 3:08:578 what it has done it has copied this
  4170. 3:09:01data this whole pocket file and it has
  4171. 3:09:06created a new pocket file and it has
  4172. 3:09:09removed that particular record from this
  4173. 3:09:13pocket
  4174. 3:09:14file
  4175. 3:09:16wow it has not deleted the record from
  4176. 3:09:20this file no I will tell you why don't
  4177. 3:09:24worry just hold on hold on it has not
  4178. 3:09:26deleted the record from this partition
  4179. 3:09:29it has created a new Partition in which
  4180. 3:09:33it copied all the data and it removed
  4181. 3:09:37that particular record it removed that
  4182. 3:09:40particular ID that set and it created
  4183. 3:09:42the new
  4184. 3:09:43Partition now in the Delta log it will
  4185. 3:09:47say read this
  4186. 3:09:51partition remove this
  4187. 3:09:53partition read this
  4188. 3:09:55partition that means that means just
  4189. 3:09:59take notes bro this is really important
  4190. 3:10:02that means
  4191. 3:10:03add and then
  4192. 3:10:05remove and then add simple and let me
  4193. 3:10:10just show you let me just confirm you
  4194. 3:10:12let's go to the let me just expand this
  4195. 3:10:17Json number four let me show you it will
  4196. 3:10:21say
  4197. 3:10:23see remove
  4198. 3:10:26this remove
  4199. 3:10:28this and read this now why it has said
  4200. 3:10:34like remove this as well because it has
  4201. 3:10:35combined all the data but the point is
  4202. 3:10:38it has said removed this because this
  4203. 3:10:41had the ID equals to
  4204. 3:10:448 it had ID equal to8 so it removed it
  4205. 3:10:49so it removed this and it removed this
  4206. 3:10:52as well because this parket file just
  4207. 3:10:54had like four record so it said let me
  4208. 3:10:57just recreate one pocket file which is
  4209. 3:10:59the new one e7d and let me combine the
  4210. 3:11:02four uh records of the previous pocket
  4211. 3:11:04file and just three from this new one
  4212. 3:11:08because obviously Delta tables just
  4213. 3:11:10optimize the partitions for us so that
  4214. 3:11:12is a different story let's not go in
  4215. 3:11:14that way but it remov this
  4216. 3:11:17it remov this that that's called Soft
  4217. 3:11:20deletion soft
  4218. 3:11:23deletion it has not actually removed the
  4219. 3:11:26files files are there all the three
  4220. 3:11:28files are there but it has given the
  4221. 3:11:31instructions that do not read this data
  4222. 3:11:33that means remove this partition remove
  4223. 3:11:35this partition and read only this
  4224. 3:11:38partition read only this partition
  4225. 3:11:41because in this partition it has three
  4226. 3:11:43records that is 567 and 1 2 3 4 as as
  4227. 3:11:47well this is called tombstoning that
  4228. 3:11:51means it has tombstoned these two
  4229. 3:11:53partition tombstones mean like yeah yeah
  4230. 3:11:56those ghost modes so this has ghost put
  4231. 3:12:00the put these two partitions in the
  4232. 3:12:02ghost mode or it has blacklisted these
  4233. 3:12:05two
  4234. 3:12:06partitions and let me drink some water
  4235. 3:12:14man it has put these two parties in The
  4236. 3:12:18Blacklist and it has asked just read
  4237. 3:12:21this partition just read this partition
  4238. 3:12:24only just read this partition
  4239. 3:12:27only now now now now when it will read
  4240. 3:12:33the data now when it will read the data
  4241. 3:12:37let's go to destination sales TB
  4242. 3:12:38external table now it has all the three
  4243. 3:12:41partitions and I just mentioned it
  4244. 3:12:43doesn't care how many partitions are
  4245. 3:12:45there it doesn't care so it will
  4246. 3:12:48straightforwardly go to Delta Lake and
  4247. 3:12:49Delta lake has specifically mentioned
  4248. 3:12:51that do not read this because it has
  4249. 3:12:54combined that data do not read this
  4250. 3:12:56because obviously it has deleted some
  4251. 3:12:57data in that one so it has created one
  4252. 3:12:59new Partition which has data from this
  4253. 3:13:02one as well and obviously the data from
  4254. 3:13:06this partition as well see this is
  4255. 3:13:09called
  4256. 3:13:10tombstoning tombstoning in Delta Lake
  4257. 3:13:13just take notes just take notes this is
  4258. 3:13:17the thing that you should
  4259. 3:13:19know so when you perform delete that
  4260. 3:13:22doesn't mean that it has physically
  4261. 3:13:23deleted data no but why why why it it it
  4262. 3:13:29just didn't delete the data let me tell
  4263. 3:13:31you why let me tell you why now here is
  4264. 3:13:35the concept
  4265. 3:13:37called here is the concept called Data
  4266. 3:13:43versioning data versioning let me make
  4267. 3:13:45it bold
  4268. 3:13:48data
  4269. 3:13:50versioning what is this data versioning
  4270. 3:13:52so why it
  4271. 3:13:54didn't just change the partitions why I
  4272. 3:13:57I will I will tell you just wait hold on
  4273. 3:14:00what is data versioning if I want to
  4274. 3:14:02keep a track of all the changes happened
  4275. 3:14:05in our table we can do that how I will
  4276. 3:14:08just WR uh run the command called
  4277. 3:14:12describe oh man who will put percentages
  4278. 3:14:15equal me me me me sorry
  4279. 3:14:19describe
  4280. 3:14:22table describe
  4281. 3:14:24history and then table name sales db.
  4282. 3:14:27exe
  4283. 3:14:29table
  4284. 3:14:32okay we don't want your suggestions bro
  4285. 3:14:34it is showing no suggestions when I run
  4286. 3:14:37this command when I run this command it
  4287. 3:14:40will show me all the versions of my
  4288. 3:14:43table all the versions that means all
  4289. 3:14:46the changes that have happened so far
  4290. 3:14:49all the changes so as you can see
  4291. 3:14:53that the here are the
  4292. 3:14:56operations
  4293. 3:14:59see so
  4294. 3:15:01now
  4295. 3:15:03in0 in
  4296. 3:15:06zero we created our table we created our
  4297. 3:15:11table that means operation is create
  4298. 3:15:15table right
  4299. 3:15:18okay so in the version one we inserted
  4300. 3:15:23the data it says
  4301. 3:15:25right in the version two it says right
  4302. 3:15:31in version three in version three it
  4303. 3:15:37says
  4304. 3:15:38delete it says
  4305. 3:15:41delete that's where we deleted the
  4306. 3:15:44record that's our version number three
  4307. 3:15:47and in the version number four it has
  4308. 3:15:49optimized the table and that we know and
  4309. 3:15:52that we have already talked about like
  4310. 3:15:54it has just combine the partitions we
  4311. 3:15:56will talk about optimizations in just
  4312. 3:15:58few more minutes so do not worry about
  4313. 3:15:59that we will discuss that part later so
  4314. 3:16:01just forget about optimize command let's
  4315. 3:16:03just imagine that we have three three
  4316. 3:16:05versions just just imagine that we just
  4317. 3:16:07have three versions that's it it will be
  4318. 3:16:09good for your understanding just trust
  4319. 3:16:10me okay so now we have all the history
  4320. 3:16:15why do we need to keep the history why
  4321. 3:16:19let me tell you why let's say I just
  4322. 3:16:23missed like I deleted this data which is
  4323. 3:16:26this like ID equals to wa by
  4324. 3:16:29mistake by mistake I want to get this
  4325. 3:16:32data back how we can do that how we can
  4326. 3:16:35just roll back our table you would have
  4327. 3:16:38like heard about roll backs in SQL
  4328. 3:16:41databases we can just do roll backs here
  4329. 3:16:43as well we call it as time travel you
  4330. 3:16:47time travel exactly let me show you let
  4331. 3:16:50me show you it's it's really really good
  4332. 3:16:52let me show you if you have deleted this
  4333. 3:16:54data by mistake and now you want to go
  4334. 3:16:57back to the previous state of the table
  4335. 3:16:59that's why Delta table that's why Delta
  4336. 3:17:03table didn't didn't didn't delete it
  4337. 3:17:07didn't delete these
  4338. 3:17:09partitions didn't the lead these
  4339. 3:17:12partitions got it because it knows that
  4340. 3:17:17we can use time travel to go back in
  4341. 3:17:20time yeah it's similar to doron's time
  4342. 3:17:23travel machine but it is much more
  4343. 3:17:25powerful than that so if I want to do
  4344. 3:17:29that I can how let me show you let me
  4345. 3:17:32show
  4346. 3:17:33you I will just write percentage MD bro
  4347. 3:17:36T trust me this knowledge is really
  4348. 3:17:39really really powerful once you know all
  4349. 3:17:43these things and then when you will just
  4350. 3:17:46sit in the interviews trust
  4351. 3:17:48me trust me that you will make an impact
  4352. 3:17:52trust me because all these things are
  4353. 3:17:55really really
  4354. 3:17:56new all these things are really really
  4355. 3:17:59new so you have really good chances to
  4356. 3:18:03be select to be selected and to actually
  4357. 3:18:07make an impact trust me so I will simply
  4358. 3:18:11write percentage MD and now I will
  4359. 3:18:14simply make it bold and I will write it
  4360. 3:18:17as time travel time travel if we want to
  4361. 3:18:21time travel how we can do it let me just
  4362. 3:18:23show you so as you know that we have
  4363. 3:18:25version 0 1 2 3 right if I want to go to
  4364. 3:18:31version two which was this state which
  4365. 3:18:34was right State when we just added the
  4366. 3:18:37data I want to go to that particular
  4367. 3:18:39version how we can do it we can use
  4368. 3:18:42something called
  4369. 3:18:44as first of all percentages
  4370. 3:18:48SQL oops so we can use a command called
  4371. 3:18:53restore restore table
  4372. 3:18:55name restore table table name sales DB
  4373. 3:18:59and here you can
  4374. 3:19:02see I want to restore my table two
  4375. 3:19:05version as of two two version as of two
  4376. 3:19:08let me just run it two version as of two
  4377. 3:19:12I haven't do I haven't done anything I
  4378. 3:19:14haven't done anything I have just change
  4379. 3:19:17the version of the table now you will
  4380. 3:19:19see ID equals to 8 visible in the table
  4381. 3:19:23that's not magic That's The Power of
  4382. 3:19:26Delta tables That's The Power of Delta
  4383. 3:19:29time travel now let me just query my
  4384. 3:19:32table again percentage SQL
  4385. 3:19:38oops select
  4386. 3:19:41ASX
  4387. 3:19:43from sales db.
  4388. 3:19:47EXT table now you will see ID equals to
  4389. 3:19:508 as well see see you have successfully
  4390. 3:19:54learned how you can perform time travel
  4391. 3:19:56so now if you get any question in the
  4392. 3:19:58interview hey you have mistakenly
  4393. 3:20:00deleted all the data all the data you
  4394. 3:20:02truncated all the data just say I don't
  4395. 3:20:06care because I can just get the data
  4396. 3:20:08back by using time travel by using
  4397. 3:20:11restore command by using versioning
  4398. 3:20:13simple and your recruiter will be like
  4399. 3:20:16okay this boy this girl has really
  4400. 3:20:19skills like has really some amazing
  4401. 3:20:24skills and just tell them like you watch
  4402. 3:20:26my
  4403. 3:20:31videos that's really really
  4404. 3:20:34powerful so now you know how you can
  4405. 3:20:37perform time Travel how you can perform
  4406. 3:20:40time travel let's
  4407. 3:20:43say you have performed time travel okay
  4408. 3:20:46now you will ask me bro is there any way
  4409. 3:20:50that we can actually delete the data
  4410. 3:20:53from the folder let's
  4411. 3:20:56say let me just refresh
  4412. 3:20:59it okay now you will see no partition is
  4413. 3:21:02created because we haven't done anything
  4414. 3:21:04we just went to the previous version
  4415. 3:21:06that's it now you will say hey bro do we
  4416. 3:21:08have anything by which we can just uh
  4417. 3:21:12actually delete like physically delete
  4418. 3:21:15these pocket files
  4419. 3:21:17one option is physically go there and
  4420. 3:21:19delete it no don't you dare do it you
  4421. 3:21:22will break the whole table just trust me
  4422. 3:21:25do not do it how we can do it then so
  4423. 3:21:28there's a command called vacuum
  4424. 3:21:31command I'm just sharing all the
  4425. 3:21:34information don't worry don't worry
  4426. 3:21:35don't worry don't worry bro now you will
  4427. 3:21:37learn each and
  4428. 3:21:39everything related to data breaks and
  4429. 3:21:42Delta link today you will become a pro
  4430. 3:21:45developer not today like obviously you
  4431. 3:21:47are just learning in pieces that's how
  4432. 3:21:49we learn but at the end of this session
  4433. 3:21:53you will be a pro so we have a command
  4434. 3:21:56called vacuum what it will do it will
  4435. 3:21:59just check all the partitions available
  4436. 3:22:02for the table and we have just discussed
  4437. 3:22:05that like let let me just take return
  4438. 3:22:08the version 2 three so that you can just
  4439. 3:22:10relate so let's imagine now recently our
  4440. 3:22:14uh our table is not time travel to
  4441. 3:22:17version two it is still at version three
  4442. 3:22:20that is the latest one like in which we
  4443. 3:22:22do not have ID equals to8 so in that
  4444. 3:22:24scenario you know that we do not use
  4445. 3:22:28these two
  4446. 3:22:29partitions right we do not use these two
  4447. 3:22:32partitions because we just use this
  4448. 3:22:34partition we have seen this come on man
  4449. 3:22:37we have seen this we do not use these
  4450. 3:22:39two partitions because we have Rewritten
  4451. 3:22:41this partition and Rewritten this
  4452. 3:22:43partition as well and we have removed
  4453. 3:22:45the ID equals to8 right when I run
  4454. 3:22:49vacuum command on top of this table it
  4455. 3:22:53will physically remove these partitions
  4456. 3:22:55yes it will physically remove these
  4457. 3:22:58partitions like this one and this one
  4458. 3:23:01just a disclaimer do not try this in
  4459. 3:23:05production do not do not try this in
  4460. 3:23:08production but still you should no like
  4461. 3:23:11you can you can be asked like how you
  4462. 3:23:12can just physically delete you can how
  4463. 3:23:14you can hard delete those files you can
  4464. 3:23:15use a command called vacuum command so
  4465. 3:23:19obviously you should not use it but
  4466. 3:23:21sometimes in some scenarios you have to
  4467. 3:23:22delete it there are some guidelines such
  4468. 3:23:24as gdpr in which customer has the right
  4469. 3:23:27to get their information deleted from
  4470. 3:23:29company's database so under that
  4471. 3:23:31scenario they have to delete it that's
  4472. 3:23:33why we have a command called vacuum
  4473. 3:23:34command so if we want to delete it we
  4474. 3:23:38can just run vacuum command it will
  4475. 3:23:40physically delete these two partitions
  4476. 3:23:42yes trust me it will physically delete
  4477. 3:23:44these two partitions like it will just
  4478. 3:23:46do
  4479. 3:23:47T it will just remove these two
  4480. 3:23:49partitions that's it let me show you let
  4481. 3:23:51me just show
  4482. 3:23:53you obviously we will not uh use vacuum
  4483. 3:23:56command for now like I will just show
  4484. 3:23:57you the uh code because I do not want to
  4485. 3:24:00like delete my files because what what
  4486. 3:24:02is the reason because we lose the power
  4487. 3:24:04of time travel then we cannot perform
  4488. 3:24:06time travel why we do not have files how
  4489. 3:24:09it can go to previous pocket file if it
  4490. 3:24:10doesn't have any pocket file use your
  4491. 3:24:13common sense I know it's not very common
  4492. 3:24:15but my data Comm is very very smart so I
  4493. 3:24:18can assume that you have some common
  4494. 3:24:20sense so I will just show you how you
  4495. 3:24:23can perform uh vacuum command but do not
  4496. 3:24:25run it do not run it if you run it do
  4497. 3:24:27not do not come to me that you because
  4498. 3:24:28of you we have uh lost our data it's up
  4499. 3:24:31to you so my task is just show you
  4500. 3:24:33everything so percentage
  4501. 3:24:36MD because obviously we will just run
  4502. 3:24:38back command I'm just kidding but before
  4503. 3:24:40that I just want to show you the
  4504. 3:24:41optimization commands as well because
  4505. 3:24:43being an efficient data engineer you
  4506. 3:24:45should know how how to optimize the
  4507. 3:24:47Delta tables that's
  4508. 3:24:50the thing that is not everyone aware of
  4509. 3:24:53how and why why is
  4510. 3:24:56like not everyone is updated because you
  4511. 3:25:00need to go through documentation you
  4512. 3:25:02need to read books like
  4513. 3:25:03this I love this book I I love this book
  4514. 3:25:07so you need to go through these books or
  4515. 3:25:10you can just watch my videos and you can
  4516. 3:25:14just take my sessions so that that I can
  4517. 3:25:16just convey I can just transfer that
  4518. 3:25:19information that knowledge with you all
  4519. 3:25:21so you have like both the ways and I
  4520. 3:25:23think you would choose the second option
  4521. 3:25:25no I'm I'm not kidding bro just come on
  4522. 3:25:27like I'm just passing all the
  4523. 3:25:28information like like like like
  4524. 3:25:31this H so now I will just show you the
  4525. 3:25:35vacuum
  4526. 3:25:37command uh I will like to make it
  4527. 3:25:40bold vacuum okay so if you want to run
  4528. 3:25:45vacuum command we simp simply first of
  4529. 3:25:46all we will write personent SQL so then
  4530. 3:25:48we will write
  4531. 3:25:50vacuum right and then we will write
  4532. 3:25:52table name that's it that's it it will
  4533. 3:25:54delete the files now here are some
  4534. 3:25:56points that you need to take that you
  4535. 3:25:58need to note just take your pencil or
  4536. 3:26:00pen just write those points first of all
  4537. 3:26:03when we run this vacuum
  4538. 3:26:05command nothing going to happen why let
  4539. 3:26:08me run it take it nothing nothing will
  4540. 3:26:12happen nothing will happen I'm I'm sure
  4541. 3:26:14I'm sure bro trust me Trust me trust me
  4542. 3:26:17trust me I don't break
  4543. 3:26:19trust so you can trust me so it it is
  4544. 3:26:23just running everything that is required
  4545. 3:26:25and still I will see the partition I
  4546. 3:26:27will I I will let you know like why it
  4547. 3:26:29didn't delete anything because you just
  4548. 3:26:31mentioned that it physically deletes the
  4549. 3:26:33data I will show you and I will tell you
  4550. 3:26:36the reason as well so when I go to this
  4551. 3:26:40external table and when I just refresh
  4552. 3:26:42it I still see like all the partitions
  4553. 3:26:45or all the pocket files see I'm just
  4554. 3:26:47refreshing it again and again now what
  4555. 3:26:49the thing is the default timestamp or
  4556. 3:26:53let's say the default time frame to
  4557. 3:26:55actually delete the data is 7 days that
  4558. 3:26:58means even if your parket files are not
  4559. 3:27:02being used by the tables but if those
  4560. 3:27:05party pocket files are less than 7 days
  4561. 3:27:08old that means they will be there that
  4562. 3:27:10is by
  4563. 3:27:11default that is by
  4564. 3:27:14default so this P these pocket files are
  4565. 3:27:17just created so these are not seven days
  4566. 3:27:19old but if I run the same command after
  4567. 3:27:21seven days these two pocket files these
  4568. 3:27:24two like oh oh oh oh oh oh like this one
  4569. 3:27:27and this one will be deleted but now
  4570. 3:27:31these are not 7 days old so it is fine
  4571. 3:27:33it is fine what if I want another inter
  4572. 3:27:36question what if I want to drop or
  4573. 3:27:39delete the data right now right now I
  4574. 3:27:41don't care about the uh let's say
  4575. 3:27:45Default Time there are two ways way
  4576. 3:27:48number one you can set the default time
  4577. 3:27:50frame you can just change the default
  4578. 3:27:52time frame I can just keep it like maybe
  4579. 3:27:54I can enhance it obviously you can ask
  4580. 3:27:56me to just enhance the time frame I can
  4581. 3:27:57just keep it like for Interval 365 days
  4582. 3:28:00or there's one more command that I can
  4583. 3:28:01add within this vacuum I can say
  4584. 3:28:05retain zero
  4585. 3:28:07hours now if I run it it will delete it
  4586. 3:28:11it will delete it now I will not run it
  4587. 3:28:13so I I can just make a separate
  4588. 3:28:16command for it let's call it as retain
  4589. 3:28:19zero
  4590. 3:28:22hours okay percentage
  4591. 3:28:29MD percentage MD and I want to make it
  4592. 3:28:33bold vacuum retain zero
  4593. 3:28:37hours perfect and here I can just paste
  4594. 3:28:39it so if I run this it will just
  4595. 3:28:42definitely instantly drop these uh
  4596. 3:28:45pocket files and I will show you at the
  4597. 3:28:47end when we will be just finishing our
  4598. 3:28:49session so I will just show you how you
  4599. 3:28:50can do it so do not worry you you will
  4600. 3:28:52get everything that you want right now
  4601. 3:28:54everything so let me just correct it
  4602. 3:28:57because we are just explaining vacuum
  4603. 3:28:58command here yeah perfect so this was
  4604. 3:29:01all about vacuum command how we can just
  4605. 3:29:04drop the data and all now we want to
  4606. 3:29:07know how we can optimize our tables how
  4607. 3:29:09we can optimize our tables so let me
  4608. 3:29:12tell you how you can do the
  4609. 3:29:14optimization okay that's a really
  4610. 3:29:16interesting topic and that is the topic
  4611. 3:29:18that everyone is looking for because
  4612. 3:29:19everyone has data everyone knows how to
  4613. 3:29:21create Delta tables but not everyone
  4614. 3:29:23knows how to optimize those tables to
  4615. 3:29:25improve the performance and that's where
  4616. 3:29:27you can be an outlier in the crowd yep
  4617. 3:29:32let let me tell you let me tell you I'm
  4618. 3:29:33here to tell you everything so first of
  4619. 3:29:35all I will create a new vacuum not
  4620. 3:29:38vacuum command like vacuum command is
  4621. 3:29:39like in my head right now so I will
  4622. 3:29:43first of all tell you let's see the
  4623. 3:29:45headings like what we I have given
  4624. 3:29:47before okay data versioning
  4625. 3:29:51delete Delta functionality oh yeah it's
  4626. 3:29:54fine it's fine let me make it
  4627. 3:29:57bold
  4628. 3:29:59and I will call it
  4629. 3:30:01as optimization command so okay I can
  4630. 3:30:04just create a heading
  4631. 3:30:06then okay
  4632. 3:30:08H3 H3 H3 I will say table Delta
  4633. 3:30:14tables Delta table
  4634. 3:30:18optimization if I want to optimize my
  4635. 3:30:20table how I can optimize my table how
  4636. 3:30:24how how how I will show you the live
  4637. 3:30:26demo as well don't need to worry yeah
  4638. 3:30:29yeah I will show you
  4639. 3:30:33everything
  4640. 3:30:36so let's say we have a table called
  4641. 3:30:38external table and if I want to improve
  4642. 3:30:40the performance first of all you can use
  4643. 3:30:43optimize command so first of all we will
  4644. 3:30:45write here optimize
  4645. 3:30:48percentage MD and then I can make it
  4646. 3:30:50bold and I can call it as
  4647. 3:30:55optimize optimize
  4648. 3:30:58okay when we R run when we Russ when we
  4649. 3:31:02run optimize command on top of our table
  4650. 3:31:05it optimizes the table but I know but
  4651. 3:31:08what exactly it happens like what
  4652. 3:31:11exactly it does to our tables so that it
  4653. 3:31:13is optimized so I will tell you let me
  4654. 3:31:15first show you the
  4655. 3:31:17result select T tricks
  4656. 3:31:20from sales db. external table and I will
  4657. 3:31:24just show you the time it is taking to
  4658. 3:31:26read the data so it took 0.9 in seconds
  4659. 3:31:29right now okay now I will just add a
  4660. 3:31:32cell here and I will write
  4661. 3:31:36optimize oh let me just add
  4662. 3:31:40SQL percentage SQL optimize and then I
  4663. 3:31:43will write sales dbx table let me just
  4664. 3:31:47run it let me just optimize my table and
  4665. 3:31:50now I will just show you the time it has
  4666. 3:31:54taken
  4667. 3:31:55okay
  4668. 3:31:57so
  4669. 3:31:59now it has taken 0.93 seconds now we
  4670. 3:32:03will say hey earlier like it took 0.99
  4671. 3:32:06second and now it it took just 0.93
  4672. 3:32:08second obviously this is a very small
  4673. 3:32:11data set very small just eight records
  4674. 3:32:14you can actually see its powers or its
  4675. 3:32:17results when you use it with the bigger
  4676. 3:32:19table like bigger data sets you will see
  4677. 3:32:23that it is almost almost 30 to 40%
  4678. 3:32:26faster when you use optimized command
  4679. 3:32:28the next command is z order
  4680. 3:32:32by and I will show you what exactly it
  4681. 3:32:34does don't worry I I'm just showing you
  4682. 3:32:36the commands right now so percentage
  4683. 3:32:41MD Now I'm
  4684. 3:32:43hungry literally bro I'm just
  4685. 3:32:46continuous speaking continuous I can't
  4686. 3:32:48speak I am continuously speaking since
  4687. 3:32:51the
  4688. 3:32:55morning no worries no worries no worries
  4689. 3:32:59no
  4690. 3:33:01worries
  4691. 3:33:03so now I will show you the other command
  4692. 3:33:07which is z order
  4693. 3:33:11by Z okay these sounds these sound cool
  4694. 3:33:15like we you also want to know like what
  4695. 3:33:16is happening behind the scenes I will
  4696. 3:33:18tell you just just hold on so Z order by
  4697. 3:33:21command let me just run it and how we
  4698. 3:33:24can run it obviously first of all we
  4699. 3:33:26will write percentage SQL and this is a
  4700. 3:33:28kind of addition to uh optimize command
  4701. 3:33:32Okay in in terms of architecture as well
  4702. 3:33:34and in terms of code as well so first of
  4703. 3:33:36all we will write
  4704. 3:33:37optimize and then table
  4705. 3:33:39name and then we will write z order by
  4706. 3:33:43and then we need to just Define a maybe
  4707. 3:33:45any Colum let's say ID let's say ID and
  4708. 3:33:49I think I need to use single code I
  4709. 3:33:50don't know we can just test it or
  4710. 3:33:52without it is fine yeah let's let's run
  4711. 3:33:56it okay and now we can just
  4712. 3:34:00see
  4713. 3:34:02select estx from CS db. external
  4714. 3:34:07table okay now it took wow now you can
  4715. 3:34:11see the difference 0.37 seconds when we
  4716. 3:34:14use Z order by command
  4717. 3:34:16and it it is I think almost almost
  4718. 3:34:191/3 it took like 1/3 of the total time
  4719. 3:34:22can you imagine one3 of the total time
  4720. 3:34:26wow so what it has done like what
  4721. 3:34:29exactly it has done I will tell you let
  4722. 3:34:31me first show you the folder like how it
  4723. 3:34:34looks like right now now you will see
  4724. 3:34:37another folder like another pocket file
  4725. 3:34:39yeah this was
  4726. 3:34:41expected and that means when we just
  4727. 3:34:44check the Delta log it will
  4728. 3:34:46say remove all the partitions like all
  4729. 3:34:50the pocket files remove all the pocket
  4730. 3:34:52files all the bucket files and just take
  4731. 3:34:56one but an we
  4732. 3:34:58didn't I'm just taking my name like for
  4733. 3:35:01the first time like obviously I haven't
  4734. 3:35:03taken my name anch it sounds weird and
  4735. 3:35:06good as well I don't know so you will
  4736. 3:35:08say
  4737. 3:35:09anch why we are reading this partition
  4738. 3:35:11because why it has Rewritten the
  4739. 3:35:13partition now we haven't deleted
  4740. 3:35:15anything now now we haven't updated
  4741. 3:35:16anything now we haven't done anything
  4742. 3:35:19why you will get to know everything with
  4743. 3:35:21the architecture behind the uh optimize
  4744. 3:35:24command and Z order by command let me
  4745. 3:35:25just show you the Delta log first to
  4746. 3:35:27confirm my
  4747. 3:35:28statement so I will simply go
  4748. 3:35:32here I will check the latest log in
  4749. 3:35:34which it will
  4750. 3:35:37say I will go to edit see it has said
  4751. 3:35:40remove this
  4752. 3:35:42one remove this one which was for the
  4753. 3:35:45two initial files and add this one which
  4754. 3:35:48is 3 f2c and I should see this as well
  4755. 3:35:52in my containers 3 f2c just remember
  4756. 3:35:55it 3 f2c which is this one okay only one
  4757. 3:36:01uh uh only one pocket file so obviously
  4758. 3:36:05instead of deleting this one because I
  4759. 3:36:07didn't know the name that means the
  4760. 3:36:09whole like whole intent is removing all
  4761. 3:36:12the other partition removing all the
  4762. 3:36:14other partition that that is the intent
  4763. 3:36:15I thought like this is the latest one
  4764. 3:36:16but three of two is the latest one I
  4765. 3:36:18didn't know the name the whole intent is
  4766. 3:36:20removing all the partitions do not get
  4767. 3:36:22me wrong the whole intent is removing
  4768. 3:36:25all the partitions now we will know why
  4769. 3:36:27it happened and we we are really excited
  4770. 3:36:30don't worry I I will tell you so what
  4771. 3:36:34exactly
  4772. 3:36:36happened let me just create a
  4773. 3:36:40blank sheet for you all so that you can
  4774. 3:36:43understand well what exactly happen let
  4775. 3:36:46me tell you do you know do do you need
  4776. 3:36:49this PP I can just give it to you as
  4777. 3:36:52well so what exactly happened jokes
  4778. 3:36:54apart let's be serious okay this is our
  4779. 3:36:58partition one this is our partition two
  4780. 3:37:01these are the only two partitions which
  4781. 3:37:02were in use right yeah third one was
  4782. 3:37:05removed when we just used version like
  4783. 3:37:07when we just restored our table so that
  4784. 3:37:08means the third partition was not in use
  4785. 3:37:10because we didn't refer it right so we
  4786. 3:37:13we just had like these two partitions
  4787. 3:37:15okay okay let me write it as
  4788. 3:37:18well like partition one or let's say
  4789. 3:37:21pocket one like it's up to
  4790. 3:37:23you partition two okay so these two
  4791. 3:37:27partitions yeah these two partitions now
  4792. 3:37:30when we
  4793. 3:37:32ran optimize
  4794. 3:37:36command optimize command let let me
  4795. 3:37:38create another partition so that you can
  4796. 3:37:40just understand better so let's say this
  4797. 3:37:42is our partition zero let's say
  4798. 3:37:46partition zero because you will
  4799. 3:37:48understand better let trust me trust me
  4800. 3:37:50trust me so this is your partition
  4801. 3:37:54four you do not need to take notes right
  4802. 3:37:57now because it's high time to understand
  4803. 3:37:58the concept first and in case of taking
  4804. 3:38:00notes you can just rewatch this part do
  4805. 3:38:02not do not uh get yourself distracted
  4806. 3:38:06right now so listen carefully okay so
  4807. 3:38:09these were the four partitions which
  4808. 3:38:11were on the table right okay this is
  4809. 3:38:15this is s
  4810. 3:38:16now we wanted to optimize this data how
  4811. 3:38:19we can optimize it first of all you
  4812. 3:38:21should know how
  4813. 3:38:23optimization is defined in case of Delta
  4814. 3:38:25tables so it is always listen listen
  4815. 3:38:28listen to me carefully it is always
  4816. 3:38:32better to read from lesser partitions
  4817. 3:38:36what did I
  4818. 3:38:37say it is always better to read from
  4819. 3:38:42lesser partitions even if they are
  4820. 3:38:44bigger in size that means that means if
  4821. 3:38:48we have four partitions okay let's say
  4822. 3:38:52of uh let's say 1
  4823. 3:38:55GB right and then 1
  4824. 3:38:58[Music]
  4825. 3:38:59GB
  4826. 3:39:01then 1 GB then of 1 GB if I want to read
  4827. 3:39:074 GB of data distributed among four
  4828. 3:39:10partitions versus
  4829. 3:39:13versus I just have
  4830. 3:39:16two partition partitions of 2 GB
  4831. 3:39:20each of 2
  4832. 3:39:22GB partition
  4833. 3:39:24one 2 GB
  4834. 3:39:28okay partition
  4835. 3:39:31two 2 GB okay it is always better to
  4836. 3:39:35read from these two partition this is
  4837. 3:39:37the fundamental and this is the
  4838. 3:39:39definition of optimization in the world
  4839. 3:39:42of uh partitions or in the world of
  4840. 3:39:44Delta Lake okay this is the thing that
  4841. 3:39:46you should know okay now when we run
  4842. 3:39:49this optimized command what it does what
  4843. 3:39:51it does it just combine all these small
  4844. 3:39:55small partitions into bigger partitions
  4845. 3:39:59so these four partitions get
  4846. 3:40:01combined these four partitions get
  4847. 3:40:04combined to create only two partitions
  4848. 3:40:07to improve the efficiency to improve the
  4849. 3:40:10performance to improve the
  4850. 3:40:13reability this is the functional ity of
  4851. 3:40:16optimize command this is the
  4852. 3:40:17functionality of optimize command okay
  4853. 3:40:22okay now when we ran Z order by on top
  4854. 3:40:26of this optimize command as well what
  4855. 3:40:28exactly happened let me tell
  4856. 3:40:30you when we ran Z order
  4857. 3:40:37by Z order by on top of this optimize
  4858. 3:40:42command as well so obviously it first
  4859. 3:40:46created two big partitions okay that's
  4860. 3:40:48fine but but but but but but the Z order
  4861. 3:40:52by command sorted the data based on ID
  4862. 3:40:56column ID we mentioned ID in our Z order
  4863. 3:41:00by we can put any column but it is
  4864. 3:41:02always recommended to use that
  4865. 3:41:04particular column in Z order by command
  4866. 3:41:06which will be using in we Clause right
  4867. 3:41:08to just filter out the data it will sort
  4868. 3:41:12this data it will sort this data in
  4869. 3:41:16let's say sending or descending order so
  4870. 3:41:20in in both the partitions in both the
  4871. 3:41:22partitions
  4872. 3:41:24yes it in both the partitions it doesn't
  4873. 3:41:28care how data was distributed among
  4874. 3:41:30these partition it doesn't care let's
  4875. 3:41:32say in this we we had like eight records
  4876. 3:41:351 2 3 4 5 6 7 8 perfect let's take that
  4877. 3:41:37example so that you can completely
  4878. 3:41:39understand this concept and after this
  4879. 3:41:41session you will feel like we have we we
  4880. 3:41:45know everything that we need to
  4881. 3:41:46know ah so let's do it let's do it let's
  4882. 3:41:51do it so let's say we have here three
  4883. 3:41:57comma 7 IDs right here we have 1 comma
  4884. 3:42:038 okay here we have 2 comma 5 here we
  4885. 3:42:10have what's left 4A 6 okay now it will
  4886. 3:42:16what it will do first of all it will
  4887. 3:42:17optimize the data optimize this data
  4888. 3:42:19into two partitions so at the same time
  4889. 3:42:23when we apply Z order by it will write
  4890. 3:42:25here let me use green
  4891. 3:42:281 1 2 3 4 and here in this partition it
  4892. 3:42:34will say 5 6 7 8 Simple it sorts that
  4893. 3:42:40data as well and yes this is a kind of
  4894. 3:42:43indexing that we have in SQL traditional
  4895. 3:42:46databases we use indexing to improve the
  4896. 3:42:48query performance we have Z order by
  4897. 3:42:50command in place of uh
  4898. 3:42:54indexing it will first create big
  4899. 3:42:56partitions and it will sort that data as
  4900. 3:43:00well within that
  4901. 3:43:01partition what is the biggest advantage
  4902. 3:43:04of it what is the biggest advantage of
  4903. 3:43:05it it's called Data skipping it's called
  4904. 3:43:08Data skipping let me write it for
  4905. 3:43:12you bro I'm telling you I I had to refer
  4906. 3:43:15so many resources just to gain knowledge
  4907. 3:43:17regarding this and now you are getting
  4908. 3:43:19everything under one video you should be
  4909. 3:43:21focused
  4910. 3:43:23enough it's called Data skipping what it
  4911. 3:43:26will do let's say I applied a select
  4912. 3:43:28statement select estx from my table
  4913. 3:43:32where ID equals to 3 where ID equals to
  4914. 3:43:383 if I am not using Z order by command
  4915. 3:43:42it has to it it has to enter each and
  4916. 3:43:47every single partition because it
  4917. 3:43:49doesn't know if three is here or here
  4918. 3:43:53but when we use theorder by when we use
  4919. 3:43:56indexing it knows I have found three
  4920. 3:43:59here and this data is sorted in the
  4921. 3:44:01ascending order that means we do not
  4922. 3:44:03need to read this partition we do not
  4923. 3:44:06need to read this partition this
  4924. 3:44:11one understood that was all all about
  4925. 3:44:18optimization that was all about
  4926. 3:44:21optimization Z order by optimize
  4927. 3:44:25command I have tried my best to explain
  4928. 3:44:29you these Concepts and trust me these
  4929. 3:44:31concepts are really really hard to find
  4930. 3:44:34these the like the resources to actually
  4931. 3:44:38get the information regarding these
  4932. 3:44:40things are really hard to find but now
  4933. 3:44:42you have me so you do not need to worry
  4934. 3:44:46so this was all about Z order by command
  4935. 3:44:49and optimize
  4936. 3:44:51command got
  4937. 3:44:52it okay that's good now I'm happy that
  4938. 3:44:55you got the concept now I'm really happy
  4939. 3:44:58so now you know what exactly happened it
  4940. 3:45:02has combined all the partitions into one
  4941. 3:45:06and it has sorted the data as well and
  4942. 3:45:07now you have seen the performance as
  4943. 3:45:09well it is improved by see almost almost
  4944. 3:45:14it is reduced to one third that is a big
  4945. 3:45:16big big achievement earli it was taking
  4946. 3:45:18almost 1 second now it is taking 0.37
  4947. 3:45:21second now just replace it with hours
  4948. 3:45:24like 1 hour and 37 minutes not oh sorry
  4949. 3:45:27s sorry 90 minutes and 37 minutes see
  4950. 3:45:311.5 hour only 30 minutes it is equalent
  4951. 3:45:35to that now you will feel the
  4952. 3:45:38difference one day or just 0.3
  4953. 3:45:42days got it
  4954. 3:45:45this is the power of optimization
  4955. 3:45:47techniques that we have within Delta
  4956. 3:45:49Lake you should know you should be aware
  4957. 3:45:52of these
  4958. 3:45:54techniques I know now you have learned
  4959. 3:45:57all these
  4960. 3:46:00techniques right happy now you have
  4961. 3:46:04everything in place for Delta Lake for
  4962. 3:46:08data breakes everything that's not the
  4963. 3:46:10end of this session we have something
  4964. 3:46:12special to cover that as well what's
  4965. 3:46:14that
  4966. 3:46:15so after covering everything within
  4967. 3:46:18Delta Le and like there's like so many
  4968. 3:46:20stuff obviously now you have that base
  4969. 3:46:22ready to explore to learn now you can
  4970. 3:46:25try something new now if you will be
  4971. 3:46:28just reading some random documentation
  4972. 3:46:30regarding any update you will feel
  4973. 3:46:31connected you will feel connected
  4974. 3:46:33because now you know the basics now your
  4975. 3:46:36Basics are
  4976. 3:46:37clear that is the sole reason behind
  4977. 3:46:40this
  4978. 3:46:41video behind this session
  4979. 3:46:46right and this is all about Delta Lake
  4980. 3:46:51now let's cover one more important thing
  4981. 3:46:55what is that so when you just see the
  4982. 3:46:57left hand side which is
  4983. 3:47:00called where is
  4984. 3:47:03that
  4985. 3:47:05workflows now we need to cover workflows
  4986. 3:47:07as well because this is really really
  4987. 3:47:09important and we will just conclude our
  4988. 3:47:12session with this workflow session
  4989. 3:47:14because we need I need to show like how
  4990. 3:47:16you can orchestrate your work within
  4991. 3:47:18data bricks how you can orchestrate your
  4992. 3:47:20notebook so for this particular session
  4993. 3:47:23we will create two notebooks notebook
  4994. 3:47:24one notebook two and we will just put
  4995. 3:47:26some random code and I will show you how
  4996. 3:47:28you can orchestrate it how you can
  4997. 3:47:30perform the whole data
  4998. 3:47:32upload and I am really happy I know that
  4999. 3:47:36I have been talking since the morning
  5000. 3:47:37but now I am feeling happy because now I
  5001. 3:47:39know that I have successfully shared all
  5002. 3:47:41the knowledge that is required to be a
  5003. 3:47:44Pro Data brakes developer and obviously
  5004. 3:47:47I have provide the resources as well
  5005. 3:47:48from where you can learn ppar as well
  5006. 3:47:50and you promis me that you will learn
  5007. 3:47:53ppar as well and just learn the ppar as
  5008. 3:47:56well after watching this last session
  5009. 3:47:58and just see yourself in the mirror and
  5010. 3:48:01just say good job just say
  5011. 3:48:05this so now without wasting in time
  5012. 3:48:07let's cover this workflow session as
  5013. 3:48:11well so we need to cover this topic as
  5014. 3:48:15well by the way how's my new history so
  5015. 3:48:18I just went to Saloon to have a haircut
  5016. 3:48:20and I was sitting there and I just
  5017. 3:48:21realized that we need to just cover this
  5018. 3:48:24topic as well this is really really
  5019. 3:48:27really really really important why as
  5020. 3:48:31the name suggest incremental loading
  5021. 3:48:33with auto loader obviously in the real
  5022. 3:48:36world we just deal with data and we do
  5023. 3:48:40not like do the full load every time we
  5024. 3:48:43load the data increment ly that's why we
  5025. 3:48:46need to understand how we can perform
  5026. 3:48:48incremental loading in data brakes and
  5027. 3:48:51do you know what you can perform
  5028. 3:48:52incremental loading like this why and
  5029. 3:48:56how because of this because of
  5030. 3:49:01this super cool function that is
  5031. 3:49:05autoloader what is this and what we can
  5032. 3:49:08expect in this particular function it's
  5033. 3:49:11not basically a function you can say
  5034. 3:49:12it's a kind of framework or it's a kind
  5035. 3:49:15of architecture that data mix performs
  5036. 3:49:17so let me just give you a scenario so
  5037. 3:49:21let's say you have a source
  5038. 3:49:25okay you have a source and you have
  5039. 3:49:28let's say pocket files let's say let's
  5040. 3:49:30say pocket files like you have pocket
  5041. 3:49:32file
  5042. 3:49:33one only one okay
  5043. 3:49:36then you want to
  5044. 3:49:39just load this data to this container
  5045. 3:49:44let's say a destination folder anything
  5046. 3:49:46right this is your
  5047. 3:49:48destination by the way how is my looking
  5048. 3:49:51I'm seriously asking bro is it looking
  5049. 3:49:54good see I'm so so so possessive for you
  5050. 3:49:57I was just having a haircut and I I was
  5051. 3:49:59just thinking about you guys like how
  5052. 3:50:01you can learn this topic as well see how
  5053. 3:50:04possessive possessive I am for you for
  5054. 3:50:07your
  5055. 3:50:09learning I I love my data fam love you
  5056. 3:50:12love you love you by the way I have I'm
  5057. 3:50:15like wearing pink color now
  5058. 3:50:17so so okay okay okay jokes apart let's
  5059. 3:50:20focus okay so let's say you want to just
  5060. 3:50:22transfer this file to this destination
  5061. 3:50:24and this will be
  5062. 3:50:26P1 then let's say after 1 hour or let's
  5063. 3:50:29say next day you have another file
  5064. 3:50:33P2 now now you just want to
  5065. 3:50:38transfer only this data you do not want
  5066. 3:50:42to read this data again because you have
  5067. 3:50:44already loaded this data in your
  5068. 3:50:46destination why you would be just
  5069. 3:50:48reading this data again and again
  5070. 3:50:50obviously you will not read it then we
  5071. 3:50:53will use autoloader which will only pick
  5072. 3:50:57this data only pick this data and it
  5073. 3:50:59will just write it here which is
  5074. 3:51:04P2
  5075. 3:51:06yes see how powerful it is so how we can
  5076. 3:51:11actually perform this so basically we
  5077. 3:51:13use something called
  5078. 3:51:15as just write it for
  5079. 3:51:18you streaming data frame what is
  5080. 3:51:21streaming data frame streaming data
  5081. 3:51:23frame is basically like similar to the
  5082. 3:51:26like standard or the normal data frame
  5083. 3:51:29that we create in a PES part this is
  5084. 3:51:32unbounded data frame that means it will
  5085. 3:51:35be a continuous data frame based on a
  5086. 3:51:38stream as we just mentioned that our
  5087. 3:51:41source will be having data continuously
  5088. 3:51:44right let's say today it will be one
  5089. 3:51:46file let's say tomorrow it will be
  5090. 3:51:47second file or or or it will have one
  5091. 3:51:51file now after after 2 minutes it will
  5092. 3:51:54be having second file or it will be
  5093. 3:51:57having one file now and after a few
  5094. 3:51:59seconds it will be having second file so
  5095. 3:52:01it is continuous form of data it is
  5096. 3:52:03continuous stream of data so we create
  5097. 3:52:06something called as streaming data frame
  5098. 3:52:09for these types of situations and for
  5099. 3:52:11autol loader we have to have to create
  5100. 3:52:14streaming data frame so that it can just
  5101. 3:52:16continuously incrementally load the data
  5102. 3:52:19into our into our
  5103. 3:52:21destination if this seems to be
  5104. 3:52:24difficult to implement the answer is no
  5105. 3:52:26it is very very simple let me show you
  5106. 3:52:28how you can do it and for that we will
  5107. 3:52:30first create a dummy source and dummy
  5108. 3:52:33destination and we will show you like
  5109. 3:52:36how you can actually perform out order
  5110. 3:52:37let's do it so first of all we will
  5111. 3:52:40simply add a heading and we will simply
  5112. 3:52:42write
  5113. 3:52:44uh uh uh Auto
  5114. 3:52:49loader simple perfect and now let's
  5115. 3:52:52prepare the scenario for that so I will
  5116. 3:52:54just go to my data rate and I will just
  5117. 3:52:57create a container and I will call it
  5118. 3:52:59as uh Al
  5119. 3:53:02Source
  5120. 3:53:04okay Al source autol loer source
  5121. 3:53:09simple what happened man okay we are not
  5122. 3:53:11using
  5123. 3:53:13uppercase here Source
  5124. 3:53:17simple
  5125. 3:53:19perfect and now let's also create
  5126. 3:53:24Al
  5127. 3:53:26uh Sy or destination yeah Al destination
  5128. 3:53:30so these are like basically two
  5129. 3:53:31containers that we will involve in our
  5130. 3:53:33scenarios so simply create we have
  5131. 3:53:35created two scenario like two containers
  5132. 3:53:38so now I will upload some data in my Al
  5133. 3:53:41source and I have some dummy pocket file
  5134. 3:53:45so I will just upload that and let me
  5135. 3:53:48just upload that
  5136. 3:53:49one I will simply click on upload and
  5137. 3:53:52then browse for files as you can see I
  5138. 3:53:54have uploaded this paret file don't
  5139. 3:53:56worry I will just provide the link to
  5140. 3:53:57this paret file and I will just upload
  5141. 3:53:59this in my GitHub repository you can
  5142. 3:54:01download it do not need to worry bro
  5143. 3:54:04just click on upload and now this file
  5144. 3:54:07is uploaded right let's go to our datab
  5145. 3:54:11breaks so first of all as I just
  5146. 3:54:13mentioned that we need to create
  5147. 3:54:14something called as streaming data frame
  5148. 3:54:17it is very very very similar to The
  5149. 3:54:19Standard data frame very similar even
  5150. 3:54:21the syntax let me show you so let me
  5151. 3:54:25just add a heading not a heading just
  5152. 3:54:27title I will call it
  5153. 3:54:30as let's make it bold
  5154. 3:54:33streaming data
  5155. 3:54:37frame right okay so now I will simply
  5156. 3:54:41say DF equals
  5157. 3:54:44par. read now instead of using read I
  5158. 3:54:47will use read stream simple simple
  5159. 3:54:50simple then I need to specify the
  5160. 3:54:54format now you will ask what is the
  5161. 3:54:56format
  5162. 3:54:57pocket no the format is let me show
  5163. 3:55:01you cloud files why yes because when we
  5164. 3:55:05use aut loader we just use a generic
  5165. 3:55:10file format
  5166. 3:55:14then then I was really thirsty sorry bro
  5167. 3:55:17so then we just Define the file format
  5168. 3:55:21of our Cloud file in our scenario it is
  5169. 3:55:23parket now we will Define it and our
  5170. 3:55:26lovely data breaks has already
  5171. 3:55:27recommended us thank you so much by the
  5172. 3:55:29way we already know so still thank you
  5173. 3:55:32to save our time okay so once it is done
  5174. 3:55:36then we need to define something called
  5175. 3:55:39as schema location what's that let me
  5176. 3:55:42tell you why we need it he is very smart
  5177. 3:55:45he's very he's not letting me to explain
  5178. 3:55:47he's just he's a spoiler man just
  5179. 3:55:49kidding so let me just show you like
  5180. 3:55:51what do I
  5181. 3:55:53mean so basically we just discussed that
  5182. 3:55:56we have a source right yeah we have a
  5183. 3:55:58source we have P1 we have P2 so
  5184. 3:56:03basically we need to store the schema of
  5185. 3:56:06each file so that our destination table
  5186. 3:56:10which will be using right stream method
  5187. 3:56:13can actually use that
  5188. 3:56:18schema to write the data in the
  5189. 3:56:20destination folder simple and for this
  5190. 3:56:23thing we store the schema in a specific
  5191. 3:56:26location and we call it as checkpoint
  5192. 3:56:29yeah it's a kind of checkpoint so let's
  5193. 3:56:32create that as well so now you
  5194. 3:56:34understood right why we need to store
  5195. 3:56:35the schema because it will be referred
  5196. 3:56:38by the read uh sorry right stream method
  5197. 3:56:41right right right right okay so now we
  5198. 3:56:44we will simply say dot
  5199. 3:56:45option cloud files
  5200. 3:56:49oops cloud
  5201. 3:56:52files dot schema
  5202. 3:56:56location okay let's use this okay so now
  5203. 3:57:00it has given us some recommendations so
  5204. 3:57:02first of all my source is Al Source
  5205. 3:57:06obviously and then it's not sales bro
  5206. 3:57:08come on man come on so I will just
  5207. 3:57:11create a folder called checkpoint inside
  5208. 3:57:13my source
  5209. 3:57:15inside my source or should yeah yeah I
  5210. 3:57:19can just create it like anywhere so I
  5211. 3:57:20will just create a checkpoint inside my
  5212. 3:57:22source or what I can do I can actually
  5213. 3:57:25store this checkpoint in my sync it will
  5214. 3:57:27be better it will be better yeah like
  5215. 3:57:31it's not like any kind of rule that you
  5216. 3:57:33need to follow but obviously it makes
  5217. 3:57:36sense because it will be read by your
  5218. 3:57:38right string method and right stream
  5219. 3:57:40method will be pointing to the
  5220. 3:57:42destination and it makes since as you
  5221. 3:57:45can obviously U maintain that data
  5222. 3:57:47easily so let's not put it in the source
  5223. 3:57:51let's put it in the sync okay so our
  5224. 3:57:53sync is Al
  5225. 3:57:56destination perfect yeah perfect okay so
  5226. 3:57:59this is done what's
  5227. 3:58:01left then you need to Simply
  5228. 3:58:05write dot
  5229. 3:58:07load and we will just give the
  5230. 3:58:10location and in our scenario it is Al so
  5231. 3:58:14Source spelling is right right yeah okay
  5232. 3:58:18and it is do we have created any folder
  5233. 3:58:22inside that do we no no no no no no no
  5234. 3:58:25no no no no simple only container bro
  5235. 3:58:28only container we we do not need to put
  5236. 3:58:29sales bro what are you doing man we do
  5237. 3:58:32not need
  5238. 3:58:33sales okay so let me just run it what
  5239. 3:58:37will happen nothing why I will tell you
  5240. 3:58:41so we have successfully created DF so
  5241. 3:58:43obviously nothing will be executed
  5242. 3:58:45because of lazy valuation of spark so
  5243. 3:58:49now we will create the writing stream
  5244. 3:58:50and when we just uh write right stream
  5245. 3:58:55then it will just run this cell as well
  5246. 3:58:57so what will happen in our right stream
  5247. 3:58:59so we will simply say DF do WR and as
  5248. 3:59:02you guessed it now we need to write
  5249. 3:59:05right stream instead of right right
  5250. 3:59:07right right right right right right so
  5251. 3:59:09many
  5252. 3:59:10rights okay now do
  5253. 3:59:12format now let's say I want to just save
  5254. 3:59:15it in the Delta format I love Delta so
  5255. 3:59:19you can just save it in any format
  5256. 3:59:20doesn't matter doesn't
  5257. 3:59:22matter as we are just dealing
  5258. 3:59:24extensively with Delta lake so it's nice
  5259. 3:59:26to just use Delta lake so we will just
  5260. 3:59:29simply write DF do right stream. format
  5261. 3:59:31Delta then we need to specify something
  5262. 3:59:34special what's that another checkpoint
  5263. 3:59:36why why why why why why I will tell you
  5264. 3:59:40then we can say okay he's very smart
  5265. 3:59:43Okay what is is checkpoint location so
  5266. 3:59:45basically basically when let let me just
  5267. 3:59:48draw it for you here basically this is
  5268. 3:59:51our
  5269. 3:59:52source this is our
  5270. 3:59:54destination when it has read
  5271. 3:59:58P1 it has read P1 okay this is our
  5272. 4:00:02streaming query this whole thing is our
  5273. 4:00:04streaming
  5274. 4:00:05query okay let me just write for you if
  5275. 4:00:08you are not taking notes if you're not
  5276. 4:00:11crafting your
  5277. 4:00:12notes don't to me don't talk to
  5278. 4:00:18me this is our streaming query
  5279. 4:00:22perfect our streaming query has
  5280. 4:00:25successfully read this file okay and
  5281. 4:00:29this file is here now okay
  5282. 4:00:33now it needs to store this
  5283. 4:00:36information at a specific location that
  5284. 4:00:41this file is already read
  5285. 4:00:44streaming query needs to save the
  5286. 4:00:48current state of the
  5287. 4:00:51stream got it obviously that's how it
  5288. 4:00:55will just got get to know that this file
  5289. 4:00:58is already read now it just needs to
  5290. 4:01:00pick
  5291. 4:01:01P2 simple bro so now we'll just give the
  5292. 4:01:05checkpoint location oh we have already
  5293. 4:01:07given that's that's really nice now
  5294. 4:01:09we'll just put dot trigger obviously it
  5295. 4:01:13uh it is a stream so we need to just
  5296. 4:01:15tell that always look for the records
  5297. 4:01:18after let's say 1 minute or let's say 30
  5298. 4:01:22seconds or let's say 10 seconds because
  5299. 4:01:26when we just create stream we want to
  5300. 4:01:29give the trigger okay let's say if we do
  5301. 4:01:32not give any value to the trigger or if
  5302. 4:01:34we do not write trigger it will still
  5303. 4:01:37give the default value to the trigger
  5304. 4:01:39what is the default value I read it
  5305. 4:01:42somewhere if I'm not wrong it is
  5306. 4:01:44somewhere around 0.5 milliseconds so
  5307. 4:01:47even if we do not write anything it will
  5308. 4:01:50just take the default value that is 0.5
  5309. 4:01:53milliseconds it is very very very quick
  5310. 4:01:55so we will just say let's say processing
  5311. 4:01:59time equals to
  5312. 4:02:01oops equals to 10 seconds oh he's very
  5313. 4:02:05he's just reading my mind bro now I will
  5314. 4:02:07not give 10 I will give five
  5315. 4:02:11seconds okay simple now we need to just
  5316. 4:02:15write dot
  5317. 4:02:17start do start and obviously we need to
  5318. 4:02:20give the location where it needs to
  5319. 4:02:21store the data in the destination in our
  5320. 4:02:23scenario Al destination very right very
  5321. 4:02:26right wow very
  5322. 4:02:28good data simple I will create a data
  5323. 4:02:33folder yeah okay do you want me to start
  5324. 4:02:36it do you want me to start the stream
  5325. 4:02:38because when I just started you will see
  5326. 4:02:40some graphs as well it is very very very
  5327. 4:02:42nice so I have just started
  5328. 4:02:44it okay as you can see stream
  5329. 4:02:47initialization when I just click on it
  5330. 4:02:49you will see
  5331. 4:02:51graph o so basically it shows the
  5332. 4:02:54current state of the streaming query and
  5333. 4:02:58you will see some line graphs and all so
  5334. 4:03:02and it is continuous streaming right it
  5335. 4:03:04is continuous data what do I mean I mean
  5336. 4:03:08see the line graph and do you know what
  5337. 4:03:11is this raw data this is called QP
  5338. 4:03:14UPL yeah query progress log just save it
  5339. 4:03:17just save this information this is
  5340. 4:03:19called query progress
  5341. 4:03:21log yes and this is your dashboard where
  5342. 4:03:24you see the values that data is coming
  5343. 4:03:26see it just process this data this is
  5344. 4:03:30your processing rate this is your this
  5345. 4:03:31is your processing rate this is your
  5346. 4:03:32input rate and this is like batch
  5347. 4:03:34duration and now it will be flat because
  5348. 4:03:36obviously we didn't do anything we
  5349. 4:03:38didn't do anything we just uploaded one
  5350. 4:03:40file it copied do you want to see the
  5351. 4:03:42result this stream is really like
  5352. 4:03:44working
  5353. 4:03:45continuously this will not get stopped
  5354. 4:03:48until and unless I stop it so it will be
  5355. 4:03:51running continuously continuously so I
  5356. 4:03:54will just take you to our data L to just
  5357. 4:03:57show you something so as you can see
  5358. 4:03:59this is our source container and we have
  5359. 4:04:02only one file right it is automatically
  5360. 4:04:04copied to Al destination wow and we Sav
  5361. 4:04:08the data in the data folder wow it has
  5362. 4:04:12copied this partition now I will do
  5363. 4:04:16something else I will go to my
  5364. 4:04:19containers and I will add this file I
  5365. 4:04:22will only upload this file I will not
  5366. 4:04:25touch anything in this notebook and you
  5367. 4:04:27will see data will be copied
  5368. 4:04:29automatically and incrementally that
  5369. 4:04:32means this file will not get picked this
  5370. 4:04:35time only the new file will get will get
  5371. 4:04:37picked let me show you I will simply
  5372. 4:04:39click on upload and browse file I have
  5373. 4:04:41added this file now I will click on
  5374. 4:04:44upload button and you will see that it
  5375. 4:04:47will get copied obviously you need to
  5376. 4:04:49just wait for 10 seconds maybe it's like
  5377. 4:04:51in progress of 10 seconds so we will
  5378. 4:04:53just wait for 10 seconds 10 9 8 7 6 5 4
  5379. 4:04:593 2 1
  5380. 4:05:02Boom come on man I a child
  5381. 4:05:08yeah I'm a child so you will just see El
  5382. 4:05:12destination will have two files now only
  5383. 4:05:15two files not one not three only two and
  5384. 4:05:18that's the result of our incremental
  5385. 4:05:20loading let me show you in the data
  5386. 4:05:23folder
  5387. 4:05:25boom boom boom boom I told you I told
  5388. 4:05:29you bro I told you so now it has
  5389. 4:05:32successfully loaded this data now as you
  5390. 4:05:36can see another Spike because we
  5391. 4:05:37uploaded another file so you can just
  5392. 4:05:39continuously add the data it will
  5393. 4:05:41continuously just transfer this data now
  5394. 4:05:44just a tip bro please click on this
  5395. 4:05:47interrupt button because cluster is
  5396. 4:05:51running and it is very very expensive so
  5397. 4:05:54just click on this interrupt button so
  5398. 4:05:55that you can just interrupt the query
  5399. 4:05:57and your cluster is turned off and you
  5400. 4:06:00are fine obviously if you're using free
  5401. 4:06:02account it doesn't matter but obviously
  5402. 4:06:03if you're working in a company you
  5403. 4:06:05should know these things that you cannot
  5404. 4:06:06let your query running like overnight
  5405. 4:06:09obviously in the real world scenario
  5406. 4:06:10like we let our query to run because we
  5407. 4:06:13are streaming data but if you are if you
  5408. 4:06:15do not want to intentionally run it then
  5409. 4:06:19just stop it right away after doing some
  5410. 4:06:21testing after learning just stop it
  5411. 4:06:22right
  5412. 4:06:23away so this was all about autoloader
  5413. 4:06:28and trust me I was having a haircut and
  5414. 4:06:32I just got to know that I want to
  5415. 4:06:33discuss this area as well I love you so
  5416. 4:06:38much and you know this and I know that
  5417. 4:06:41you love me more so
  5418. 4:06:44this was all about
  5419. 4:06:46autoloader so are you excited to cover
  5420. 4:06:50our last session which is workflows by
  5421. 4:06:53the way this is really really important
  5422. 4:06:55so we will just have a look at this
  5423. 4:06:58session as well so just a prequest for
  5424. 4:07:01this one we will just create as I just
  5425. 4:07:03mentioned like we will create two
  5426. 4:07:04notebooks some random notebooks and we
  5427. 4:07:06will
  5428. 4:07:07just uh create very very basic let's say
  5429. 4:07:11statements or code for that because we
  5430. 4:07:13just need to learn work about workflows
  5431. 4:07:14instead of just coding everything yeah
  5432. 4:07:17so I will simply go to my workspace and
  5433. 4:07:19I will select my workspace which is this
  5434. 4:07:21data brakes master class and then I will
  5435. 4:07:23create two notebooks first of all
  5436. 4:07:25notebook
  5437. 4:07:26one and I will name it as notebook one
  5438. 4:07:29let's keep it simple bro so let's say
  5439. 4:07:32use print command that's it so print we
  5440. 4:07:36can say
  5441. 4:07:38hellan simple yeah right and obviously
  5442. 4:07:42this is done
  5443. 4:07:44and then we can again go to workspace
  5444. 4:07:46select your workspace select your folder
  5445. 4:07:49then we will create Notebook
  5446. 4:07:522 okay
  5447. 4:07:55perfect notebook two okay and here we
  5448. 4:07:57will
  5449. 4:08:00say we love UNL obviously you do
  5450. 4:08:04obviously you do I know I know I know I
  5451. 4:08:06I just read your
  5452. 4:08:07mind so I'm just kidding don't need to
  5453. 4:08:11worry but I know you do so
  5454. 4:08:14these are like two notebooks and now
  5455. 4:08:16let's learn workflows what if I want to
  5456. 4:08:20I I will just give you an overview so
  5457. 4:08:23this is my notebook one right this is my
  5458. 4:08:26notebook two why do we use workflows
  5459. 4:08:29workflows are basically used for
  5460. 4:08:32orchestration let me type it here it is
  5461. 4:08:35used for
  5462. 4:08:38orchestration when we need to
  5463. 4:08:40orchestrate our work let's say this is
  5464. 4:08:42our notebook one as we just mentioned
  5465. 4:08:44let's say one and this is our notebook
  5466. 4:08:47two so what if we want to run the second
  5467. 4:08:52notebook after one and similarly let's
  5468. 4:08:54say we have multiple notebooks so we
  5469. 4:08:56want to create a flow we want to create
  5470. 4:08:58a job we want to create a data pipeline
  5471. 4:09:02so if we want to do that we can simply
  5472. 4:09:04go to workflows and we have this option
  5473. 4:09:06available and data p and we can just
  5474. 4:09:08learn how we can just create workflow
  5475. 4:09:11using our notebooks and here is your
  5476. 4:09:13friend will tell you each and everything
  5477. 4:09:15so let me go to
  5478. 4:09:16workflows click on it and then you will
  5479. 4:09:19see something at the corner create job
  5480. 4:09:22you just need to click on it because
  5481. 4:09:24create job job is similar to pipeline or
  5482. 4:09:26let's say workflow you can use any name
  5483. 4:09:29okay so this is the page that we see do
  5484. 4:09:31not need to worry do not need to worry
  5485. 4:09:33do not need to worry first of all let's
  5486. 4:09:35see some of the things here in the right
  5487. 4:09:37hand side job ID which is the ID of this
  5488. 4:09:40particular pipeline then obviously
  5489. 4:09:42create orang lamba run as orang lamba
  5490. 4:09:45tags we can just add it if you want to
  5491. 4:09:47add some description we can add it
  5492. 4:09:50lineage no lineage information for this
  5493. 4:09:52job because there's no dependency so
  5494. 4:09:54this was all about the job details then
  5495. 4:09:56we have schedule and triggers if we want
  5496. 4:09:58to schedule our job let's say it should
  5497. 4:10:01run at 2 p.m every day we can do that we
  5498. 4:10:05can add a trigger if we have a
  5499. 4:10:10parameter here if we have a parameter we
  5500. 4:10:13can just Define the parameters as well
  5501. 4:10:16if we want
  5502. 4:10:18notifications if we want notifications
  5503. 4:10:20we can also get the
  5504. 4:10:22notifications yes datab brakes provides
  5505. 4:10:26us all the important users all the
  5506. 4:10:30important features within the workflows
  5507. 4:10:33that are required to orchestrate the
  5508. 4:10:35pipelines let me just click on this
  5509. 4:10:37arrow button and let's hide it first of
  5510. 4:10:39all we need to name our pipeline
  5511. 4:10:40obviously if we are just importing any
  5512. 4:10:42activity if we are just running any
  5513. 4:10:44activity we should just name it right so
  5514. 4:10:46let's say I want to name it as
  5515. 4:10:48run notebook one this is my activity
  5516. 4:10:52this is a kind of activity if you are
  5517. 4:10:54familiar with the your data Factory this
  5518. 4:10:55is a kind of
  5519. 4:10:57activity
  5520. 4:10:59simple
  5521. 4:11:00then we need to Define we need to just
  5522. 4:11:03Define which notebook we need to run we
  5523. 4:11:05need to just go to this folder and we
  5524. 4:11:07will pick notebook one because we want
  5525. 4:11:09to run notebook one in the first step
  5526. 4:11:11then we need to pick the cluster we will
  5527. 4:11:13just pick the pick our own cluster that
  5528. 4:11:14we have created okay and it's all done
  5529. 4:11:18we do not need to provide any parameters
  5530. 4:11:20because we do not have any parameters
  5531. 4:11:21within this notebook this is a very
  5532. 4:11:22simple notebook that we have then I will
  5533. 4:11:26I
  5534. 4:11:27will I will click on
  5535. 4:11:29it wait wait wait this card changes no I
  5536. 4:11:33don't want to cancel it okay let me
  5537. 4:11:35click on this canvas okay
  5538. 4:11:39now if you just see here dependent
  5539. 4:11:42libraries
  5540. 4:11:43if your notebook has some dependent
  5541. 4:11:45libraries still you can just mention it
  5542. 4:11:48here as well so it's very handy it's
  5543. 4:11:51really handy and again the parameters if
  5544. 4:11:54you have any parameters you can just
  5545. 4:11:55Define it here in the notebooks but as I
  5546. 4:11:58mentioned we do not have anything then
  5547. 4:12:00this is this is very important retries
  5548. 4:12:03if due to any reason our notebook or
  5549. 4:12:06let's say our activity fails so it can
  5550. 4:12:09retry let's say two times three times
  5551. 4:12:11four times we can Define it here as well
  5552. 4:12:14okay and obviously this is the UI in
  5553. 4:12:17which you do not need to code anything
  5554. 4:12:19but if you click on Json it will show
  5555. 4:12:21you the code like which parameter you
  5556. 4:12:23need to refine because obviously for
  5557. 4:12:25parameter we need to give key value
  5558. 4:12:26pairs right but UI is better UI is
  5559. 4:12:29better UI is better okay let me drag it
  5560. 4:12:33here so this is my notebook one this is
  5561. 4:12:36my task
  5562. 4:12:37one and if I just click on this and this
  5563. 4:12:41like this is my canvas that we I can
  5564. 4:12:43just um keep my mouse here I can rotate
  5565. 4:12:46everything right so so once you are
  5566. 4:12:49satisfied with all your configurations
  5567. 4:12:52you can just click anywhere on the
  5568. 4:12:53canvas and just click on Save and
  5569. 4:12:54continue so it will just save your work
  5570. 4:12:57here now if you want to include the
  5571. 4:13:00other activity let's say Notebook 2 you
  5572. 4:13:02can click on add task and I can pick
  5573. 4:13:05notebook so it has just linked The
  5574. 4:13:07Notebook after the previous notebook now
  5575. 4:13:08we just need to do the configuration
  5576. 4:13:10same way that we have done for Notebook
  5577. 4:13:12one so I will name it as run Notebook
  5578. 4:13:162 my
  5579. 4:13:19activity is run Notebook 2 then I can
  5580. 4:13:22just pick the same cluster and then the
  5581. 4:13:24important step we need to just pick The
  5582. 4:13:25Notebook 2 that it needs to run okay
  5583. 4:13:29yeah everything is fine yeah and okay
  5584. 4:13:32okay okay one important thing I found so
  5585. 4:13:35now you can see it is dependent on the
  5586. 4:13:37notebook
  5587. 4:13:38one because we have selected to run
  5588. 4:13:41notebook two after notebook one so it is
  5589. 4:13:43dependent on Notebook one so this
  5590. 4:13:45was really an important step that I
  5591. 4:13:48wanted to show so once it is done yeah
  5592. 4:13:51now we can click on create task now we
  5593. 4:13:53can click on create task so it will
  5594. 4:13:55create the task for like all these two
  5595. 4:13:57activities now now it is
  5596. 4:14:00sorted now we can run our pipeline that
  5597. 4:14:04we have created using workflows in data
  5598. 4:14:06braks do you want to run it let me run
  5599. 4:14:08it run
  5600. 4:14:10now so it it triggered our pipeline and
  5601. 4:14:13let me click on view run to just monitor
  5602. 4:14:15our pipelines see it is running our this
  5603. 4:14:18activity for now and once it is done it
  5604. 4:14:20will run this activity okay this is done
  5605. 4:14:22this is this ran successfully you can
  5606. 4:14:23see a small tick and now this is running
  5607. 4:14:26this activity so I also want to see tick
  5608. 4:14:28here as well okay okay perfect perfect
  5609. 4:14:32perfect we have successfully created our
  5610. 4:14:35Pipeline and ran it as well and these
  5611. 4:14:38are all the details that you can see the
  5612. 4:14:40job ID job run ID and and it was
  5613. 4:14:43launched manually yes I clicked on Rand
  5614. 4:14:45button started ended everything is
  5615. 4:14:48written here everything is written here
  5616. 4:14:51see everything is written here every
  5617. 4:14:54every everything so this was all about
  5618. 4:14:57the
  5619. 4:14:59workflows see and when I just click on
  5620. 4:15:01this notebook I can also see the output
  5621. 4:15:03see this is the
  5622. 4:15:07output this is very very very powerful
  5623. 4:15:10let me go to this run and let me click
  5624. 4:15:13on the second notebook I should see we
  5625. 4:15:16love Anam I wanted to see
  5626. 4:15:18this see so this was all about the
  5627. 4:15:21workflows that we have created within
  5628. 4:15:23data breaks now I believe that you have
  5629. 4:15:28a strong knowledge and data breaks now
  5630. 4:15:32you have a strong base now you are all
  5631. 4:15:35set to explore the world of data breaks
  5632. 4:15:37and now you can just build some projects
  5633. 4:15:41now you can just do so many so many
  5634. 4:15:43stuff and here is a tip for you what's
  5635. 4:15:46that I I knew it because after watching
  5636. 4:15:49the session you would love to just
  5637. 4:15:51explore more and more stuff so here's a
  5638. 4:15:54tip for you I have created endtoend your
  5639. 4:15:58data engineering project and so far I
  5640. 4:16:01have created two projects so in both the
  5641. 4:16:04projects I have used data braks in which
  5642. 4:16:07I have used p park and which I have used
  5643. 4:16:09everything that you would be
  5644. 4:16:13inclined to learn you would love to
  5645. 4:16:16learn and if you want to check those
  5646. 4:16:19projects just click on the video link in
  5647. 4:16:22the description and just put your
  5648. 4:16:25projects in your resume so that you can
  5649. 4:16:27highlight your skills within data bricks
  5650. 4:16:29and one small request if you love my
  5651. 4:16:32dedication if you love my hard work and
  5652. 4:16:35if you want me to continue this content
  5653. 4:16:38continue the these insightful videos
  5654. 4:16:41insightful sessions so please subscribe
  5655. 4:16:43to this Channel and share this Channel
  5656. 4:16:46with all the data Enthusiast and like
  5657. 4:16:48this video and please please please drop
  5658. 4:16:51a comment because this will really
  5659. 4:16:53motivate me a lot and till then bye-bye
  5660. 4:16:58take care and happy learning see you

About this transcript

This page contains the full transcript of Databricks Tutorial (From Zero to Hero) | Azure Databricks Masterclass by Ansh Lamba, generated from the public captions YouTube serves with the video. The transcript has 40,026 words across 5,660 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.