<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by James Dey on Medium]]></title>
        <description><![CDATA[Stories by James Dey on Medium]]></description>
        <link>https://medium.com/@james.m.dey?source=rss-b18e8195bd0f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*F14u-ZfV416H1XB-</url>
            <title>Stories by James Dey on Medium</title>
            <link>https://medium.com/@james.m.dey?source=rss-b18e8195bd0f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 20:28:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@james.m.dey/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Locked in the Data Vault?]]></title>
            <link>https://medium.com/@james.m.dey/locked-in-the-data-vault-b3df8ce49809?source=rss-b18e8195bd0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3df8ce49809</guid>
            <category><![CDATA[data-vault-modeling]]></category>
            <category><![CDATA[data-vault]]></category>
            <dc:creator><![CDATA[James Dey]]></dc:creator>
            <pubDate>Thu, 07 Dec 2023 13:23:02 GMT</pubDate>
            <atom:updated>2023-12-08T11:42:11.705Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*KV_g7GU2c-1fBwON" /></figure><h3><strong>Summary</strong></h3><p>Data Architecture can sometimes become overly focused on the method over the purpose, which makes the Data Vault concept somewhat challenging for a lot of data practitioners.</p><p>This article covers Data Vault 2.0 (DV2.0) whose purpose is to provide a flexible approach to building out an analytical data store. Flexible is good when:-</p><ol><li>You’re not entirely sure what your analytical data store should look like</li><li>You don’t want to spend a huge amount of money re-working Kimball data marts that have hardcoded data pipelines</li></ol><p>In short, it saves you money</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fSDsTdu7BxhvP4v_.jpg" /></figure><h3><strong>My Background</strong></h3><p>Having designed the business focused layers (business vault &amp; information mart)of DV2.0 for <a href="https://www.mintel.com/sectors/food-and-drink/">Mintel</a> in order that they can report on food &amp; drink products, and the replica, raw staging, prepared staging, raw vault and consumption layer for <a href="https://www.lloydsbankinggroup.com/careers/roles-and-departments/tech-and-transformation/data-analytics.html">Lloyds Banking Group</a> as educational material for their data products data engineering squad, I believe that I have useful insights on this subject that will get you up to speed more quickly than watching videos. I adopt a pragmatic view as to how to build out analytical data stores with the ultimate business case firmly in mind and find the quickest way to achieve the goal</p><p><a href="https://www.linkedin.com/in/dataarchitectuk/">James M. Dey | LinkedIn</a></p><h3>Why use Data Vault 2.0?</h3><ol><li>It makes modelling easier — relationships between entities are modelled with link tables which essentially makes every relationship many to many, which can cater for:-</li></ol><ul><li>one to many</li><li>many to many</li><li>zero to one</li><li>one to one</li><li>many to one relationships</li></ul><p>so you basically can’t go wrong in terms of modelling relationships.</p><p>2. Although DV2.0 creates a mind boggling number of tables in the raw vault, these tables can be templated (e.g. <a href="https://automate-dv.readthedocs.io/en/latest/">AutomateDV</a> formerly known as dbtvault can generate the main DV2.0 tables for you, or <a href="https://sqldbm.com/Home/">sqldbm</a> has recently announced table templating which can do similar, or you can write your own code). This means it’s an IT function and the data engineering teams can work on this in blissful ignorance as to what the business teams want output, if necessary</p><p>3. Additionally, although the contents of the raw vault would strike fear into the heart of a data analyst or business user, it’s not for their consumption,</p><p>DV2.0 has a business vault (which strikes deepened fear) but then has a final layer, which is officially called an information mart, but can be thought of as star schemas, a consumption layer, a gold layer or a business layer. which pulls back the data into a form that data analysts et al are familiar with.</p><p>It’s this final layer which you present to the business, everything else should be for IT’s eyes only</p><p>4. It’s design (natural/business keys are hashed, rather than surrogate keys used) allows the loading of hubs, satellites and links within the raw vault to be done in parallel</p><h3>What does the Data Vault System Architecture look like?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2-cIHWdX3qHOLZPqANoSHQ.png" /></figure><p>At a relatively high level, an end to end data system architecture incorporating DV2.0 at it’s heart should look like this.</p><ol><li>Captured Data: You can need to capture data from authorative data sources into a storage layer. Typically nowadays, this will be cloud storage e.g. S3 or Azure Blob storage.</li><li>Raw Data Vault: Using AutomateDV (formerly known as dbtvault) or your own methods, you then need to create raw and prepared staging views that will convert the source data into the hub, satellite and link tables that DV2.0 is famous for</li></ol><p>3. Business Data Vault: This part of DV2.0 architecture covers:-</p><ul><li>Performance enhancements e.g</li></ul><p>i) Point In Time tables — used in situations where you have multiple satellite tables that are loaded at different times and you want to work out the state of an entity at a particular point in time</p><p>ii) Bridge tables — used in situations where a query would have to traverse multiple hubs and links, and hence would perform poorly. The bridge table pulls together this info into a single table which allows you to jump across multiple links</p><ul><li>Data Quality improvements</li><li>Business Metrics</li></ul><p>4. Consumption Layer: Once you’ve got the data in to DV2.0, your next step is to convert this back to a format that doesn’t scare the pants off the data analysts. You can code APIs (if application developers want access) or star schema style views to achieve this object. For advanced techies e.g. data scientists, they may be happy delving directly into DV2.0 with a bit of training, however</p><h3>DV2.0 Data Modelling</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ABR-C7q1DIaintb04yZQ4Q.png" /></figure><p>If you imagine an employee record at source, it might look like this:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/188/1*Jthzr7RVNxzFy08pNn7k-Q.png" /></figure><p>So in there emp_id is your primary key (i.e. how you uniquely identify an employee within the source system)</p><p>employee_number your business key (i.e how you’d uniquely identify an employee from a business rather than tech standpoint)</p><p>first_name, last_name and dob (date of birth) are attributes.</p><p><strong>Hub</strong></p><p>In DV2.0, the business key gets moved into a Hub entity. Why not use the primary key? Well because we might want to pull in data from different tech systems which will most likely use a different primary key for each employee.</p><p>As well as the business key, the Hub also contains a hashed version of the business key, known as the hash_key i.e. where a hashing function has been applied to the business key. Why do we do this? Because it allows the code to easily detect new employees, by simply hashing new business keys(s) that have arrived in raw staging and comparing with existing business keys in the raw vault.</p><p>As well as this, we also add in:-</p><ul><li>record_source — which helps tracking where data came from</li><li>effective_from — the date/timestamp when the record was loaded, this helps with change history when you want to query what was the version of an employee as-of a particular date.</li></ul><p>So we end up with a HUB_EMPLOYEE table looking like this (DV2.0 columns uppercased but you may choose your own naming standards):-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/187/1*sZG0-Nck8pg-GmeFsUnEDg.png" /></figure><p><strong>Satellite</strong></p><p>In the satellite table, we place all of the non-business key attributes (including the primary key for tracking purposes).</p><p>In addition to this, we:-</p><ol><li>Add in the hash_key so that we can link the satellite to the hub.</li><li>Hash the non-business key attributes and place in a column called hashdiff. This makes it easy to detect any changes in any non-business key attribute as they arrive at raw staging</li><li>The record_source — non-business key attributes can often be sourced from more than 1 system</li><li>Effective_from — when this version of the non-business key attributes is effective from.</li></ol><p>So we end up with a SAT_EMPLOYEE table looking like this:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/188/1*qmMy02NYxFcyZlKELsKZzg.png" /></figure><p><strong>Links</strong></p><p>So where do Link tables come in? Well if in addition to the employee record, we might want to record the department that they’re in, resulting in a HUB_DEPARTMENT table containing</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/188/1*OW8vnViLYgWsbokOSbxavg.png" /></figure><p>So how would we model the relationship between the HUB_EMPLOYEE and HUB_DEPARTMENT? Initially you might think that you just create a foreign key in HUB_EMPLOYEE called HK_DEPARTMENT, but that’s not how things work in Data Vault 2.0. That’s baking in the relationship as a department can have 1 or more employees. But what might happen if an employee works for more than 1 department? You’d have a bad data model! So DV2.0 helps us here by insisting that any relationship between entities is modelled as a link table. The LINK_DEPARTMENT_EMPLOYEE table consists of:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/1*gXfq7qR934_MQKXj6nunJg.png" /></figure><h3>How do I integrate data from multiple sources?</h3><p>Best practice is to push the business key from both sources into the hub in the raw vault. If they share the same business key, a new record won’t be created. For the non-business key attributes, these should be stored in separate satellite tables as it’s very likely that you will have differences in content or data types. Generally, data from multiple data sources isn’t fully integrated until you get to the business vault layer.</p><h3>Easy Peasy?</h3><p>This article has covered the basics of DV2.0, it’s benefits and shown how easy it is to create a raw vault using table templating or tools such as AutomateDV. So no problem, right?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*Fa1xytJsyzPX_OU8" /></figure><p>Well not quite, there are a lot of challenges that you will come across e.g.</p><ol><li>Late arriving records</li><li>Handling soft deletes</li><li>Same employee, different IDs in different systems</li><li>Different employee, same ID</li><li>Converting DV2.0 to a business friendly format</li><li>Getting rid of performance bottlenecks</li><li>There is a lot of conflicting advice out there on the internet— this can be due to the fact that:-</li></ol><ul><li>the data vault concept has evolved over time</li><li>naming standards can vary from data practitioners</li><li>Each data practitioner has developed their own pragmatic methods for delivering a data vault.</li><li>Available tools enforce their own methodology</li></ul><p>It’s these advanced topics that requires the intervention of an experienced DV2.0 data practitioner <a href="https://www.linkedin.com/in/dataarchitectuk/">James M. Dey | LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3df8ce49809" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to summarise a Pdf cheaply]]></title>
            <link>https://medium.com/@james.m.dey/how-to-summarise-a-pdf-cheaply-9bacbfa5e1eb?source=rss-b18e8195bd0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bacbfa5e1eb</guid>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[James Dey]]></dc:creator>
            <pubDate>Wed, 15 Nov 2023 14:01:06 GMT</pubDate>
            <atom:updated>2023-11-16T19:39:01.608Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>How to summarise a Pdf (or docx or text file) cheaply</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*nRzTLrEL44QtCSZbw_otVA.png" /></figure><h3>Summary</h3><p>1 of the key benefits of <a href="https://chat.openai.com/">chatGPT</a> is it’s ability to summarise information. Summarisation is great for marketing or for pitching ideas to senior execs.</p><p>However, chatGPT does come with several disadvantages</p><p>With the free version:-</p><ol><li>You’re limited to GPT3.5 (which isn’t the most accurate <a href="https://www.elastic.co/what-is/large-language-models">Large Language Model</a>)</li><li>Doesn’t allow you to upload docs for summarisation</li><li>You are limited to just 2000 characters of text in the prompt.</li></ol><p>With <a href="https://openai.com/blog/chatgpt-plus">chatGPT plus</a>, no doubt these limitations would disappear but at a cost of $20 pcm (plus sales tax), I was wary of opening my wallet only to find that I might be disappointed.</p><p>So I figured I’d explore what is on offer that might circumvent these problems</p><h3><strong>Business Use Case</strong></h3><ol><li>Allow a pdf or docx to be ingested by a summarisation engine</li><li>Summarise based on supplied criteria e.g I want to summarise the article into x paragraphs</li></ol><p>For my experiment, I decided to look for a solution capable of summarising a pdf whitepaper produced by Fivetran that I wanted to read for a potential client called <a href="https://resources.fivetran.com/datasheets/sap-technical-whitepaper#main-content">‘How to replicate SAP HANA and CDS views with Fivetran’</a></p><p><strong>Bing Chat</strong></p><p>First up I tried to use Bing Chat. Although Bing is far from my first choice of search engine, as Microsoft did a deal with <a href="https://openai.com/">OpenAI</a>, they’ve added GPT4 to many of their products. Including Bing Chat.</p><p>I decide to:-</p><ol><li>Open my whitepaper pdf</li><li>select all and copy and paste the contents of the pdf</li></ol><p>Sadly, this free option has a 2000 word character limit and time is money so copying and pasting sections of the whitepaper wouldn’t be time efficient.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*XmzstfwmdK1BUvk9Q3XhlA.png" /></figure><p><strong>Free Python libraries</strong></p><p>I found that <a href="https://pypi.org/project/pypandoc/">pypandoc</a> was good at doing document conversions to text but hit a number of problems with the summarisation libraries that were on offer which really goes to highlight the significant leap forward that <a href="https://www.techtarget.com/searchenterpriseai/definition/generative-AI">generative AI</a> provides:-</p><ol><li>Formating of paragraphs was lost</li><li>Newline characters were added seemingly at random</li><li>Words were merged or split</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZUDTVzhLhNTqGYnHU0RxGg.png" /><figcaption>1st attempt at a DIY build approach</figcaption></figure><p>So how could I meet this business case cheaply whilst using a summarisation with the same capabilities as GPT4?</p><p><strong>Back to GPT4</strong></p><p>Well it turns out that OpenAI doesn’t require you to fork out a consistent $20pcm if you’re a developer. You can supply a prompt of unlimited length via their API so long as you add at least $5+Sales Tax in credit to your OpenAI account.</p><p>Better still I found a coder on Github who’d already done most of the work for me, saves a day or 2 of messing around with Python, and has a <a href="https://gptdoc-summarizer.streamlit.app/">demo website</a> written in <a href="https://streamlit.io/">Streamlit</a>.</p><p>He’s clearly smart enough to realise that every man and his dog would like to do this, so you do have to supply an API key which sadly meant that I had to open my wallet and add some cash — this is a struggle for a Scotsman but I calculated that it would cost me about 2/3 of a London pint of beer, so worth the risk of disappointment later.</p><p>To buy a credit (and look at how much you’ve spent), go to <a href="https://platform.openai.com/account/billing/overview">https://platform.openai.com/account/billing/overview</a></p><p>OpenAI use <a href="https://stripe.com/gb">Stripe</a> to manage their payments, so it was nice and straightforward to top up the account</p><p>To get an OpenAI key go to:-<br> <a href="https://platform.openai.com/api-keys">https://platform.openai.com/api-keys</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*rVKrqR7_U49tEzgB1h36uA.png" /></figure><p>So with money in my OpenAI account and an API key it was time to start some work</p><h3>Modifying GPT-Doc-Summarizer</h3><p>Ethan Johnstonn kindly provided the required streamlit code at:-<a href="https://github.com/e-johnstonn/GPT-Doc-Summarizer">https://github.com/e-johnstonn/GPT-Doc-Summarizer</a></p><p>I cloned this code, and modified the contents to:-</p><ol><li>Add the ability to convert .docx files to text</li><li>Added additional selection in front end to allow a user to specify how many paragraphs they want in the synopsis</li><li>Added code to pick up the desired paragrams and add an additional prompt criteria of “ There should be exactly {num_synopsis} paragraphs in the synopsis.”</li></ol><p>Once I’d checked that it ran on my laptop fine, I updated the required python libraries in requirements.txt and pushed to:-<br><a href="https://github.com/deytalytics/GPT4_Doc_Summarizer">https://github.com/deytalytics/GPT4_Doc_Summarizer</a></p><h3>Deploying to Streamlit.io</h3><p>Streamlit kindly supply a cloud hosting platform at <a href="https://streamlit.io/">Streamlit.io</a>. Once you’ve registered then you can click on “New app” from the home page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*McnvF99gvvIamCLo9XQwyw.png" /></figure><p>You then just have to supply:-</p><ol><li>Your github repo url</li><li>Your github branch</li><li>The main app file — main.py in my case</li><li>An app URL — <a href="https://gpt4docsummarizer-deytalytics.streamlit.app/">gpt4docsummarizer-deytalytics.streamlit.app/</a> in my case</li></ol><p>streamlit.io will from then on just pull in the code from Github and rebuild the app whenever you push your code to Github from your IDE</p><h3>Testing a pdf conversion</h3><p>So launched <a href="https://gpt4docsummarizer-deytalytics.streamlit.app/">https://gpt4docsummarizer-deytalytics.streamlit.app/</a> from web browser and my streamlit app was up and running</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CTRe430J1PM-Mtul69Ad7g.png" /><figcaption>Document Summarizer is alive</figcaption></figure><p>Here, I uploaded the whitepaper (0.9mb) in size. This uploaded in 1 or 2 seconds.</p><p>Added my API key and selected 6 paragraphs for my synopsis.<br>Then clicked on the “Summarize” button and waited.</p><p>Nothing seemed to happen for a few seconds and then a task completion bar appeared and after a few minutes (for first time and much shorter the 2nd time I tried it) it duly spat out a credible summary that you could just cut and paste into a Powerpoint deck with little additional editing:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*gsjfQhufvx4hOIDHMTdNuA.png" /></figure><p><strong>How much did it cost to generate the summary?</strong></p><p>1 of the strange things about the world of large language models is that they don’t talk about charging by words but by prompt input tokens and response output tokens, so this has been another reason why I’ve been cautious to use the API.</p><p>However, the good news is that the summary above cost me the princely sum of $0.09</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*JYqzkwaiQvJlaFuBIG6AvQ.png" /></figure><h3>Testing the .docx conversion</h3><p>Finally I tested the .docx conversion by uploading my CV and selecting a synopsis of 6 paragraphs, in the same way as I’d done for the pdf summary</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*QXUFNoutFHvO-L3X24qhzA.png" /><figcaption>I literally could not have written a better CV</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bacbfa5e1eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started with ISO20022]]></title>
            <link>https://medium.com/@james.m.dey/getting-started-with-iso20022-e10f78ddd1bd?source=rss-b18e8195bd0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/e10f78ddd1bd</guid>
            <dc:creator><![CDATA[James Dey]]></dc:creator>
            <pubDate>Tue, 14 Nov 2023 18:27:55 GMT</pubDate>
            <atom:updated>2023-11-14T18:27:55.701Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/744/0*9xMcxGhMopn4uYx_" /></figure><h3>Summary</h3><p>This post covers information that will assist data architects and analysts in navigating the information about <a href="http://www.iso20022.org/">ISO20022</a> which is available from their website. Note: I originally wrote this article back in 2015 when working at Bank of America Merrill Lynch. Since then it’s gotten kind of popular, so I figured it’s worth adding to my medium.com portfolio.</p><h3>What is ISO20022?</h3><p>ISO20022 is a universal financial messaging standard which covers messages received from or sent to financial institutions which relate to payments, securities, cards, foreign exchange (FX) and trade securities</p><h3>Are there other ISO financial messaging standards?</h3><h4>ISO15022</h4><p>The earlier <a href="http://www.iso20022.org/15022/iso-15022-home">ISO15022</a> standard covers similar domains to ISO20022. The main problem with ISO15022 is that it was designed prior to standardised messaging formats e.g. XML became popular. Given the ubiquity of XML, many processing languages have in-built ability to parse XML messages, whereas ISO15022 is confined to the financial services industry so is not supported.</p><p>Consumers who’ve had to make an international payment from their bank account may recall that this payment is called a SWIFT payment. SWIFT MT is based on the ISO15022 standard</p><h4>ISO8583</h4><p><a href="http://en.wikipedia.org/wiki/ISO_8583">ISO8583</a> covers payment card authorisation messages. This standard is commonly used to send information to and from your bank when you use a card terminal within a store to make a payment, or when you receive cash from an ATM (cash machine).</p><h3>ISO20022 building blocks</h3><p>ISO2022 can be split in to 3 main building blocks:-</p><ol><li>Data model — Which is referred to as the <a href="http://www.iso20022.org/business_model.page">ISO20022 business model</a></li><li>Data dictionary — Known as the <a href="http://www.iso20022.org/standardsrepository/public/dictionaryModel/repositorySearch.xhtml">ISO20022 repositor</a>y</li><li><a href="http://www.iso20022.org/full_catalogue.page">Message Definition Reports</a></li></ol><h3>ISO20022 Business Model</h3><p>ISO20022 splits the data model by business domain (payments, securities etc.) and also has a separate section for common business components (aka uml classes).</p><p>Within the zip file for a particular domain, the business model can be split down in to lower level business capabilities. For example, in the payments business concepts zip file, there are 2 spreadsheets:-</p><ol><li>Payments</li><li>Exceptions and Investigations</li></ol><p>Within each Excel spreadsheet, there are then tabs which look at the relationships surrounding a particular business component.</p><p>The data model is provided as a set of UML class diagrams. Each uml class is referred to as a business component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5uX7kR5DSzUe3j9s" /></figure><p>Unfortunately, the UML class diagrams are simply images embedded in an Excel spreadsheet, whereas a data architect’s job would be a lot easier if they’d used the XML Interchange (XMI) format which is designed for sharing UML diagrams.</p><p>The business components don’t have any attributes (aka business elements) depicted in the diagrams so you will need to <a href="http://www.iso20022.org/standardsrepository/public/dictionaryModel/repositorySearch.xhtml">search the repository</a> in order to find this information or look at part 3 of the relevant message definition report (see section below)</p><p>Finally, each tab only gives you a partial view on the business model. To create a complete business model, you’ll need to add the information stored in multiple tabs on multiple spreadsheets together.</p><h3>ISO20022 Repository</h3><p>The online repository search is the best way of navigating between the ISO20022 business model and the Message Definition Reports. It provides information about:-</p><ol><li>ISO20022 business model (business components, business elements, business codesets, datatypes)</li><li>Message Definition Reports (message components, message elements)</li></ol><p>If you search, for example, for information about the <a href="http://www.iso20022.org/standardsrepository/public/dictionaryModel/repositorySearch.xhtml#query=Account/status=ANY/object=BUSINESS_COMPONENT">“Account” business component</a>, it will be returned as the top entry in your search list.</p><p>Note: You can check that it is a business component rather than a message component by hovering your cursor over the moon shaped icon to the left of the word “Account”. You can also see on the left hand side that there are business elements, message definitions, message components and message elements that refer to “Account” in some shape or form.​</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*w7TmHof6jT1yECih" /></figure><p>For a business component, you can also see that there are 4 tabs which will provide you with information.</p><ol><li>The description tab is a short description of the business component and may contain synonyms.</li><li>The content tab contains the business elements (attributes) of the business component.</li><li>The business usage tab shows the other business components that this business component has relationships with.</li><li>The derived message concepts tab shows which message components reference this business component.</li></ol><p>Using the information obtained so far, you should be able to start to cobble together an entity-relationship diagram covering part of the ISO20022 business model. Here’s an example of a part of payment covering the 4 main party roles, the different payment methods and the payment initiation and instructions (which make up the payment execution). Missing from the diagram are additional party roles, currency exchange, tax, the underlying payment obligation, account information and the manner in which the payment is settled (money transferred from the debtor to the creditor’s account).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/0*Wk-xyTRi-4xFK4WP" /></figure><p>In order to utilise the eRepository, ISO20022 suggest that you:-</p><ol><li>Download the <a href="http://www.iso20022.org/documents/eRepositories/Metamodel/ISO20022_2013_ecore_metamodel.zip">ISO 20022:2013 ecore implementation metamodel</a>. (which is a zip containing a file with a .ecore suffix).</li><li>Then generate an Eclipse plugin</li><li><a href="http://www.iso20022.org/sites/default/files/documents/eRepositories/Metamodel/20161025_ISO20022_eRepository.zip">Download the e-Repository</a> (which is a zip with a .iso20022 suffix)</li><li>Load the eRepository using the Eclipse plugin that you generated.</li></ol><p>When I started examining ISO20022, It took me a day or two to install Eclipse and follow these steps to find that it provides you a plugin that appears only to allow you to browse the information and I was unable to work out how to extract the information from it, as there was no export capability.</p><p>What I did eventually discover was the eRepository in step 3, is actually an xml file. Once I found that, I wrote an <a href="http://en.wikipedia.org/wiki/XQuery">xquery</a> script in order to extract the <a href="http://en.wikipedia.org/wiki/XPath">xpath</a> definitions for each message component/message element in each message schema definition. With this information, any xml parser can extract the data from an incoming xml file, and you can then process it and/or save it to a back end data store.</p><h3>ISO20022 Message Definition Reports (MDRs)</h3><p>This is where you’re most likely to start when you look at ISO20022. The MDRs are contained within the <a href="http://www.iso20022.org/full_catalogue.page">full catalogue of messages</a>and also within domain-specific catalogues e.g. the <a href="http://www.iso20022.org/payments_messages.page">payments domain catalogue</a></p><p>There is an MDR for each business process (e.g. payments initiation, payments clearing &amp; settlement, notifications and exceptions etc.)</p><p>The message definition reports are written for human understanding. They’re split into 3 parts:-</p><p>1. Part 1 — is a word document which explains the business scenarios in which the business process is typically used and includes information about the actors (systems, people) involved in the business process and which messages would typically be passed between them.</p><p>2. Part 2 — is a PDF document which, for each message used by the business process, describes:-</p><p>a. The overall structure of the message</p><p>b. The definitions of any constraints identified within the message specification</p><p>c. The message building blocks — detailed information about the message components and message elements</p><p>3. Part 3 — provides information about:-</p><p>a. The business components &amp; business elements used by the messages</p><p>b. Links the message components &amp; message elements in the message to the business components &amp; business elements</p><p>c. Provides a uml class diagram depicting the relationships between the business components used in the message (unfortunately missing the cardinality)</p><p>It’s recommended that you read part 1 first to get a clear understanding of the business process, and then read part 2 to start to understand the information that will be contained in the message, referring back to part 3 to link this back to the business components &amp; business elements that will need to be in your back end data store.</p><h3>Potential drawbacks of ISO20022</h3><p>It is impossible to create a standard that satisfies everybody. As the standard has been produced by financial institutions for the purpose of financial institutions, it can be seen as being a little heavy for other developers who don’t have a need for all of the information required for processing financial messages, and have more lightweight methods of passing data.</p><p>For example, ISO20022 originally exclusively mandated messages to be defined using XML schema definitions (<a href="http://en.wikipedia.org/wiki/XML_Schema_(W3C)">XSD</a>s) which are relatively robust in enforcing the syntax of XML messages by examining their structure, cardinality, data types, whether elements are mandatory or optional and whether they have restricted sets of values (codesets) associated with them.</p><p>Nowadays, most web developers have got used to being able to pass data between back end web services and front end web pages using a simpler message format known as <a href="http://en.wikipedia.org/wiki/JSON">JSON</a>. This is much less verbose (i.e. requires less words) than the equivalent XML message (but JSON also not as robust at validating the message as there is currently no standard JSON schema definition agreed).</p><p>A key advantage of JSON for web developers is that <a href="http://en.wikipedia.org/wiki/JavaScript">javascript</a> (most common language for dynamically altering the contents of a web page) can easily parse the data provided by a JSON file and assign a message component to a javascript object and a message element to a javascript object property. The reduction in message size and not requiring an additional library to be installed to parse the message makes JSON more attractive to web developers than XML.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e10f78ddd1bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Snowflake — the nuts & bolts in 2023]]></title>
            <link>https://medium.com/@james.m.dey/snowflake-the-nuts-bolts-in-2023-194d6b8cf32c?source=rss-b18e8195bd0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/194d6b8cf32c</guid>
            <category><![CDATA[data-architecture]]></category>
            <category><![CDATA[snowflake]]></category>
            <dc:creator><![CDATA[James Dey]]></dc:creator>
            <pubDate>Mon, 13 Nov 2023 10:58:24 GMT</pubDate>
            <atom:updated>2023-11-13T19:17:10.015Z</atom:updated>
            <content:encoded><![CDATA[<h3>Snowflake — the nuts &amp; bolts in 2023</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YDCHD6CI1B7KPbiNj6N2IA.png" /><figcaption>A modern data architecture with Snowflake at its coare</figcaption></figure><p>I very much enjoyed working with Snowflake whilst working as a data solution architect at <a href="https://www.mintel.com/">mintel.com</a>, 1 of the world’s leading consumer behaviour research companies. I developed a <a href="https://datavaultalliance.com/data-vault-2-the-details/">data vault 2.0</a> based data mart for them there which covered the information about food &amp; drink products that you’ll typically find located on the packaging:- flavour, ingredients, manufacturer etc.</p><h3>History</h3><p>Snowflake began in 2012 with the first cloud native lakehouse platform which allowed you to seperately manage the performance and associated costs of compute (processing) and data storage. Snowflake started to gain <a href="https://trends.google.com/trends/explore?date=all&amp;q=%2Fg%2F11b8krtt2g&amp;hl=en-GB">widespread adoption from around 2018 onwards</a></p><h3>Open Platform</h3><p>Snowflake doesn’t tie you into a single vendor platform as is more of the case with Databricks. Shown in the diagram above are popular choices <a href="https://airflow.apache.org/">Airflow</a> — orchestration, <a href="https://www.fivetran.com/">Fivetran</a> — ingestion, <a href="https://www.getdbt.com/">dbt</a> — data pipelining and <a href="https://www.tableau.com/">Tableau</a> — data visualisation, that Snowflake has partnered with.</p><p>Snowflake also doesn’t tie you to a single cloud platform. Snowflake can be hosted on <a href="https://www.snowflake.com/technology-partners/google-cloud-platform/">GCP</a>, <a href="https://www.snowflake.com/technology-partners/amazon-web-services/">AWS</a> or <a href="https://www.snowflake.com/en/why-snowflake/partners/microsoft/">Azure</a> with data centers in the major regions, if you have latency concerns or laws require you to host data in a specific place.</p><p>Snowflake also has a thriving <a href="https://app.snowflake.com/marketplace/">app marketplace</a> that will fill in any tool gap that you can imagine in your system architecture needs.</p><h3>Snowpark</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8az3x7RgGjsGHFp8" /><figcaption>Snowpark high level architecture diagram</figcaption></figure><p>Snowflake, of course, allows you to write in a highly enhanced version of ANSI SQL, but additionally allows you to write applications, user defined functions (UDFs) and stored procedures in Python, Java and Scala in it’s feature called <a href="https://www.snowflake.com/en/data-cloud/snowpark/">SnowPark</a>. You can also run these within Snowpark Container Services</p><h3><strong>Snowflake Notebooks</strong></h3><p>As part of their recent <a href="https://www.excel.london/mobile/visitor/whats-on/snowflake-data-cloud-world-tour-london-2022">Snowflake Data Cloud World Tour</a>, Snowflake announced that Notebooks would be introduced as a new development interface. This allows you to write interactive code which you can execute and do basic data visualisations within the Notebook environment. It also allows you to train an deploy Snowpark ML models greatly closing the gap with Databricks that was previously favoured by the data science community</p><h3>Large Language Model (LLM) Assistance</h3><ul><li><a href="https://www.snowflake.com/blog/use-ai-snowflake-cortex/">Snowflake Cortex</a> — allows you to securely access <a href="https://huggingface.co/">Hugging face</a> LLMs from within Snowflake</li><li><a href="https://itwire.com/business-it-news/data/snowflake-announces-document-ai-to-query-your-paper-based-forms-with-natural-language.html">Document AI</a> — ability to analyse &amp; extract information from documents using AI e.g. document summaries</li><li>Snowflake Copilot — assists with SQL creation using natural language prompts</li></ul><h3>Snowflake Data Governance</h3><p>Similar in concept to Databricks <a href="https://www.databricks.com/product/unity-catalog">Unity Catalog</a>. Applies tight data governance to Snowflake objects both internally as well as on externally accessible Apache Iceberg datasets. Also provides data lineage capability</p><h3>Apache Iceberg</h3><p>Snowflake also announced support for Apache Iceberg. This is a file format for data lakes that is designed for huge analytical data. It enables sql tables to be wrapped over the files with high performance data processing engines such as Spark and Hive able to interact with this. It has <a href="https://database.guide/what-is-acid-in-databases/">ACID</a> capabilities and you’re able to time travel.</p><h3>Connectivity</h3><p>Connecting to Snowflake is a breeze. As well as the strong vendor tool support, for your own development, Snowflake supplies the following drivers:-</p><ul><li>JDBC</li><li>ODBC</li><li>.NET</li><li>Node.JS</li><li>Python</li></ul><p>In addition to the driver option, Snowflake provide a CLI called SnowSQL which allows you to create/alter, read, update &amp; delete any Snowflake object.</p><h3>How do I import data into Snowflake?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Nwq1NwUHEsdpnZqt.png" /><figcaption>PUT to move data into cloud storage/stage. COPY INTO to move into Snowflake Table</figcaption></figure><p>In addition to using Vendor tools, the main method is to use the SNOWSQL PUT followed by COPY INTO commands, if you want to load large data files.</p><p>In addition to the methods shown in the diagram, you can use the Web Interface to upload small files (&lt;50MB)</p><h3>How about near real time loading?</h3><p>Snowflake has you covered there as well. Snowpipe will monitor cloud storage, pick up any new files and put it into staging. It then uses the COPY INTO to push the file contents into a Snowflake table.</p><p>If you want to stream data into a Snowflake table from a message queue e.g. Kafka, then you can use Snowpipe streaming which works the same way but by monitoring a message queue rather than cloud storage.</p><h3>Competitors</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/243/0*3xfXNKE258SKApWF" /></figure><p>At the moment, there is a fierce rivalry with Databricks which has almost identical functionality as Snowflake. Check out my earlier ‘<a href="https://medium.com/@james.m.dey/databricks-for-data-warehouse-architects-ee08ef1a584c">Databricks for Data Warehouse Architects’</a> to understand more</p><p>A key difference is between Databricks philosophy (of providing every feature itself) and Snowflake’s (encouraging a partner tool vendor ecosystem). There are pros &amp; cons of both approaches. What I like about Snowflake’s approach is that you can pick and choose so can get ‘best of breed’.</p><h3>How much will it cost?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/291/0*D8JLz_QoDicauwW-" /></figure><p>As in everything cloud related, the arguments are similar to Rent vs Buy. If you don’t know whether a project will succeed or not the speed of being able to spin up a Snowflake instance and get up and running makes it enticing. The debate continues with end client finance folk as to whether over the long run, the costs are bearable and there is always pressure to reduce costs as much as possible.</p><p>Snowflake provide <a href="https://www.snowflake.com/en/data-cloud/pricing-options/">Pricing Options (snowflake.com)</a> that help calculate the estimated costs.</p><p>Once you’ve got Snowflake, you can also <a href="https://docs.snowflake.com/en/guides-overview-cost">Manage costs in Snowflake</a> e.g. by setting up budgets and monitoring resource usage.</p><h3>Getting Started with Snowflake</h3><p>For beginners to Snowflake, I’d recommend:-</p><ol><li>Take a free SQL course e.g. <a href="https://www.youtube.com/watch?v=5hzZtqCNQKk">SQL For Beginners Tutorial | Learn SQL in 4.2 Hours | 2021 — YouTube</a></li><li>Familiarise yourself with data architecture, data warehousing, data modeling and data lake concepts — <a href="https://youtu.be/TaMJ0Y5CmzA">https://youtu.be/TaMJ0Y5CmzA</a></li><li>Get a basic understanding of Snowflake — <a href="https://youtu.be/TaMJ0Y5CmzA">https://youtu.be/TaMJ0Y5CmzA</a></li><li>Sign up for a <a href="https://signup.snowflake.com/?utm_source=bing&amp;utm_medium=paidsearch&amp;utm_campaign=em-gb-en-brand-trial-phrase&amp;utm_content=bi-eta-evg-ss-free-trial&amp;utm_term=c-o-snowflake%20trial-p&amp;_bt=&amp;_bk=snowflake%20trial&amp;_bm=p&amp;_bn=o&amp;_bg=1275434300010126&amp;gclsrc=3p.ds&amp;&amp;gclid=64343277ee2d1f29d14b5725e0a3fc27&amp;gclsrc=3p.ds&amp;msclkid=64343277ee2d1f29d14b5725e0a3fc27">free Snowflake trial</a></li><li>Attend a <a href="https://www.snowflake.com/virtual-hands-on-lab/">Snowflake Virtual Hands-on Lab</a></li><li>Learn <a href="https://www.w3schools.com/python/">Python</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=194d6b8cf32c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to write a simple chatbot]]></title>
            <link>https://medium.com/@james.m.dey/how-to-write-a-simple-chatbot-16229e47654d?source=rss-b18e8195bd0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/16229e47654d</guid>
            <category><![CDATA[data-architecture]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[James Dey]]></dc:creator>
            <pubDate>Sat, 11 Nov 2023 13:08:35 GMT</pubDate>
            <atom:updated>2023-11-11T14:10:37.776Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/351/0*mDitd3oVeHwmurgB" /></figure><p>With all of the publicity surrounding <a href="https://chat.openai.com/auth/login">chatGPT</a> and it’s ability to respond to almost any prompt that you can throw at it with a fairly accurate response, I figured that I’d like to have a go myself.</p><p>Then I remembered that I don’t have a multi-million dollar budget</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/265/1*isIWbasNMlJmEAnIa1mPQQ.png" /></figure><p>Last week, I heard that <a href="https://openai.com/">OpenAI</a> had produced a <a href="https://help.openai.com/en/articles/8554397-creating-a-gpt">GPT builder</a> which allows you to create your own chatbot which has API access to a very advanced large language model that chatGPT uses. However as that costs $20pcm and I don’t like spending money for no return, I crossed that off my list as well.</p><p>However, it did inspire me to work out how I might produce a simple chatbot that would help me with my work as a senior data architect.</p><p>In data architecture, we create conceptual data models that represent business concepts and then eventually get down in to the weeds and produce physical data models which can then generate databases which then store the data that is used by front end applications or reporting tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VHULOY2UmAcL_TXI.png" /><figcaption>Example of a physical data model</figcaption></figure><p>As part of this process, we create <a href="https://www.techtarget.com/searchapparchitecture/definition/data-dictionary">data dictionaries</a> which typically end up in a rather large spreadsheet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/0*l3bSINLeJ-FiQHR9.PNG" /><figcaption>Example of a data dictionary</figcaption></figure><p>Searching for information in a data dictionary can get quite difficult, so how about if I could create a chatbot that would make life easier. As it’s a narrow focus, I don’t have to handle a huge variety of potential questions so can take the old fashioned approach of generating a set of rules that can be applied to a query prompt to identify what the user is asking and then create a subsequent action.</p><p>I’ll call my chatbot, chatERD as a data model diagram is more formally known as an <a href="https://www.techtarget.com/searchdatamanagement/definition/entity-relationship-diagram-ERD#:~:text=An%20entity%20relationship%20diagram%20(ERD,information%20technology%20(IT)%20system">entity relationship diagram (ERD)</a>.</p><h3>ChatERD</h3><p><strong>Step 1 — Create a JSON data dicitonary</strong></p><p>Ok, so it’s fairly trivial to create a <a href="https://en.wikipedia.org/wiki/JSON">JSON</a> file of a data dictionary from an Excel spreadsheet, so I won’t bother to explain this bit in detail, you can read in an Excel file into pandas and push out a JSON file. I created a simple JSON data dictionary as a test and called it data.json. Here we have customers, sales and orders, with a column or 2 in each.</p><pre>{<br>  &quot;customers&quot;: [<br>    {<br>      &quot;column_name&quot;: &quot;customer_id&quot;,<br>      &quot;description&quot;: &quot;Unique identifier for a customer&quot;,<br>      &quot;datatype&quot;: &quot;int&quot;<br>    },<br>    {<br>      &quot;column_name&quot;: &quot;customer_name&quot;,<br>      &quot;description&quot;: &quot;Name of the customer&quot;,<br>      &quot;datatype&quot;: &quot;string&quot;<br>    }<br>  ],<br>  &quot;sales&quot;: [<br>    {<br>      &quot;column_name&quot;: &quot;sales_id&quot;,<br>      &quot;description&quot;: &quot;Unique identifier for a sale&quot;,<br>      &quot;datatype&quot;: &quot;int&quot;<br>    },<br>    {<br>      &quot;column_name&quot;: &quot;customer_id&quot;,<br>      &quot;description&quot;: &quot;Foreign key to the customer table&quot;,<br>      &quot;datatype&quot;: &quot;int&quot;<br>    },<br>    {<br>      &quot;column_name&quot;: &quot;order_id&quot;,<br>      &quot;description&quot;: &quot;Foreign key to the order table&quot;,<br>      &quot;datatype&quot;: &quot;int&quot;<br>    }<br>  ],<br>  &quot;orders&quot;: [<br>    {<br>      &quot;column_name&quot;: &quot;order_id&quot;,<br>      &quot;description&quot;: &quot;Unique identifier for an order&quot;,<br>      &quot;datatype&quot;: &quot;int&quot;<br>    },<br>    {<br>      &quot;column_name&quot;: &quot;order_date&quot;,<br>      &quot;description&quot;: &quot;Date when the order was placed&quot;,<br>      &quot;datatype&quot;: &quot;date&quot;<br>    }<br>  ]<br>}</pre><p>Step 2 — Write Python code to import data.json</p><pre>import json<br><br># Load the JSON file into a Python dictionary<br>with open(&#39;data.json&#39;) as f:<br>    data = json.load(f)</pre><p>Step 2 — Write some rules and actions</p><pre># Define a set of rules for processing the user&#39;s queries<br>rules = {<br>    (&#39;how many entities&#39;,&#39;how many different entities&#39;,&#39;count of entities&#39;,&#39;total entities&#39;,&#39;quantity of entities&#39;,&#39;number of entities&#39;): lambda query: len(data),<br>    (&#39;column names containing word&#39;,&#39;column names that contain the word&#39;): lambda query: [f&quot;{table_name}.{column[&#39;column_name&#39;]}&quot; for table_name, columns in data.items() for column in columns if query.split()[-1].strip(&#39;\&#39;&quot;&#39;) in column[&#39;column_name&#39;]],<br>    &#39;description for&#39;: lambda query: [column[&#39;description&#39;] for table_name, columns in data.items() for column in columns if column[&#39;column_name&#39;] == query.split()[-1]][0]<br>}</pre><p>So on the left hand side, I’ve created a list of potential sections of a prompt that a user might enter and on the right handside I’ve created a <a href="https://www.freecodecamp.org/news/python-lambda-function-explained/#:~:text=Lambda%20functions%20are%20similar%20to,single%20line%20of%20a%20statement">lambda function</a> that does something with it.</p><p>So as an example, if a customer asks “how many entities are there in the model” or “how many different entities are there?” or “give me a count of entities” etc. then it will execute the lamda function that simply counts the number of top level entries in the data.json file which happens to relate to each entity. You can clearly expand this list of potential sections of a prompt as and when you find somebody creating a prompt query that isn’t captured by these rules. As it’s a narrow focus, this isn’t hard to do.</p><p><strong>Step 3 — Write a function that will process the prompt query</strong></p><pre># Write a function that processes the user&#39;s queries based on the defined rules<br>def process_query(query):<br>    #Split the rules into rules and actions<br>    for rule, action in rules.items():<br>        #If there is more than 1 rule then do this<br>        if isinstance(rule, tuple):<br>            if any(r in query for r in rule):<br>                print(f&quot;Query:{query}&quot;)<br>                return action(query)<br>        #Otherwise if there&#39;s just 1 rule then do this<br>        elif rule in query:<br>            print(f&quot;Query:{query}&quot;)<br>            return action(query)<br>    #If we couldn&#39;t interpret the prompt then apologise<br>    return &#39;Sorry, I could not understand your query.&#39;Ste</pre><p>Step 4 — Test with a few sample prompts</p><pre># Test your app by running it with sample queries and verifying that it returns the correct responses<br>print(&quot;Response:&quot;,process_query(&#39;Tell me how many entities I have in the model&#39;),&quot;\n&quot;)<br>print(&quot;Response:&quot;, process_query(&#39;Find me column names that contain the word &quot;id&quot;&#39;),&quot;\n&quot;)<br>print(&quot;Response:&quot;, process_query(&#39;Give me the description for sales_id&#39;),&quot;\n&quot;)</pre><p><strong>Admire your results</strong></p><p>Query:Tell me how many entities I have in the model<br>Response: 3</p><p>Query:Find me column names that contain the word “id”<br>Response: [‘customers.customer_id’, ‘sales.sales_id’, ‘sales.customer_id’, ‘sales.order_id’, ‘orders.order_id’]</p><p>Query:Give me the description for sales_id<br>Response: Unique identifier for a sale</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16229e47654d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data teams in the new world of AI]]></title>
            <link>https://medium.com/@james.m.dey/data-teams-in-the-new-world-of-ai-fc9fb608da26?source=rss-b18e8195bd0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc9fb608da26</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-architecture]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-analytics]]></category>
            <dc:creator><![CDATA[James Dey]]></dc:creator>
            <pubDate>Sun, 05 Nov 2023 12:49:06 GMT</pubDate>
            <atom:updated>2023-11-06T23:35:12.020Z</atom:updated>
            <content:encoded><![CDATA[<h3>Data teams in the new world of Generative AI</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/379/1*aVo6GHwdWkKCcTMYYQUIAA.jpeg" /><figcaption>The future of Data</figcaption></figure><p>AI has been developed for several years and successfully used in applications such as cancer detection, fraud analysis and Amazon Alexa.</p><p>With the release of <a href="https://chat.openai.com/">chatGPT</a> in 2022, and it’s subsequent incorporation into the Microsoft Office products and Bing, we are in the midst of a sea change in the way that jobs are performed, however.</p><p>This article looks at what is possible today, what should be possible in future years and how this will affect data teams.</p><h3>What is AI?</h3><p>AI is creating smart machines that can do tasks that require human intelligence, and provide knowledge that previously was limited to individuals who acquired it over years.</p><p>AI has subfields, such as <a href="https://en.wikipedia.org/wiki/Machine_learning">machine learning</a>, <a href="https://en.wikipedia.org/wiki/Natural_language_processing">natural language processing</a>, and <a href="https://en.wikipedia.org/wiki/Generative_artificial_intelligence">generative AI</a>.</p><p>It’s generative AI e.g. <a href="https://openai.com/research/gpt-4">GPT-4</a> which has had the biggest impact transforming many business functions. Generative AI gainst <a href="https://en.wikipedia.org/wiki/Large_language_model">Large Language Models (LLMs)</a> is what specifically has the biggest impact on data teams</p><h3>How is AI used today?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*7nG0E7sURPhQkutN.png" /></figure><p>In terms of data, AI can process complex data faster and more accurately, resulting in better business insights.</p><h3>What is Generative AI?</h3><p>The term refers to the ability to generate new material from existing sources by using AI models. Prominent examples include:-</p><ul><li>chatGPT which allows text or speech prompts to generate mainly text responses (Note: it can also generate dall-e images now)</li><li><a href="https://openai.com/dall-e-3">Dall-e</a> and <a href="https://www.midjourney.com/home">Midjourney</a> which allow images to be generated</li><li><a href="https://www.linkedin.com/posts/eric-vyacheslav-156273169_this-is-going-to-change-the-whole-industry-ugcPost-7126556518857981952-eva5?utm_source=share&amp;utm_medium=member_android">Text to video</a> is now also achievable.</li></ul><h3>How can data teams use Generative AI to increase productivity?</h3><p>Generative AI can also help data practitioners with:-</p><ul><li><strong>Code interpretation and generation</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/1*t4Yq2Iv2xzQs4aIggtDaqg.png" /><figcaption>Example of chatGPT generating python code</figcaption></figure><p>Examples here include <a href="https://github.com/features/copilot">GitHub Copilot</a> which can be added to a data engineers <a href="https://www.geeksforgeeks.org/what-is-ide/">IDE</a> or simply ask chatGPT to generate code, which includes comments.</p><p>For my last project, I created a working prototype of an energy trading data store using exactly this method. I created structured &amp; commented Python &amp; SQL code which is much easier to read &amp; understand and hence much more maintainable than what a typical data engineer would create. It still required background knowledge of how to code and neither approach is currently perfect but it wouldn’t have been possible to meet the goal without it.</p><ul><li><strong>Learning &amp; skills</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0jAiqoDY4LVFNaBVHWG9LA.png" /></figure><p>Learning about any subject is easier with chatGPT because you can ask it a question, get a response and ask it a follow on question. Much of the lines of enquiry for this article involved AI assisted research.</p><ul><li><strong>Business analysis</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wOivI5pLqBsuV3NeQHdpVg.png" /></figure><p>Similar to Learning, if you want to acquire specific knowledge about a particular business domain just ask chatGPT.</p><p>I knew nothing about energy trading at <a href="https://www.shell.com/">Shell</a> but knowing that a Deal was at the core, by using chatGPT I could explore all of the industry terms and establish how <a href="https://www.investopedia.com/ask/answers/041415/what-are-some-common-measures-risk-used-risk-management.asp">Risk reporting metrics</a> worked. I then talked to business analysts and report writers to confirm my acquired knowledge was valid and not the result of a ‘hallucination’ (a polite term for incorrect info).</p><ul><li><strong>Data Profiling</strong></li></ul><p>You can just ask for code to be generated to meet your <a href="https://en.wikipedia.org/wiki/Data_profiling">data profiling</a> needs, which will do things like tell you how many nulls a column has, maximum length of field etc . Alternatively, chatGPT has also been incorporated into Excel so you can try using that.</p><ul><li><strong>Summarisation of data insights</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7dZrUuTiM6hVfLSFG-fuNg.png" /></figure><p>chatGPT is now integrated with Excel, so you can use natural language to ask it to provide insights on a dataset. e.g. which part of my organisation’s costs are increasing significantly and can you tell me if that’s a general trend?</p><ul><li><strong>Preparation of Presentations</strong></li></ul><p>You can ask chatGPT to write short sections for articles &amp; decks</p><ul><li><strong>Generating test data</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*4rcbM_c0E79_lfnvbUBhLA.png" /></figure><p>Python has a library called faker which is really good for generating test data that looks right for things like customers in a particular location but you can ask chatGPT to modify additional aspects to tailor the test data specific to your use case.</p><h3>Drawbacks of Generative AI</h3><p>At the moment, things aren’t perfect. Key problems include:-</p><ul><li>If you ask midjourney or Dall-E to generate images, the images aren’t bad but words within the images are usually wrong which is a giveaway that AI has been used.</li><li>Tools such as chatGPT or <a href="https://bard.google.com/?hl=en-GB">Google Bard</a> that rely on large language models (LLMs) are good with language so can write works of fiction but cannot yet be wholly relied upon to provide facts so you need to check its output by either asking an expert or checking reliable sources.</li><li>Generative AI prompt tools aren’t that great at solving logic puzzles. I bought my son an escape room puzzle for his birthday. The first challenge was to complete a 3 by 3 slider puzzle. I thought this would be an ideal occasion to prove that my prompt engineering skills would solve the puzzle in less time. Sadly it had not got out of its hallucinations before my son had completed the entire puzzle. You might wonder why it’s pretty good at coding but pretty bad at logic puzzles. It comes down to the fact that LLMs are trained by ingesting vast quantities of internet data and deducing patterns &amp; relationships. As there are a lot of coding examples on GitHub, it has a lot of material to work with. Solutions for logic puzzles are less common however.</li><li>LLMs rely on the information that they were trained on. Any new material is unknown so prompt responses get poorer. Semi remedies to this are to include additional information in the prompt chat</li><li>LLMs aren’t guaranteed to return the same information to the same prompt. Note: The more precise the prompt, the more likely it is you will get the same response.</li><li>Prompt responses are generated by drawing on a large library of knowledge rather than specific sources, this makes the provenance of information difficult to establish. Often hyperlinks are provided but those just relate to the prompt subject rather than the generated prompt response</li></ul><h3>Future of Generative AI</h3><p>It’s only going to improve. LLMs are being developed that have ingested newer and deeper material. The drawbacks above will be fixed by creating domain specific LLMs / extensions and getting deeper material for each domain.</p><p>If we look at how data teams operate, at the moment there’s a lot of complexity in the world of data.</p><p>Data solution architects spend time understanding use cases, researching vendor offerings, constructing system architectures, hiring data engineers etc. But in future a lot of this will be simply answered by asking AI using natural language to assist which will mean months of work can be completed in days.</p><p>With data engineering, do you really need people who are experts in Python, R, Scala, Snowflake, Databricks, Kafka etc in a world where high level designs can reliably generate code, build, test and deploy to the cloud? Probably not. A lot of data engineering already works on templated code, environment build and infrastructure scaling. Just as coders don’t write machine code, and electrical engineers don’t work at the transistor level, it’s clear that mankind progresses by working at higher &amp; higher levels over time.</p><p>Does this mean that there will be no work for techies? Not really. If we consider the drawbacks of the current state of AI, there is a new field ‘prompt engineering’ that tries to reduce these issues by directing generative AI so that it produces more precise results. To use a real world analogy, it’s like defining a set of boardgame rules. It still requires thought on how to define those rules to avoid ambiguity. That requires a logical mind.</p><h3>How to adapt to the new world of Generative AI</h3><p>Data practitioners will need to:</p><ul><li>Enhance your skills in data visualization, storytelling, and communication, as AI can automate some data tasks, but not the interpretation and presentation of the insights.</li><li>Collaborate with other data practitioners and stakeholders, as AI can facilitate data sharing and integration, but also requires coordination and alignment of goals and expectations.</li><li>Embrace the opportunities and challenges that AI brings, and be ready to innovate and experiment with new data sources, methods, and solutions.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc9fb608da26" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Concepts]]></title>
            <link>https://medium.com/@james.m.dey/data-concepts-7ee21d7705d3?source=rss-b18e8195bd0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ee21d7705d3</guid>
            <category><![CDATA[data-architecture]]></category>
            <dc:creator><![CDATA[James Dey]]></dc:creator>
            <pubDate>Thu, 26 Oct 2023 11:20:29 GMT</pubDate>
            <atom:updated>2023-10-26T15:38:50.262Z</atom:updated>
            <content:encoded><![CDATA[<p>When you’re working with the business, it’s important to speak in the language that they understand rather than the language of IT.</p><p>As a concrete example, the following is a short summary of energy trading from which key data concepts can be identified. The keywords highlighted in bold are your data concepts and those in italics are your synonyms/related terms (although we are told in IT to speak in business language, there are many tongues).</p><h4><strong>Energy Trading</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gKzM8s_gTIkP24yU.jpg" /><figcaption>Stock image of an energy trader</figcaption></figure><p>At the heart of energy trading, is a <strong>Deal</strong>.</p><p>A deal<strong> </strong>can either be:-</p><ul><li>a <strong>physical deal</strong> — a deal which involves trading of a physical product (e.g. 1 that relates to oil, coal, gas, power or environmental products) in return for another physical product or a cash equivalent</li><li>a <strong>financial deal </strong>— refers to hedging the risk of a physical deal via <strong>options, FX, futures or swaps</strong></li></ul><p>Energy trading is organized by markets which have their own <strong>commodity</strong> prices e.g. the price of Brent Crude differs from WTI Crude</p><p>Any action by any party during the lifecycle of a deal is referred to as a <strong>deal leg</strong></p><p>A deal leg has 2 sides to it. Side 1 is what the <strong>trader</strong> is offering and Side 2 is what the <strong>counterparty</strong> is offering in exchange</p><p>Associated to a deal are <strong>fees</strong></p><p>A deal can be grouped by <strong>deal type </strong>(aka an <em>instrument</em>)</p><p>A deal is supported by a <strong>contract </strong>(aka <em>a master agreement</em>) which defines the standard terms &amp; conditions which the trader and counterparty agree to</p><p>Deals are grouped by <strong>deal books</strong></p><p>A deal book is organized by <strong>trading desk</strong>/<strong>trading subdesk</strong>, a <strong>trading area</strong> and by the <strong>legal entity</strong> (aka <em>house or company</em>) that owns the products being traded.</p><h3>Explaining Data Concepts</h3><p>The easy way is via a diagram, which you then talk through using the summary above. This allows representative users to feed back on things such as whether they like the chosen name or prefer 1 of the synonyms, as an example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*6HmvU30XeGEys_cK49Hbzg.png" /><figcaption>Conceptual data model diagram to support an energy trading &amp; risk management data store</figcaption></figure><h3>Why bother identifying data concepts?</h3><p>There are 2 main reasons in my opinion:-</p><ul><li>Within delivery, you ultimately have to deliver some kind of front end application or report/dashboard that the business understand. The closer that you are to identifying concepts that chime, the better it will go down with the end user.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*yxBcdtHibQPvIGv6PmMeKA.png" /></figure><ul><li>Outside of delivery, IT is often seen as magic or masters of the dark arts. Telling the business about how you’re building an <a href="https://www.elastic.co/what-is/large-language-models">LLM </a>will mean nothing at best (or confusion if you’re talking to lawyers), and will distinctly alienate your audience at worst. The business just want to know how you’re going to make their lives easier, not how you’re going to build it. So talking about data concepts is really just about getting the business to know that you understand them.</li></ul><p>There’s a <a href="https://youtu.be/Vywf48Dhyns">great episode</a> of a UK comedy called the ‘IT Crowd’ where the IT manager explains the concept of the internet to business folk which succintly illustrates the difference between the world of IT &amp; business. <br>The IT manager isn’t very technical but a good communicator. Her staff think they can get a laugh out of her by feeding her ridiculous information that the internet is contained in a single magic box, but it backfires when the business love her speech and then panic when an incident causes the box to be crushed. Well worth watching.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ee21d7705d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What does a data architect do?]]></title>
            <link>https://medium.com/@james.m.dey/what-does-a-data-architect-do-1d68267f91b2?source=rss-b18e8195bd0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d68267f91b2</guid>
            <category><![CDATA[data-architecture]]></category>
            <dc:creator><![CDATA[James Dey]]></dc:creator>
            <pubDate>Thu, 26 Oct 2023 08:15:14 GMT</pubDate>
            <atom:updated>2023-10-27T08:32:43.650Z</atom:updated>
            <content:encoded><![CDATA[<p>This article is prompted by a <a href="https://www.linkedin.com/feed/update/urn:li:activity:7122672482318184448/">LinkedIn post</a> posed by a well regarded data engineer asking if data architects have disappeared and/or are still relevant? As a contract data architect whose worked at all levels of data architecture for different sized companies during a 32 year IT career, I think I’m in a good position to respond.</p><h4><strong>Do data architects still exist?</strong></h4><p>Working in an organisation that has dozens of data architects, I was slightly surprised at the question.</p><p>Looking at the UK IT job vacancy stats, it’s certainly true that the data engineer job title has surged since 2015, prior to which it was almost unknown</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*zOCHREdLapCZJ9G6" /><figcaption>Data Engineer vacancy rate as a %age of IT vacancies</figcaption></figure><p>However, the data architecture job title has been steadily increasing since 2008</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*zAVGGqhrCcyWxaqf" /><figcaption>Data Architect vacancy rate as a %age of IT vacancies</figcaption></figure><h4><strong>Are data architects still relevant?</strong></h4><p>The more detailed version of this question is that given that data engineers are doing the bulk of the work required to build data stores in delivery teams, why do we still need data architects? I’ll answer this question by first examining the different levels of data architecture and why they exist and then explaining why data engineers aren’t best placed to replace a data architect.</p><h4><strong>How large organisations work</strong></h4><p>As organisations grow, they become increasingly difficult to manage, so with large organisations you need an element of top-down command and control to avoid anarchy. So data architecture tends to be split into enterprise data architecture and delivery data architecture with 1 or more additional layers dependent on size and complexity of the organisation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*92_Wct1JPM-bAhTgrxhW2A.png" /><figcaption>How data architecture is managed in large organisations</figcaption></figure><h4><strong>What does an enterprise data architect do?</strong></h4><ol><li>Examine <a href="https://www.dataversity.net/data-architecture-trends-in-2023/">new initiatives in the industry</a> e.g. data mesh/data products</li><li>Define the <a href="https://aws.amazon.com/what-is/data-strategy/#:~:text=your%20data%20strategy%3F-,What%20is%20a%20data%20strategy%3F,amounts%20of%20raw%20data%20today.">data strategy</a></li><li>Choose vendor tools that meet that strategy</li><li>Organise the creation of an <a href="https://tdan.com/the-enterprise-data-model/5205">enterprise data model</a></li><li>Define <a href="https://www.dataideology.com/enterprise-data-architecture/">standards &amp; policies</a></li></ol><h4><strong>What does a delivery data architect do?</strong></h4><p>In the past a delivery data architect did a variety of roles for both application and analytical data store design. This has narrowed more to just analytical data store work in more recent years. The role covers the design of:-</p><ol><li>The system architecture which covers the integration of data from data sources through to data targets with the various layers in between.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Su8L1B7UVXURFteCGvZ59w.png" /></figure><ol><li>The project conceptual/logical/physical data model</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*mIsYKfQ-cHYiDCTGUOc3ZQ.png" /></figure><ol><li>The creation of the data dictionary</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/0*CjBZKA2PvcLrb7Ir.png" /></figure><ol><li>Defining <a href="https://cloud.google.com/learn/what-is-data-governance">data governance</a> (data security, data quality rules, master data management, agreed business definitions)</li><li>Communication of the design to interested stake holders e.g data governance working group, the data product owner, consumer groups, the rest of the delivery team and the enterprise data architects</li></ol><h4>Why can’t a delivery data architect do the role of an enterprise data architect?</h4><p>It’s a matter of capacity. A delivery data architect is focused on meeting the goals of a specific project. Deadlines are tight. This leaves little to no time to investigate what else is going on in the industry</p><h4>What does a data engineer do?</h4><p>Data engineers are in delivery teams and are focused on building high performing data pipelines and dealing with environment builds, infrastructure issues and liaising with 1st line support. The role became more critical when systems processing billions of rows of data became more prevalent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/0*DoUXYLnx_4XOjXTL.png" /><figcaption>Sample data pipelining diagram showing various tools &amp; procesesses</figcaption></figure><h4><strong>Why can’t a data engineer do the role of a delivery data architect?</strong></h4><p>Again it comes down to capacity. A data engineer focused on the challenges of engineering a system that copes with large data volumes has little time left to focus on the responsibilities highlighted for a delivery data architect. Although there are some very effective communicators in the data engineering community, your typical data engineer is keener on the IT than on the comms.</p><h4><strong>Why might the poster believe that data architects are disappearing?</strong></h4><p>Job titles can evolve over time. Startups need to be first to market so thinking about architecture and future technical debt isn’t the first thing on their mind, as there won’t be a future to worry about if their product doesn’t succeed. Within startups, the roles of an enterprise data architect, a delivery data architect and a data engineer can all be done by 1 person who will more likely be referred to as a data engineer nowadays, and it’s only as organisations grow that there’s a need to split out these roles.</p><h4><strong>So are data architects still relevant?</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/0*r0SThXelBo4-7smo.png" /></figure><p>The roles &amp; responsibilities identified above are relevant so far as they add genuine business value. As with all organisations, the larger they get, the greater degrees of inefficiency can occur, and if you work purely in delivery it can seem that as this is where the primary engagement with the business exists, this is the only place that business value is added. The problem with that thought is that imagine a world without enterprise data architecture and it’s an anarchic world with different delivery teams designing data models using inconsistent tools &amp; formats leading to a nightmare of data integration challenges for the organisation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d68267f91b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Databricks — Producing & Consuming Messages]]></title>
            <link>https://medium.com/@james.m.dey/databricks-producing-consuming-messages-12d3c15b4379?source=rss-b18e8195bd0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/12d3c15b4379</guid>
            <category><![CDATA[confluent-kafka]]></category>
            <category><![CDATA[message-queue]]></category>
            <category><![CDATA[data-architecture]]></category>
            <category><![CDATA[databricks]]></category>
            <dc:creator><![CDATA[James Dey]]></dc:creator>
            <pubDate>Tue, 24 Oct 2023 15:14:30 GMT</pubDate>
            <atom:updated>2023-10-24T15:22:52.026Z</atom:updated>
            <content:encoded><![CDATA[<h3>Databricks — Producing &amp; Consuming Messages</h3><p>A common problem in data architecture is a situation where you cannot anticipate consumer demand. For example, when I worked at the UK National Lottery, consumers tended to wait until the last half hour before lottery purchases were allowed before placing their bets.</p><p>Even if you are reasonably confident that you won’t get spikes in demand in your system, it’s often better to add a message queue to your data system architecture in case somebody overloads the consuming application which will cause back pressure to occur on the producing application if it’s tightly coupled.</p><p>A final reason for needing a message queue is if you want to have a consumer application e.g. an advertising platform, react to customer behaviour on a producing application e.g. a consumer website.</p><h4>What is a message queue?</h4><p>If you think of data engineering like plumbing in your house, a message queue is like a water tank. The producer tops up the tank and the consumer takes water from the tank at a later point in time. A message queue performs exactly the same function for data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*KCRTk033rio_spHX2LVnYA.png" /></figure><h4>How can you create a message queue?</h4><p>Unfortunately, Databricks doesn’t provide a message queue capability itself.</p><p>The popular industry options are Kafka &amp; Kinesis, which can be open sourced.</p><p>However, a message queue needs to be a permanent fixture and it should be cloud accessible, so it’s better to go with a managed cloud version of Kafka e.g. <a href="https://www.confluent.io/">confluent.io</a></p><h3>Databricks Message Queue Example</h3><p>In this simple example we will:-</p><p>1. Create a Confluent Kafka Message Queue (aka “Topic”)</p><p>2. Create the consumer in Databricks notebook that will listen to a Confluent Kafka Topic</p><p>3. Create the producer in Databricks notebook and generate records of customers</p><h4>Create the Confluent Kafka Topic</h4><ol><li>Go to <a href="https://www.confluent.io/">https://www.confluent.io/</a> and click on the “Get Started” button</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*SEBWt0enPMuMS7bBXnNU4Q.png" /></figure><p>2. Sign-in with Google or Github</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*X_rXHaAuIlHE2W0AJMuIZA.png" /></figure><p>3. Create a Basic Cluster</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*CGzVuqoRsOZ_YulCCFzjbQ.png" /></figure><p>Just stick with defaults, and skip the payment options</p><p>4. Create your API Keys</p><p>From your newly created cluster, you will be able to see an option on the left hand side for “API Keys”, click on it and click on “Create key”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*HBcglYRgrFSow1wrGunujA.png" /></figure><p>Then click on “Next”</p><p>Then click on “Download and continue” button.</p><p>This will save your username, secret/password and Bootstrap server info that you will need when connecting to the Kafka Topic from Databricks</p><p>5. Create a Topic</p><p>Click on the “Create with Defaults” button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*j9g3lA1oaAe7ybZAbLkndw.png" /></figure><p>Ok, so at this point you have successfully created a Confluent Kafka cluster in the cloud and you have created a single Topic/Message Queue.</p><h4>Create the Databricks Consumer</h4><ol><li>Go to your Databricks workspace</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*Elc1RIktgy2TDCWHm6R0bg.png" /></figure><p>2. Click on the “Add” button in top right and choose “Folder”. Call your folder something like “Streaming”</p><p>3. Click on the “Add” button again and this time choose “File”. The filename should be “client.properties”. It needs to contain the following:-</p><pre>bootstrap.servers=&lt;your Confluent Kafka bootstrap server&gt;<br>ssl.endpoint.identification.algorithm=https<br>security.protocol=SASL_SSL<br>sasl.mechanism=PLAIN<br>sasl.username=&lt;your Confluent kafka username&gt;<br>sasl.password=&lt;your Confluent kafka password&gt;<br>request.timeout.ms=20000<br>retry.backoff.ms=500</pre><p>In the code snippet above, you need to replace the values for bootstrap.server, sasl.username and sasl.password</p><p>These were provided earlier when you created the API keys. They will have been saved to a text file in your Download file.</p><p>4. Back Arrow so that you’re at the folder level and click on “Add” and this time choose “Notebook”</p><p>5. Change the name of the notebook to “kafka_consumer.py” and copy the following code</p><pre>#The following line can be removed after you&#39;ve run it for the first time as it&#39;s installing a python library<br>%pip install confluent kafka<br><br>from confluent_kafka import Consumer, KafkaException<br>def read_ccloud_config(config_file):<br>  conf = {}<br>  with open(config_file) as fh:<br>  for line in fh:<br>  line = line.strip()<br>  if len(line) != 0 and line[0] != &quot;#&quot;:<br>  parameter, value = line.strip().split(&#39;=&#39;, 1)<br>  conf[parameter] = value.strip()<br>  return conf<br><br>def create_kafka_consumer():<br>  consumer_conf = read_ccloud_config(&quot;/Workspace/Users/james.dey@shell.com/streaming/client.properties&quot;)<br>  consumer_conf[&#39;group.id&#39;] = &#39;mygroup&#39;<br>  consumer_conf[&#39;auto.offset.reset&#39;] = &#39;earliest&#39;<br>  consumer = Consumer(consumer_conf)<br>  return consumer<br><br>consumer = create_kafka_consumer()<br><br># Subscribe to the topic<br>consumer.subscribe([&#39;topic_0&#39;])<br>try:<br>  while True:<br>  msg = consumer.poll(1.0) # Wait for up to 1s for a message<br>  if msg is None:<br>  continue<br>  if msg.error():<br>  raise KafkaException(msg.error())<br>else:<br>  print(&#39;Received message: {}&#39;.format(msg.value().decode(&#39;utf-8&#39;)))<br>except KeyboardInterrupt:<br>  pass<br>finally:<br>  # Close down consumer to commit final offsets.<br>  consumer.close()</pre><p>Click on “Run all”. This will download the confluent kafka library, connect to the Kafka topic that you created earlier and continually listen for incoming messages. At this point you won’t have any messages as you’ve yet to produce any, but we’ll come back to this later.</p><h4>Create the Databricks Producer</h4><p>So for the producer, we need to generate some messages and push them to the Kafka topic that we created earlier. We will use a python library called faker to generate customer 100 customer records</p><p>To do this:-</p><p>1. Back arrow back on your browser to the folder</p><p>2. Click on “Add” and choose “Notebook” and call it “kafka_producer.py”</p><p>3. Copy the following code and click “Run all”</p><pre>#The following 2 lines can be removed after you’ve run it for the first time as it’s installing a python library<br>%pip install faker<br>%pip install confluent_kafka<br><br>import os<br>from confluent_kafka import Producer<br><br>from faker import Faker<br>import json<br><br>def read_ccloud_config(config_file):<br>    conf = {}<br>    with open(config_file) as fh:<br>        for line in fh:<br>            line = line.strip()<br>            if len(line) != 0 and line[0] != &quot;#&quot;:<br>                parameter, value = line.strip().split(&#39;=&#39;, 1)<br>                conf[parameter] = value.strip()<br>    return conf<br><br>def create_kafka_producer():<br>    producer = Producer(read_ccloud_config(&quot;/Workspace/Users/james.dey@shell.com/streaming/client.properties&quot;))<br>    return producer<br><br><br>def create_customers():<br>    fake = Faker(&#39;en_GB&#39;)<br>    customers = []<br><br>    for _ in range(100):<br>        customer = {<br>            &#39;name&#39;: fake.name(),<br>            &#39;address&#39;: fake.address().replace(&#39;\n&#39;, &#39;, &#39;),<br>            &#39;email&#39;: fake.email(),<br>            &#39;phone_number&#39;: fake.phone_number()<br>        }<br>        customers.append(json.dumps(customer))<br><br>    return customers<br><br>producer = create_kafka_producer()<br><br># Send a message to the topic for each customer record<br>for customer in create_customers():<br>    producer.produce(&#39;topic_0&#39;, value = customer)</pre><p>Ok, so nothing interesting so far, right. But if you back arrow on your browser and go to “kafka_consumer.py”, you’ll see that the messages that contain the fake customer details that you have just produced in “kafka_producer.py” have magically appeared on the consumer output.</p><pre>Received message: {&quot;name&quot;: &quot;Dr Gillian Gardner&quot;, &quot;address&quot;: &quot;Flat 78e, Clark junctions, Dixonfort, E59 0YB&quot;, &quot;email&quot;: &quot;parkerlorraine@example.org&quot;, &quot;phone_number&quot;: &quot;+44(0)1164960728&quot;}<br>Received message: {&quot;name&quot;: &quot;Patricia Williams&quot;, &quot;address&quot;: &quot;Studio 56, Susan springs, East Lindashire, N5F 8FJ&quot;, &quot;email&quot;: &quot;sophiehawkins@example.net&quot;, &quot;phone_number&quot;: &quot;+44131 496 0488&quot;}<br>Received message: {&quot;name&quot;: &quot;Nicola Howard-Fisher&quot;, &quot;address&quot;: &quot;Flat 26, Heath track, Lake Shanefort, L7T 0NZ&quot;, &quot;email&quot;: &quot;jason11@example.net&quot;, &quot;phone_number&quot;: &quot;+44121 496 0350&quot;}<br>Received message: {&quot;name&quot;: &quot;Jamie Patel&quot;, &quot;address&quot;: &quot;705 Flynn centers, Hilaryberg, L0E 1YB&quot;, &quot;email&quot;: &quot;naomi52@example.org&quot;, &quot;phone_number&quot;: &quot;+44(0)1514960798&quot;}<br>Received message: {&quot;name&quot;: &quot;Leah Wright-Chamberlain&quot;, &quot;address&quot;: &quot;7 Cartwright mills, New Garethburgh, N46 0TD&quot;, &quot;email&quot;: &quot;bbarlow@example.org&quot;, &quot;phone_number&quot;: &quot;(0115)4960991&quot;}<br>Received message: {&quot;name&quot;: &quot;Ryan Cole&quot;, &quot;address&quot;: &quot;43 Abbott neck, Port Deanfort, LL4 5QX&quot;, &quot;email&quot;: &quot;annettemorgan@example.org&quot;, &quot;phone_number&quot;: &quot;(0116) 496 0994&quot;}<br>Received message: {&quot;name&quot;: &quot;Carol Owens&quot;, &quot;address&quot;: &quot;110 Lambert forges, Blackberg, M1U 1FQ&quot;, &quot;email&quot;: &quot;ritahussain@example.net&quot;, &quot;phone_number&quot;: &quot;+44(0)1214960151&quot;}<br>Received message: {&quot;name&quot;: &quot;Derek Waters&quot;, &quot;address&quot;: &quot;Studio 28B, Brown isle, Nelsonchester, L5B 5NS&quot;, &quot;email&quot;: &quot;daviesanthony@example.com&quot;, &quot;phone_number&quot;: &quot;(0151) 4960627&quot;}<br>Received message: {&quot;name&quot;: &quot;Ms Jacqueline Farrell&quot;, &quot;address&quot;: &quot;68 Nelson mission, New Molly, S21 4XU&quot;, &quot;email&quot;: &quot;jessica58@example.com&quot;, &quot;phone_number&quot;: &quot;(0131)4960789&quot;}<br>Received message: {&quot;name&quot;: &quot;James Johnson&quot;, &quot;address&quot;: &quot;Studio 13n, Marshall extension, Boylehaven, G8T 2EA&quot;, &quot;email&quot;: &quot;simpsonarthur@example.com&quot;, &quot;phone_number&quot;: &quot;+44(0)9098790450&quot;}<br>Received message: {&quot;name&quot;: &quot;Mr Denis Bird&quot;, &quot;address&quot;: &quot;1 White ramp, New Kyleview, CB1 2SL&quot;, &quot;email&quot;: &quot;lydiabennett@example.net&quot;, &quot;phone_number&quot;: &quot;+44(0)113 496 0594&quot;}<br>Received message: {&quot;name&quot;: &quot;Dr Eric Summers&quot;, &quot;address&quot;: &quot;Studio 62, Reynolds light, Port Naomi, BB70 2GH&quot;, &quot;email&quot;: &quot;berryadam@example.com&quot;, &quot;phone_number&quot;: &quot;(0121)4960366&quot;}<br>Received message: {&quot;name&quot;: &quot;Dr Marc Jackson&quot;, &quot;address&quot;: &quot;Flat 23, Harris underpass, Wongton, AB4V 1AE&quot;, &quot;email&quot;: &quot;pearsonellie@example.net&quot;, &quot;phone_number&quot;: &quot;+44161 4960675&quot;}<br>Received message: {&quot;name&quot;: &quot;Stephanie Wells&quot;, &quot;address&quot;: &quot;Flat 46, Watkins turnpike, New Oliviafurt, M7 5TH&quot;, &quot;email&quot;: &quot;mohammad41@example.net&quot;, &quot;phone_number&quot;: &quot;(0113) 496 0149&quot;}<br>Received message: {&quot;name&quot;: &quot;Justin Bradley&quot;, &quot;address&quot;: &quot;Flat 88s, Naomi points, Freemanhaven, WD6 5GA&quot;, &quot;email&quot;: &quot;foxtina@example.org&quot;, &quot;phone_number&quot;: &quot;(0909)8790897&quot;}<br>Received message: {&quot;name&quot;: &quot;Lorraine Black&quot;, &quot;address&quot;: &quot;0 Leah pass, West Paige, G2B 5AF&quot;, &quot;email&quot;: &quot;rileylinda@example.org&quot;, &quot;phone_number&quot;: &quot;0117 496 0969&quot;}<br>Received message: {&quot;name&quot;: &quot;Donna Griffin-Brown&quot;, &quot;address&quot;: &quot;99 Shaun landing, Bradshawside, S4 5QQ&quot;, &quot;email&quot;: &quot;wrose@example.com&quot;, &quot;phone_number&quot;: &quot;(0113) 4960080&quot;}<br>Received message: {&quot;name&quot;: &quot;Jordan Benson&quot;, &quot;address&quot;: &quot;22 Little shores, Katherinetown, BD23 3AN&quot;, &quot;email&quot;: &quot;robertssian@example.com&quot;, &quot;phone_number&quot;: &quot;+44(0)141 4960789&quot;}<br>Received message: {&quot;name&quot;: &quot;Jemma Goddard&quot;, &quot;address&quot;: &quot;Studio 2, Pauline harbor, Evansside, WD2 2WX&quot;, &quot;email&quot;: &quot;collinsjacob@example.net&quot;, &quot;phone_number&quot;: &quot;+44191 4960331&quot;}<br>Received message: {&quot;name&quot;: &quot;Marc Patel-Reid&quot;, &quot;address&quot;: &quot;48 Hannah gateway, New Charles, HR7 9DY&quot;, &quot;email&quot;: &quot;jacobwood@example.org&quot;, &quot;phone_number&quot;: &quot;+44(0)9098790566&quot;}<br>Received message: {&quot;name&quot;: &quot;Mr Joel Rogers&quot;, &quot;address&quot;: &quot;01 Garner station, West Kellymouth, B4E 5BB&quot;, &quot;email&quot;: &quot;oliverbanks@example.com&quot;, &quot;phone_number&quot;: &quot;+44(0)115 4960677&quot;}<br>Received message: {&quot;name&quot;: &quot;Marian Wright-Wade&quot;, &quot;address&quot;: &quot;Studio 4, Jordan trail, Bradleymouth, CB0X 3RA&quot;, &quot;email&quot;: &quot;kjones@example.com&quot;, &quot;phone_number&quot;: &quot;(0161) 4960305&quot;}<br>Received message: {&quot;name&quot;: &quot;Maureen Fox&quot;, &quot;address&quot;: &quot;67 Scott wall, Bennettfurt, SE5 6FY&quot;, &quot;email&quot;: &quot;kbirch@example.com&quot;, &quot;phone_number&quot;: &quot;+44121 4960408&quot;}<br>Received message: {&quot;name&quot;: &quot;Miss Michelle Jones&quot;, &quot;address&quot;: &quot;Flat 04X, Abigail view, Port Chloeland, E86 7HE&quot;, &quot;email&quot;: &quot;birdchristopher@example.com&quot;, &quot;phone_number&quot;: &quot;+441134960950&quot;}<br>Received message: {&quot;name&quot;: &quot;Lindsey Wade&quot;, &quot;address&quot;: &quot;997 Aaron squares, Northfort, DT5E 6NB&quot;, &quot;email&quot;: &quot;rbell@example.com&quot;, &quot;phone_number&quot;: &quot;(0141) 496 0360&quot;}<br>Received message: {&quot;name&quot;: &quot;Kate Willis&quot;, &quot;address&quot;: &quot;54 Sullivan way, Batesstad, N40 9FN&quot;, &quot;email&quot;: &quot;patrick10@example.org&quot;, &quot;phone_number&quot;: &quot;(0121) 496 0869&quot;}<br>Received message: {&quot;name&quot;: &quot;Debra Jones-Shaw&quot;, &quot;address&quot;: &quot;746 Bray rest, Port Eileenchester, WC8 5XF&quot;, &quot;email&quot;: &quot;jeanwright@example.org&quot;, &quot;phone_number&quot;: &quot;(0306) 9990688&quot;}<br>Received message: {&quot;name&quot;: &quot;Danny Franklin&quot;, &quot;address&quot;: &quot;3 Keith viaduct, West Emily, E2 6LJ&quot;, &quot;email&quot;: &quot;sarahdixon@example.org&quot;, &quot;phone_number&quot;: &quot;+44(0)151 496 0856&quot;}<br>Received message: {&quot;name&quot;: &quot;Jasmine Curtis-Williams&quot;, &quot;address&quot;: &quot;560 Haynes prairie, New Mary, CB2P 8WP&quot;, &quot;email&quot;: &quot;grahammartin@example.com&quot;, &quot;phone_number&quot;: &quot;+4428 9018 0759&quot;}<br>Received message: {&quot;name&quot;: &quot;Olivia Jones-Robinson&quot;, &quot;address&quot;: &quot;Studio 40, Beverley crossroad, South Declanside, WR5 1GT&quot;, &quot;email&quot;: &quot;jamesjeremy@example.org&quot;, &quot;phone_number&quot;: &quot;+44808 157 0749&quot;}<br>Received message: {&quot;name&quot;: &quot;Joel Peacock&quot;, &quot;address&quot;: &quot;72 Pauline station, West Sophie, TQ74 7JQ&quot;, &quot;email&quot;: &quot;mohammadmccarthy@example.com&quot;, &quot;phone_number&quot;: &quot;(028) 9018 0383&quot;}<br>Received message: {&quot;name&quot;: &quot;Harriet Lees&quot;, &quot;address&quot;: &quot;2 Louis freeway, Shirleyview, G22 3GN&quot;, &quot;email&quot;: &quot;wilsonirene@example.org&quot;, &quot;phone_number&quot;: &quot;0808 1570756&quot;}<br>Received message: {&quot;name&quot;: &quot;Gemma Day&quot;, &quot;address&quot;: &quot;Studio 85x, Townsend bridge, New Max, RM38 9GG&quot;, &quot;email&quot;: &quot;woodsjoe@example.net&quot;, &quot;phone_number&quot;: &quot;01632960957&quot;}<br>Received message: {&quot;name&quot;: &quot;Leah Briggs-Barrett&quot;, &quot;address&quot;: &quot;Flat 87, Carroll brook, Martinberg, WC21 8YH&quot;, &quot;email&quot;: &quot;zoe55@example.net&quot;, &quot;phone_number&quot;: &quot;+4428 9018 0085&quot;}<br>Received message: {&quot;name&quot;: &quot;Mr Abdul Wood&quot;, &quot;address&quot;: &quot;45 Rice flats, Lewismouth, B90 6YP&quot;, &quot;email&quot;: &quot;lordnaomi@example.org&quot;, &quot;phone_number&quot;: &quot;+44116 4960734&quot;}<br>Received message: {&quot;name&quot;: &quot;Hilary Preston&quot;, &quot;address&quot;: &quot;Flat 24Q, Green islands, Paulville, M5 9RR&quot;, &quot;email&quot;: &quot;ryanhurst@example.net&quot;, &quot;phone_number&quot;: &quot;(0191)4960762&quot;}<br>Received message: {&quot;name&quot;: &quot;Dr Tina Foster&quot;, &quot;address&quot;: &quot;26 Graeme crescent, Parkerberg, S99 1YA&quot;, &quot;email&quot;: &quot;hartann@example.net&quot;, &quot;phone_number&quot;: &quot;(01632) 960 594&quot;}<br>Received message: {&quot;name&quot;: &quot;Katy Pearson&quot;, &quot;address&quot;: &quot;Studio 57, Burns points, East Ashleighchester, CH6 6WW&quot;, &quot;email&quot;: &quot;fordjasmine@example.net&quot;, &quot;phone_number&quot;: &quot;+44(0)808 1570978&quot;}<br>Received message: {&quot;name&quot;: &quot;Olivia Hart-Stevens&quot;, &quot;address&quot;: &quot;2 Williams points, North Lynntown, G4 7RN&quot;, &quot;email&quot;: &quot;marie11@example.net&quot;, &quot;phone_number&quot;: &quot;(028)9018947&quot;}<br>Received message: {&quot;name&quot;: &quot;Lorraine Pugh&quot;, &quot;address&quot;: &quot;136 Kirsty pines, New Callum, DH4 4FY&quot;, &quot;email&quot;: &quot;gardnermary@example.com&quot;, &quot;phone_number&quot;: &quot;(0191) 4960486&quot;}<br>Received message: {&quot;name&quot;: &quot;Dr Bradley Jones&quot;, &quot;address&quot;: &quot;Studio 48, Patel gateway, East Jasmine, NG2 4EH&quot;, &quot;email&quot;: &quot;wyattgordon@example.org&quot;, &quot;phone_number&quot;: &quot;+44(0)1614960491&quot;}<br>Received message: {&quot;name&quot;: &quot;Trevor Potter&quot;, &quot;address&quot;: &quot;Flat 76, Hill isle, East Caroleton, SS6 2YQ&quot;, &quot;email&quot;: &quot;richard68@example.org&quot;, &quot;phone_number&quot;: &quot;01514960349&quot;}<br>Received message: {&quot;name&quot;: &quot;Craig Lloyd&quot;, &quot;address&quot;: &quot;Studio 77t, Rhys parkway, Gardnermouth, NG8 4FE&quot;, &quot;email&quot;: &quot;kemprachel@example.net&quot;, &quot;phone_number&quot;: &quot;+44(0)131 4960141&quot;}<br>Received message: {&quot;name&quot;: &quot;Dr Lauren Morgan&quot;, &quot;address&quot;: &quot;689 Davies cliffs, South Megan, M3 5QB&quot;, &quot;email&quot;: &quot;russellglen@example.net&quot;, &quot;phone_number&quot;: &quot;+44(0)29 2018 0102&quot;}<br>Received message: {&quot;name&quot;: &quot;Jane Howard&quot;, &quot;address&quot;: &quot;Flat 3, Davies land, Littlefort, IG2R 0GW&quot;, &quot;email&quot;: &quot;leonard16@example.org&quot;, &quot;phone_number&quot;: &quot;08081570110&quot;}<br>Received message: {&quot;name&quot;: &quot;Mr Sean Bradley&quot;, &quot;address&quot;: &quot;204 Carl via, Stevensonside, SS3H 4EL&quot;, &quot;email&quot;: &quot;georgiajohnson@example.org&quot;, &quot;phone_number&quot;: &quot;+44(0)3069990204&quot;}<br>Received message: {&quot;name&quot;: &quot;Mr Peter Rowley&quot;, &quot;address&quot;: &quot;Studio 5, Williams roads, Port Elizabeth, M8C 1UL&quot;, &quot;email&quot;: &quot;liam22@example.org&quot;, &quot;phone_number&quot;: &quot;+44(0)141 4960055&quot;}<br>Received message: {&quot;name&quot;: &quot;Brian Harris&quot;, &quot;address&quot;: &quot;Studio 8, Hooper junctions, North Paulborough, G8J 7XT&quot;, &quot;email&quot;: &quot;xrees@example.net&quot;, &quot;phone_number&quot;: &quot;+44115 496 0248&quot;}<br>Received message: {&quot;name&quot;: &quot;Justin Bailey-Gill&quot;, &quot;address&quot;: &quot;1 Rachel burg, New Ashleighport, DN9 1WU&quot;, &quot;email&quot;: &quot;pollardian@example.com&quot;, &quot;phone_number&quot;: &quot;(0118)4960744&quot;}<br>Received message: {&quot;name&quot;: &quot;Amelia Butler&quot;, &quot;address&quot;: &quot;Flat 4, Jones trace, Robertsshire, S79 1YB&quot;, &quot;email&quot;: &quot;billyarcher@example.net&quot;, &quot;phone_number&quot;: &quot;0115 496 0145&quot;}<br>Received message: {&quot;name&quot;: &quot;Mr Damian Smith&quot;, &quot;address&quot;: &quot;817 Bird glens, East Rosie, DG2H 6RA&quot;, &quot;email&quot;: &quot;llewis@example.org&quot;, &quot;phone_number&quot;: &quot;+44117 496 0930&quot;}<br>Received message: {&quot;name&quot;: &quot;Michael Moore&quot;, &quot;address&quot;: &quot;49 Atkinson oval, Colinville, M8C 5SU&quot;, &quot;email&quot;: &quot;barry88@example.com&quot;, &quot;phone_number&quot;: &quot;+44(0)29 2018558&quot;}<br>Received message: {&quot;name&quot;: &quot;Dr Catherine Tomlinson&quot;, &quot;address&quot;: &quot;Studio 12U, Tomlinson summit, Annland, E42 6BA&quot;, &quot;email&quot;: &quot;thomasmartin@example.net&quot;, &quot;phone_number&quot;: &quot;(0113) 4960535&quot;}<br>Received message: {&quot;name&quot;: &quot;Hayley Booth&quot;, &quot;address&quot;: &quot;Flat 37, Teresa river, Campbellland, PE4 8UQ&quot;, &quot;email&quot;: &quot;holmesjade@example.org&quot;, &quot;phone_number&quot;: &quot;+44(0)1632 960 061&quot;}<br>Received message: {&quot;name&quot;: &quot;Pauline Wilkinson&quot;, &quot;address&quot;: &quot;Studio 3, Kent cliffs, East Nathan, CO84 3SB&quot;, &quot;email&quot;: &quot;ybarber@example.org&quot;, &quot;phone_number&quot;: &quot;(0306) 9990010&quot;}<br>Received message: {&quot;name&quot;: &quot;Dr Glenn Payne&quot;, &quot;address&quot;: &quot;67 Paul underpass, South Brett, B9D 9QG&quot;, &quot;email&quot;: &quot;morrisonrosemary@example.org&quot;, &quot;phone_number&quot;: &quot;+441134960939&quot;}<br>Received message: {&quot;name&quot;: &quot;Victor Carr&quot;, &quot;address&quot;: &quot;8 Sheila shoal, Port Rickyborough, L4T 6JD&quot;, &quot;email&quot;: &quot;josephinecox@example.com&quot;, &quot;phone_number&quot;: &quot;01174960475&quot;}<br>Received message: {&quot;name&quot;: &quot;Mrs Carolyn Miah&quot;, &quot;address&quot;: &quot;Flat 56, Simon passage, East Peterstad, E2D 1AG&quot;, &quot;email&quot;: &quot;tony95@example.com&quot;, &quot;phone_number&quot;: &quot;+44306 9990068&quot;}<br>Received message: {&quot;name&quot;: &quot;Dr Brenda Smith&quot;, &quot;address&quot;: &quot;8 Maureen drive, Lake Roy, E3 3ZS&quot;, &quot;email&quot;: &quot;matthewmitchell@example.org&quot;, &quot;phone_number&quot;: &quot;(0151)4960707&quot;}<br>Received message: {&quot;name&quot;: &quot;Elaine Miller&quot;, &quot;address&quot;: &quot;302 James summit, Shaunstad, SM33 2FN&quot;, &quot;email&quot;: &quot;clementsaimee@example.com&quot;, &quot;phone_number&quot;: &quot;+44(0)1174960527&quot;}<br>Received message: {&quot;name&quot;: &quot;Claire May&quot;, &quot;address&quot;: &quot;4 Kim haven, East Geraldmouth, S90 4FE&quot;, &quot;email&quot;: &quot;dominic54@example.com&quot;, &quot;phone_number&quot;: &quot;+441632960869&quot;}<br>Received message: {&quot;name&quot;: &quot;Lawrence Kennedy&quot;, &quot;address&quot;: &quot;804 Beverley meadows, Lake Bethan, LN30 0RX&quot;, &quot;email&quot;: &quot;kerralexander@example.com&quot;, &quot;phone_number&quot;: &quot;029 2018502&quot;}<br>Received message: {&quot;name&quot;: &quot;Martin Crawford&quot;, &quot;address&quot;: &quot;Studio 0, Margaret neck, Brownborough, HU1 1AN&quot;, &quot;email&quot;: &quot;grahamroberts@example.com&quot;, &quot;phone_number&quot;: &quot;(0121) 496 0273&quot;}<br>Received message: {&quot;name&quot;: &quot;Thomas Morris&quot;, &quot;address&quot;: &quot;28 Newton cliffs, Russellville, TS8E 3BT&quot;, &quot;email&quot;: &quot;leanne03@example.net&quot;, &quot;phone_number&quot;: &quot;+44113 496 0760&quot;}<br>Received message: {&quot;name&quot;: &quot;Dr Mitchell Gordon&quot;, &quot;address&quot;: &quot;0 Dean stream, Harveyshire, GL55 0TU&quot;, &quot;email&quot;: &quot;mollymills@example.org&quot;, &quot;phone_number&quot;: &quot;+44(0)20 7496 0348&quot;}<br>Received message: {&quot;name&quot;: &quot;Alice Stevenson&quot;, &quot;address&quot;: &quot;0 Gray creek, Port Francisshire, CR7 4HL&quot;, &quot;email&quot;: &quot;aimeebarnes@example.org&quot;, &quot;phone_number&quot;: &quot;0808 1570769&quot;}<br>Received message: {&quot;name&quot;: &quot;Clare Robinson&quot;, &quot;address&quot;: &quot;4 Kirsty trail, Thompsonstad, M18 0QT&quot;, &quot;email&quot;: &quot;mhutchinson@example.com&quot;, &quot;phone_number&quot;: &quot;(0114) 4960178&quot;}<br>Received message: {&quot;name&quot;: &quot;Jill Hayes&quot;, &quot;address&quot;: &quot;Studio 1, Holmes fort, Port Ryan, DE91 8JN&quot;, &quot;email&quot;: &quot;waynesmith@example.com&quot;, &quot;phone_number&quot;: &quot;(028) 9018 0524&quot;}<br>Received message: {&quot;name&quot;: &quot;Gail Stephens&quot;, &quot;address&quot;: &quot;Flat 1, Nicholls passage, Port Maureen, WS6 7AG&quot;, &quot;email&quot;: &quot;jonestina@example.org&quot;, &quot;phone_number&quot;: &quot;0131 496 0895&quot;}<br>Received message: {&quot;name&quot;: &quot;Mr Maurice Barker&quot;, &quot;address&quot;: &quot;Flat 63z, Beth springs, Harrismouth, B2 0FL&quot;, &quot;email&quot;: &quot;fabbott@example.com&quot;, &quot;phone_number&quot;: &quot;+44113 496 0549&quot;}<br>Received message: {&quot;name&quot;: &quot;Alexandra Porter&quot;, &quot;address&quot;: &quot;24 Jasmine throughway, Port Davidmouth, TN5M 3ZU&quot;, &quot;email&quot;: &quot;jasmine18@example.org&quot;, &quot;phone_number&quot;: &quot;+44(0)131 496 0102&quot;}<br>Received message: {&quot;name&quot;: &quot;Mr Toby Campbell&quot;, &quot;address&quot;: &quot;Studio 54, Ford path, North Brianhaven, EC5 5LY&quot;, &quot;email&quot;: &quot;pgreen@example.com&quot;, &quot;phone_number&quot;: &quot;(028)9018116&quot;}<br>Received message: {&quot;name&quot;: &quot;Kevin Morris&quot;, &quot;address&quot;: &quot;Studio 32N, Eric course, Daviesview, LA3 3GF&quot;, &quot;email&quot;: &quot;stuartroberts@example.com&quot;, &quot;phone_number&quot;: &quot;+44118 496 0883&quot;}<br>Received message: {&quot;name&quot;: &quot;Jacqueline Clayton&quot;, &quot;address&quot;: &quot;Studio 19z, Nicole locks, Lake Joshbury, ML5 6FW&quot;, &quot;email&quot;: &quot;hwest@example.net&quot;, &quot;phone_number&quot;: &quot;01164960991&quot;}<br>Received message: {&quot;name&quot;: &quot;Louise Williams-Johnson&quot;, &quot;address&quot;: &quot;Flat 7, Mitchell point, West Liam, E5A 8UJ&quot;, &quot;email&quot;: &quot;blakemaureen@example.net&quot;, &quot;phone_number&quot;: &quot;+44808 157 0780&quot;}<br>Received message: {&quot;name&quot;: &quot;Debra Goodwin&quot;, &quot;address&quot;: &quot;Studio 9, Georgia lake, Port Douglas, GL3 8BJ&quot;, &quot;email&quot;: &quot;joyce91@example.com&quot;, &quot;phone_number&quot;: &quot;+441134960004&quot;}<br>Received message: {&quot;name&quot;: &quot;Andrea Spencer-Turner&quot;, &quot;address&quot;: &quot;Flat 75v, Archer lock, New Antonyfurt, S5 9PA&quot;, &quot;email&quot;: &quot;millsmalcolm@example.org&quot;, &quot;phone_number&quot;: &quot;+441414960454&quot;}<br>Received message: {&quot;name&quot;: &quot;Paula Macdonald&quot;, &quot;address&quot;: &quot;Flat 71, Julia causeway, New Joyceburgh, B2A 4FA&quot;, &quot;email&quot;: &quot;robinsonkatie@example.com&quot;, &quot;phone_number&quot;: &quot;+44(0)116 496 0139&quot;}<br>Received message: {&quot;name&quot;: &quot;Dr Allan Kirk&quot;, &quot;address&quot;: &quot;7 Terence mills, Port Nicoleville, S0W 3UA&quot;, &quot;email&quot;: &quot;charlotte53@example.com&quot;, &quot;phone_number&quot;: &quot;+441154960354&quot;}<br>Received message: {&quot;name&quot;: &quot;Dr Katy Chadwick&quot;, &quot;address&quot;: &quot;01 Tina mountain, West Rachelshire, GU5B 6BR&quot;, &quot;email&quot;: &quot;jjohnson@example.com&quot;, &quot;phone_number&quot;: &quot;(0121) 496 0690&quot;}<br>Received message: {&quot;name&quot;: &quot;Harry Lane-Wilson&quot;, &quot;address&quot;: &quot;Flat 3, Miah locks, Raymondmouth, N51 4WT&quot;, &quot;email&quot;: &quot;wrightglenn@example.com&quot;, &quot;phone_number&quot;: &quot;+44(0)117 496 0763&quot;}<br>Received message: {&quot;name&quot;: &quot;Anthony Foster&quot;, &quot;address&quot;: &quot;Flat 64, Thomas summit, Edwardsberg, WN59 4SH&quot;, &quot;email&quot;: &quot;rhysevans@example.net&quot;, &quot;phone_number&quot;: &quot;0306 9990571&quot;}<br>Received message: {&quot;name&quot;: &quot;Sarah Rose&quot;, &quot;address&quot;: &quot;73 Ali gardens, Port Jason, UB4 6SW&quot;, &quot;email&quot;: &quot;ogibson@example.com&quot;, &quot;phone_number&quot;: &quot;+44121 496 0820&quot;}<br>Received message: {&quot;name&quot;: &quot;Katherine Brooks&quot;, &quot;address&quot;: &quot;Studio 2, Emily hollow, Matthewport, M7 5LJ&quot;, &quot;email&quot;: &quot;kyleharris@example.net&quot;, &quot;phone_number&quot;: &quot;+44117 4960494&quot;}<br>Received message: {&quot;name&quot;: &quot;Thomas Williams-Allan&quot;, &quot;address&quot;: &quot;819 Osborne ferry, Daviesbury, E88 0LY&quot;, &quot;email&quot;: &quot;howellssophie@example.net&quot;, &quot;phone_number&quot;: &quot;+44115 496 0443&quot;}<br>Received message: {&quot;name&quot;: &quot;Charles Bowen-Fleming&quot;, &quot;address&quot;: &quot;Flat 90, Lees villages, North Justinstad, S74 2WU&quot;, &quot;email&quot;: &quot;kate52@example.org&quot;, &quot;phone_number&quot;: &quot;+44(0)29 2018 0456&quot;}<br>Received message: {&quot;name&quot;: &quot;Miss Stephanie Wilkins&quot;, &quot;address&quot;: &quot;Flat 68, Wright plain, Daviesstad, N5 5WH&quot;, &quot;email&quot;: &quot;smithmarion@example.com&quot;, &quot;phone_number&quot;: &quot;+44(0)1144960498&quot;}<br>Received message: {&quot;name&quot;: &quot;Kate Ahmed&quot;, &quot;address&quot;: &quot;935 Cameron unions, New Martinburgh, CT3 0XD&quot;, &quot;email&quot;: &quot;rita10@example.net&quot;, &quot;phone_number&quot;: &quot;(0161)4960666&quot;}<br>Received message: {&quot;name&quot;: &quot;Amelia Fletcher&quot;, &quot;address&quot;: &quot;Studio 22, Robert springs, West Stanley, B8 9FU&quot;, &quot;email&quot;: &quot;lmorgan@example.com&quot;, &quot;phone_number&quot;: &quot;+44(0)3069990659&quot;}<br>Received message: {&quot;name&quot;: &quot;Terry Charlton-Elliott&quot;, &quot;address&quot;: &quot;925 Shannon turnpike, East Geraldinemouth, M1 7QU&quot;, &quot;email&quot;: &quot;carpenterpaige@example.com&quot;, &quot;phone_number&quot;: &quot;+44117 496 0631&quot;}<br>Received message: {&quot;name&quot;: &quot;Georgina Carr&quot;, &quot;address&quot;: &quot;66 Gerard lake, Lloydville, AB75 5BN&quot;, &quot;email&quot;: &quot;fperry@example.com&quot;, &quot;phone_number&quot;: &quot;+44(0)118 4960441&quot;}<br>Received message: {&quot;name&quot;: &quot;Lee Sullivan&quot;, &quot;address&quot;: &quot;56 Potts row, Williamsburgh, IV1 0EX&quot;, &quot;email&quot;: &quot;pritchardcarole@example.net&quot;, &quot;phone_number&quot;: &quot;0116 4960318&quot;}<br>Received message: {&quot;name&quot;: &quot;Sam Banks-Perry&quot;, &quot;address&quot;: &quot;07 Gordon mill, West Hugh, E8 9LA&quot;, &quot;email&quot;: &quot;marian51@example.org&quot;, &quot;phone_number&quot;: &quot;09098790367&quot;}<br>Received message: {&quot;name&quot;: &quot;Dr Rebecca Edwards&quot;, &quot;address&quot;: &quot;49 Roy port, Jonesfort, CA49 3BL&quot;, &quot;email&quot;: &quot;geraldine48@example.net&quot;, &quot;phone_number&quot;: &quot;(0191)4960227&quot;}<br>Received message: {&quot;name&quot;: &quot;Rachel Cooper&quot;, &quot;address&quot;: &quot;Studio 74, Kelly lakes, Kirstychester, W2 2LT&quot;, &quot;email&quot;: &quot;uatkinson@example.org&quot;, &quot;phone_number&quot;: &quot;(0161) 496 0812&quot;}<br>Received message: {&quot;name&quot;: &quot;Norman Mahmood&quot;, &quot;address&quot;: &quot;Flat 01b, Megan drive, North Ericbury, KW6 0YY&quot;, &quot;email&quot;: &quot;tfraser@example.org&quot;, &quot;phone_number&quot;: &quot;+44(0)121 496 0029&quot;}<br>Received message: {&quot;name&quot;: &quot;Gerard Porter&quot;, &quot;address&quot;: &quot;871 Jade fall, Jamestown, B1H 1JR&quot;, &quot;email&quot;: &quot;grace54@example.net&quot;, &quot;phone_number&quot;: &quot;+44909 879 0960&quot;}<br>Received message: {&quot;name&quot;: &quot;Antony Reynolds&quot;, &quot;address&quot;: &quot;4 Martin fords, New Adam, S5 8QT&quot;, &quot;email&quot;: &quot;carolineholmes@example.org&quot;, &quot;phone_number&quot;: &quot;0114 4960791&quot;}<br>Received message: {&quot;name&quot;: &quot;Elizabeth Williams&quot;, &quot;address&quot;: &quot;Flat 26K, Vincent viaduct, Jennifermouth, L93 4BU&quot;, &quot;email&quot;: &quot;evansduncan@example.org&quot;, &quot;phone_number&quot;: &quot;(0115) 4960580&quot;}<br>Received message: {&quot;name&quot;: &quot;Frank Collier&quot;, &quot;address&quot;: &quot;Flat 49i, Lee squares, Lake Teresa, NE65 5JR&quot;, &quot;email&quot;: &quot;dannymorgan@example.org&quot;, &quot;phone_number&quot;: &quot;+441134960284&quot;}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12d3c15b4379" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Databricks — A Simple Example of Data Profiling]]></title>
            <link>https://medium.com/@james.m.dey/databricks-a-simple-example-of-data-profiling-6e8806afd480?source=rss-b18e8195bd0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e8806afd480</guid>
            <dc:creator><![CDATA[James Dey]]></dc:creator>
            <pubDate>Mon, 23 Oct 2023 08:23:11 GMT</pubDate>
            <atom:updated>2023-10-23T08:27:43.264Z</atom:updated>
            <content:encoded><![CDATA[<h3>Databricks — A Simple Example of Data Profiling</h3><p>1 of the first tasks when undertaking a new data architecture project is to profile the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/0*iWRlmA_ftdyDiG21.jpg" /></figure><h3>What is Data profiling?</h3><p>Data profiling is a way of getting to know your data better. It helps you understand what kind of data you have, how it is structured, what it contains, and how good its quality is. Data profiling can help you make better decisions based on your data, such as how to use it, clean it, or integrate it with other data sources.o illustrate data profiling with some simple examples, let’s imagine you have a spreadsheet with some information about different fruits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*GBIYT54hKp20Go3scZI8RA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*IajlhtTayFlLdv-h_1o1DA.png" /></figure><p>Here are some questions you might ask to profile your data:</p><h4>What are the columns and rows in the spreadsheet?</h4><p>This will tell you the basic structure of your data and how many records you have. For example, you might have columns for fruit name, colour, weight, and price, and rows for each fruit entry.</p><h4>How many Null values exist for a particular column?</h4><p>This tells you how complete the data entry has been for particular columns. It is, of course, not the case that every column in every row of every table should be filled out, but this at least gives you a handle on which columns are particularly incomplete. Coupled with knowledge of the importance of that column to the business, you can then target where fixes to the data entry screens/training at source are required.</p><h4>What are the data types of each column?</h4><p>This will tell you what kind of values you can expect in each column and how to handle them. For example, fruit name might be a text column, colour might be a categorical column with a limited set of values (such as red, green, yellow), weight might be a numerical column with decimal values (such as 0.5 kg), and price might be a currency column with a specific format (such as £1.99).</p><h4>What are the descriptive statistics of each column?</h4><p>This will tell you some summary information about each column, such as the minimum, maximum, average, median, and standard deviation. For example, you might find out that the minimum weight of a fruit is 0.1 kg, the maximum weight is 2 kg, the average weight is 0.8 kg, the median weight is 0.7 kg, and the standard deviation is 0.3 kg.</p><h4>What are the frequency distributions of each column?</h4><p>This will tell you how often each value occurs in each column and how diverse or skewed your data is. For example, you might find out that the most common fruit name is apple, the most common colour is green, the most common weight range is 0.5–1 kg, and the most common price range is £1–2.</p><h4>What are the relationships between columns?</h4><p>This will tell you how different columns are related to each other and if there are any dependencies or correlations. For example, you might find out that fruit name and colour are dependent on each other (such as apples are usually red or green), weight and price are correlated (such as heavier fruits tend to be more expensive), or colour and price are independent of each other (such as there is no clear pattern between colour and price).</p><h3>A Simple Data Profiling Example For Databricks</h3><p>This code pulls out the tables and columns from a specified Databricks schema, and counts up the nulls and total row counts for each column in each table:-</p><pre># Import the spark session<br>from pyspark.sql import SparkSession<br>from pyspark.sql.functions import col, lit<br># Create or get the spark session<br>spark = SparkSession.builder.getOrCreate()<br><br>#Add the schema that you want to profile here<br>schema = &quot;&quot;<br><br># Query the databricks schema and get the table names from the eptb schema<br>tables = spark.sql(f&quot;SHOW TABLES in {schema}&quot;).select(&quot;tableName&quot;).collect()<br><br># Iterate over the tables<br>for table in tables:<br><br># Read the table into a dataframe<br>df = spark.table(schema+&quot;.&quot;+table.tableName)<br><br># Print the table name<br>print(f&quot;Table: {table.tableName}&quot;)<br><br># Count the number of rows that have null values for each column<br>for column in df.columns:<br>null_count = df.filter(col(column).isNull()).count()<br>print(f&quot;Number of null values in {column}: {null_count}&quot;)<br><br># Count the total number of rows<br>total_count = df.count()<br>print(f&quot;Total number of rows: {total_count}&quot;)<br><br># Print a separator line<br>print(&quot;-&quot; * 20)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e8806afd480" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>