<?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 Jan Vanbuel on Medium]]></title>
        <description><![CDATA[Stories by Jan Vanbuel on Medium]]></description>
        <link>https://medium.com/@jan.vanbuel?source=rss-9224abecf903------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*skGT6PrqJD5Zbywz</url>
            <title>Stories by Jan Vanbuel on Medium</title>
            <link>https://medium.com/@jan.vanbuel?source=rss-9224abecf903------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 12:03:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jan.vanbuel/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[Terra-Do’s and Terra-Don’ts — a few common issues with Terraform iterables and how to avoid them]]></title>
            <link>https://medium.com/datamindedbe/terra-dos-and-terra-don-ts-a-few-common-issues-with-terraform-iterables-and-how-to-avoid-them-249e4665dad1?source=rss-9224abecf903------2</link>
            <guid isPermaLink="false">https://medium.com/p/249e4665dad1</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[data-minded]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <dc:creator><![CDATA[Jan Vanbuel]]></dc:creator>
            <pubDate>Tue, 28 Nov 2023 12:22:59 GMT</pubDate>
            <atom:updated>2023-11-28T12:24:07.009Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Terra-Do’s and Terra-Don’ts — a few common issues with Terraform iterables and how to avoid them</strong></h3><p>Improper iteration over resources, data sources and modules is one of the most common issues I observe when teaching Terraform. In the remainder of the article, I will refer to these objects as Terraform’s <em>configuration iterables, </em>or <em>iterables</em> in short.</p><p>In particular, most of the struggles are related to:</p><ol><li>the usage of count vs. for_each</li><li>conditional iterable creation</li><li>passing information between Terraform iterables</li><li>module design</li></ol><p>Fixing these issues usually requires you to refactor your code, which, depending on the size of your codebase, can be quite tedious. In this article, I will briefly describe the core issue at hand with a few simple examples, and offer some recommendations on how to avoid them.</p><figure><img alt="A collection of rocket iterables ready to Terraform distant planets" src="https://cdn-images-1.medium.com/max/1024/1*RnOPBlinHbVJ00pVSyDg9g.png" /><figcaption>A collection of rockets ready to terraform distant planets.</figcaption></figure><h3>Usage of count vs. for_each</h3><p>There has already been written quite some words on the subject of count vs. for_each, and also the official Terraform documentation has a dedicated section to the usage of both meta-arguments. The gist of it: count was introduced before for_each, and is conceptually simpler, but that simplicity comes at a cost. Consider the following piece of code, in which an aws_s3_bucket for a list of users is configured:</p><pre>locals {<br> users = [&quot;Alice&quot;, &quot;Bob&quot;, &quot;Charlie&quot;]<br>}<br><br>### Iterate with count<br>resource &quot;aws_s3_bucket&quot; &quot;user_bucket&quot; {<br> count = length(local.users)<br> bucket = &quot;working-bucket-${local.users[count.index]}&quot;<br>}<br><br>### Iterate with for_each<br>resource &quot;aws_s3_bucket&quot; &quot;user_bucket&quot; {<br> for_each = toset(local.users)<br> bucket = &quot;working-bucket-${each.key}&quot;<br>}</pre><p>Both examples look simple enough, but what happens when you swap Alice and Bob in the users list? In the first example, Terraform identifies each configuration by the index of the count object during the iteration. Terraform creates internally a mapping between that index and the configuration (which I’ve simplified in the following snippet as just the bucket name argument) associated with that index:</p><pre>aws_s3_bucket.user_bucket[0] =&gt; &quot;working-bucket-${local.users[0]}&quot; // Alice<br>aws_s3_bucket.user_bucket[1] =&gt; &quot;working-bucket-${local.users[1]}&quot; // Bob<br>aws_s3_bucket.user_bucket[2] =&gt; &quot;working-bucket-${local.users[2]}&quot; // Charlie</pre><p>If you change the ordering of the users in the list, the intent is still the same: you still expect to have three buckets for your three users. Terraform, however, sees that the bucket name associated with some or all of the indices has changed. And changing a bucket name triggers a recreate: it will delete the old bucket, and create a new one. Luckily the AWS provider has additional protection built in for some of the resources for which there is a risk of data loss, but not all providers are equally protective (looking at you, Azure).</p><p>In the for_each example, the identifier that Terraform uses is also used to configure the resource:</p><pre>aws_s3_bucket.user_bucket[&quot;Alice&quot;] =&gt; &quot;working-bucket-${each.key}&quot; // Alice<br>aws_s3_bucket.user_bucket[&quot;Bob&quot;] =&gt; &quot;working-bucket-${each.key}&quot; // Bob<br>aws_s3_bucket.user_bucket[&quot;Charlie&quot;] =&gt; &quot;working-bucket-${each.key}&quot; // Charlie</pre><p>You can permute the user list all we want, the configuration attributes are tightly linked to the identifier of the configuration, the user name. Terraform is therefore unaware of any changes to the configuration, and does exactly what you expect it to do: nothing.</p><p>As a rule of thumb: use for_each by default, and count if and only if the resource doesn’t have any specific configuration; the usage of count.index to index a list is often a code smell, and you should probably use for_each instead.</p><h3>All or nothing: conditional creation of iterables</h3><p>The one exception to this rule of thumb that I usually teach, is when there should be exactly one instance a resource, or it shouldn’t exist at all:</p><pre>variable &quot;requires_x&quot; {<br> type = bool<br> default = false<br>}<br><br>resource &quot;X&quot; &quot;Y&quot; {<br> count = var.requires_x? 1 : 0<br>}</pre><p>Terraform&#39;s ternary operator for conditional expressions evaluates to 1 when the variable requires_x evaluates to true and to 0 when it evaluates to false. And when the count equals zero, nothing is created. Simple. Quite elegant.</p><p>You could also write the same logic with for_each as</p><pre>variable &quot;requires_x&quot; {<br> type = bool<br> default = false<br>}<br><br>resource &quot;X&quot; &quot;Y&quot; {<br> for_each = var.requires_x? toset([&quot;✅&quot;]): null<br>}</pre><p>but I think few people would agree that this is better than the first example. The key is arbitrary (any utf-8 string will do), and you need the to_set function call, as set literals are not part of the language.</p><p>Still, the usage of count suffers from a similar drawback as described in the first section: what if there are additional configurable arguments in the configuration that you want to offer as a variable to the consumers of a module? Naïvely, you could pass those as additional input variables:</p><pre>variable &quot;requires_x&quot; {<br> type = bool<br> default = false<br>}<br><br>variable &quot;x_attributes&quot; {<br> type = object({u = …, v = …, w = …})<br> …<br>}<br><br>resource &quot;X&quot; &quot;Y&quot; {<br> count = var.requires_x? 1 : 0<br> u = var.x_attributes.u<br> v = var.x_attributes.v<br> w = var.x_attribute.w<br>}</pre><p>It would work, sure, but it becomes quite cumbersome and needlessly complex for a larger number of configurable arguments.</p><p>Also, it violates another best practice: packaging related information together. Doing so will allow you to constrain information so that users of your module are less likely “to hold it wrong”. For example: users shouldn’t be able to pass the x_attributes variable when requires_x is false; the next snippet, which tries to validate a variable based on another variable, however, is <a href="https://github.com/hashicorp/terraform/issues/25609">not supported by the language</a>:</p><pre>variable &quot;requires_x&quot; {<br> type = bool<br> default = false<br>}<br><br>variable &quot;x_attributes&quot; {<br> default = null<br><br> validation {<br>   condition = (!var.requires_x) &amp;&amp; (var.x_attributes != null)<br>   error_message = &quot;Attributes should not be configured when x is not required.&quot;<br> }<br><br>}<br>resource &quot;X&quot; &quot;Y&quot; {<br> count = var.requires_x? 1 : 0<br> z = var.x_attribute_z<br>}</pre><p>A better solution would be to ditch the conditional altogether, and use a map or object variable (or a set variable, but in the second part of the article you&#39;ll see why that also potentially has some issues), which can provide more information than just a boolean flag:</p><pre>variable &quot;x&quot; {<br> default = {}<br> type = object({config=object({z=string})})<br>}<br><br>resource &quot;X&quot; &quot;Y&quot; {<br> for_each = var.x<br> z = each.value.z<br>}</pre><p>The variable x is constrained to be an object instead of a map to ensure that the module user provides exactly one configuration via the config attribute. Any other keys passed to the input variable x will be ignored. With a map type, Terraform would iterate over all keys of the map, which is useful when you have an arbitrary number N of configurations, but not when you want to limit them to 0 or <em>exactly</em> N configs (in this case N=1, but note that you can easily generalize this for any fixed N). Alternatively, you could also allow the user to pass a map as input, and add a validation to ensure there exactly N configurations. This has the advantage that the user is notified when they are trying to use the module incorrectly.</p><h3>Passing information between iterables</h3><p>Another common scenario is an iterable which has (calculated) attributes that need to be passed to another iterable, either directly within the same module, or indirectly, through input variables of a submodule.</p><p>Let’s upgrade the first example a bit. AWS uses a global namespace for S3 bucket names, so each bucket needs to have a unique name. You can avoid name collisions by adding a random string to the bucket name, as follows:</p><pre>locals {<br> users = toset([&quot;Alice&quot;, &quot;Bob&quot;, &quot;Charlie&quot;])<br>}<br>resource &quot;random_string&quot; &quot;random&quot; {<br> for_each = local.users<br> length = 8<br> special = false<br> upper = false<br>}<br><br>resource &quot;aws_s3_bucket&quot; &quot;user_bucket&quot; {<br> for_each = random_string.random<br> bucket = &quot;user-bucket-${each.value.id}&quot;<br>}</pre><p>Another way you might try to achieve the same result, is by iterating directly over the calculated ids of the random_string resource:</p><pre>locals {<br> users = toset([&quot;Alice&quot;, &quot;Bob&quot;, &quot;Charlie&quot;])<br>}<br>resource &quot;random_string&quot; &quot;random&quot; {<br> for_each = local.users<br> length = 8<br> special = false<br> upper = false<br>}<br>resource &quot;aws_s3_bucket&quot; &quot;user_bucket&quot; {<br> for_each = toset([for random_string in random_string.random : random_string.id])<br> bucket = &quot;user-bucket-${each.key}&quot;<br>}</pre><p>When trying to apply this second example, however, you’ll get an error:</p><pre>│ Error: Invalid for_each argument<br>│ <br>│ on main.tf line 13, in resource &quot;aws_s3_bucket&quot; &quot;user_bucket&quot;:<br>│ 13: for_each = toset([for random_string in random_string.random : random_string.id])<br>│ ├────────────────<br>│ │ random_string.random is object with 3 attributes<br>│ <br>│ The &quot;for_each&quot; set includes values derived from resource attributes that cannot be determined until apply, and so Terraform cannot determine the full set of keys that will identify the instances of<br>│ this resource.<br>│ <br>│ When working with unknown values in for_each, it&#39;s better to use a map value where the keys are defined statically in your configuration and where only the values contain apply-time results.<br>│ <br>│ Alternatively, you could use the -target planning option to first apply only the resources that the for_each value depends on, and then apply a second time to fully converge.</pre><p>As suggested by the error message, after a targeted apply on the random_stringresource, the code snippet will work.</p><p>Yet, if you destroy everything and recreate it from scratch, you run into the same issue: Terraform does not know what keys to use to uniquely identify the buckets. In addition, if you do a targeted apply, and then something changes to the targeted configuration, you have to do another targeted apply, until Terraform has assured that the keys in the state are not going to change.</p><p>Targeting is discouraged by Terraform, as it can cause your infrastructure to become inconsistent. Using terraform apply -target routinely is a sign that the dependencies between your resources are based on calculated values, or that your state is becoming too large.</p><p>Note that Terraform gives you a recommendation on how to avoid this error: “use a map value where the keys are defined statically in your configuration and where only the values contain apply-time results.”</p><h3>Proper module design: designing modules for change</h3><p>I admit, the previous code snippet probably feels like a contrived example; not many people would write the second code block if tasked with creating a variable number of uniquely named s3 buckets from scratch.</p><p>What often happens, however, is that you introduce these sorts of dependencies as your Terraform codebase grows organically, <em>without your being aware of it</em>. If the calculated value is the only configuration you need to pass to the iterable, why add more information than needed?</p><p>Iteration over calculated values can in principle be present anywhere in your codebase; the most common place I see this mistake rearing its ugly head in practice is where calculated values are passed across a module boundary, via the module&#39;s input variables.</p><p>As a module author, you should 1) be careful not to assume too much about how your users will use the module, and 2) as mentioned above, make it difficult for users to misconfigure the module by adding constraints (via the HCL type system or validations). Always consider the possibility that a set of values you iterate over could be calculated attributes. Even if you know that current usage of your module is limited to statically configured input variables, that might not always be the case in the future.</p><p>Let&#39;s rewrite the example, assuming you want to package the code that creates the buckets as a module:</p><pre>locals {<br> users = toset([&quot;Alice&quot;, &quot;Bob&quot;, &quot;Charlie&quot;])<br>}<br><br>resource &quot;random_string&quot; &quot;random&quot; {<br> for_each = local.users<br> length = 8<br> special = false<br> upper = false<br>}<br><br>module &quot;user_buckets&quot; {<br>  source = &quot;./user_buckets&quot;<br>  bucket_suffixes = random_string.random<br>}<br><br>### Code in user_buckets/main.tf<br><br>variable &quot;bucket_suffixes&quot; {<br>  type = map(string)<br>} <br><br>resource &quot;aws_s3_bucket&quot; &quot;user_bucket&quot; {<br> for_each = var.bucket_suffixes<br> bucket = &quot;user-bucket-${each.value}&quot;<br>}</pre><p>To reiterate, you only need a single string per bucket, so as a module author you might feel tempted to ask for this information as keys in a set. Bypassing it as (an attribute of) a value in a map instead, you allow users to pass calculated values to your module, while still guaranteeing a static identification of all iterables (and hence not requiring targeted applies).</p><p>The same reasoning also applies to module outputs: if you need to output attributes from iterables that are configured via the for_each meta-argument, make it a habit of returning a mapping between the keys that identify those iterables and the attribute values you’d like to expose to the module’s consumers.</p><pre>## Good: return a map <br>output &quot;bucket_arn&quot; {<br>  value = {for user, bucket in aws_s3_bucket.user_bucket: user =&gt; bucket.arn}<br>}<br><br>## Bad: return a list of calculated values<br>output &quot;bucket_arn&quot; {<br>  value = [ for bucket in aws_s3_bucket.user_bucket: bucket.arn]<br>}</pre><h3>Conclusion</h3><p>Terraform’s configuration language HCL provides powerful primitives to avoid code repetition. But with great power comes great responsibility. You should be very careful introducing for_each and count in your module design. Assume by default that it is possible that the configuration could be the result of a calculation, and therefore not known at plan time.</p><p>The keys of your iterable configuration should be static, and transparently passed throughout the Terraform state. In particular, when the iterables are part of a module and their number and configuration are externally defined, the static keys identifying them should flow from variables to outputs.</p><p>In summary, err of the side of caution: use for_each over count; when using for_each, use maps over sets.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=249e4665dad1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datamindedbe/terra-dos-and-terra-don-ts-a-few-common-issues-with-terraform-iterables-and-how-to-avoid-them-249e4665dad1">Terra-Do’s and Terra-Don’ts — a few common issues with Terraform iterables and how to avoid them</a> was originally published in <a href="https://medium.com/datamindedbe">Dataminded</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Cloud: can we do better than certificates?]]></title>
            <link>https://medium.com/datamindedbe/mastering-cloud-can-we-do-better-than-certificates-e99d61d177c0?source=rss-9224abecf903------2</link>
            <guid isPermaLink="false">https://medium.com/p/e99d61d177c0</guid>
            <category><![CDATA[certification]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[education]]></category>
            <dc:creator><![CDATA[Jan Vanbuel]]></dc:creator>
            <pubDate>Wed, 19 Oct 2022 12:03:40 GMT</pubDate>
            <atom:updated>2022-10-19T12:03:40.932Z</atom:updated>
            <content:encoded><![CDATA[<p>Nowadays, cloud computing is ubiquitous. For most companies, the advantages are clear: you can scale your infrastructure elastically instead of having to over-provision; you only pay for what you use. It allows companies to focus on their core competencies which accelerate innovation. Startups get to market more quickly, and can land those first clients without first having to burn through a pile of cash for months; established players iterate more quickly, and with their nimbleness and agility one-up the competition.</p><p>In short: the Cloud is where you wanna be. It’s where the cool kids are. But how to get there? Take for example Amazon Web Services (AWS), the largest of the three most popular cloud providers (AWS, Azure, and Google Cloud Platform). With more than <a href="https://aws.amazon.com/what-is-aws/#:~:text=Cloud%20computing%20with%20AWS,services%20from%20data%20centers%20globally">200 services</a>, AWS can feel overwhelming for people new to the cloud scene. Where do you even start? And the list of services only grows longer and longer, year after year.</p><p>For many, a good place to start is cloud certificates. A certificate is typically geared towards a specific role or profile in the data space, such as BI analyst, architect, data engineer, etc. It introduces you to a subset of services deemed relevant to that role. There are a few notoriously difficult certificate exams that require very detailed and specialised knowledge, but most of them only expect you to have a bird’s eye view of the cloud landscape. To know &quot;the lay of the land&quot;, if you will. More importantly, however, is that for a lot of cloud novices, certificates can help you get a foot in the door. Landing a job without a university or college degree is more commonplace than a couple of years ago*, and obtaining a cloud certificate goes a long way in convincing a potential employer of your potential. But what to do once you’re in?</p><p>You see, here’s the main gripe I have with cloud certificates: the knowledge you gain from studying for a certificate exam is passive and often does not translate well into practice. In a way, it’s a clever scam that exploits our Darwinian urge for self-improvement while acting as an advertising channel for the larger cloud providers. Advertisements paid for by <em>you</em>.</p><figure><img alt="The &#39;always has been&#39; meme with one astronaut looking at the earth, covered by the text &#39;AWS Certified Solutions Architect Associate&#39;, asking the question &#39;Wait, it&#39;s an ad?&#39;. A second astronaut with an AWS badge aiming a gun to the first astronaut, saying &#39;Always has been&#39;." src="https://cdn-images-1.medium.com/max/888/1*kD0P5yLM6P89tJBJcSpZ1A.jpeg" /></figure><p>Let me explain a bit more in detail what I mean by that.</p><p>The most popular way to study for a certificate exam, is via e-learning resources. As a consumer of the content, it’s rather easy. You can watch the material from the confines of your comfy home. You’re learning something that might benefit you in the future. It increases your employability. It makes you feel good about yourself**.</p><p>It’s also not too difficult to game this certificate system. There are several websites where you can buy example exam questions for a &quot;small&quot; fee (&quot;small&quot; as in &quot;small in comparison to the price of the actual exam&quot;). You can pass many of the entry-level exams by iterating on these questions, until you know the answers by heart.</p><p>But in the end, how much have you actually learned? You now know the latest and greatest Cloud provider X has to offer (during an exam, when in doubt: their newest, fully managed, Serverless™ service Y is probably the correct answer). You might even remember that an AWS Lambda function times out after 15 minutes and impress your colleagues during standup with this and other bits of trivia. You’re familiar with the basic building blocks, but can you now build a castle? An entire city?</p><figure><img alt="Lego building blocks" src="https://cdn-images-1.medium.com/max/540/1*-VekzbChaRmIBaqxN1YbcQ.jpeg" /></figure><p>I think it’s fair to say that there is a significant gap between what you learn from such courses, and what you need to know to perform well in your job as a platform or data engineer. Most people learn their chops on the job. And those first few months can be quite stressful. It easily takes several months, up to a year before you start feeling a bit more confident in your new role. Some people might argue that is the only way you really learn; that this is the harsh reality we live in, and that we got to suck it up. If you’re lucky (like I was), you’re assigned a mentor or are part of a team that supports you along the way. If not, well, you’ll probably get thrown into the deep, and have to struggle to keep your head above the water. Which is neither sustainable nor is it equitable for those who cannot afford to spend their after-working hours trying to catch up. Can’t we do better?</p><p>At Data Minded, we believe there are better ways to bridge that gap. In fact, we have found an entire Academy based on this belief and a few core educational principles. For most of our courses, we make use of a <em>flipped classroom</em> approach. Instead of passively listening to a teacher for two hours, bravely trying to shovel a bunch of theoretical concepts into your brain, we focus on actively applying those concepts in practice. The theory sessions are prerecorded, and you can watch the videos at your own pace. During the interactive sessions (either in person or remotely), you are in the driver&#39;s seat. Our instructors are there to support you and help you navigate your way toward a solution. In essence, you could call it an <em>Agile approach to learning</em>: we aim at creating a short feedback loop, by offering small, bite-sized chunks of feedback; the real skill is in learning to ask the right questions that help you get unstuck.</p><p>In our <em>Introduction to Cloud Providers (with AWS)</em> course, we build an actual mini-platform for an imaginary data science startup. Although the cloud provider used in the course is AWS, we try to keep it as generic as possible. We’re not married to a single cloud. Our architecture includes all of the different components of a mature data platform: computing, storage, networking, and access control. These concepts are, indeed, transferable between clouds.</p><p>In addition, we discuss the flaws and shortcomings of our construction and the way we built it. Clicking things together in a graphical UI is great for learning purposes, but does not scale very well. Without going into too much detail, our goal is to convince you that in the mid-to-long term it pays dividends to focus on automation, and the power of infrastructure-as-code tools.</p><p>Needless to say, what we build in our half-day training is just a toy architecture. Rome was also not built in a day, let alone an afternoon. There is nothing that beats actual on-the-job experience. Learning about the intricacies of a system takes time, and typically involves getting bitten quite a few times. Still, I believe our flipped classroom approach is a considerable improvement compared to the traditional, certificate-oriented path that most people take when it comes to learning about Cloud.</p><p>If you’re interested to learn more about building stuff in the Cloud, sign up for the next edition of our <a href="https://www.dataminded.academy/summer-school-2022">Summer School</a>! Or check out our other courses, at <a href="http://www.dataminded.academy/courses">www.dataminded.academy/courses</a>.</p><p><em>*Google now hires people </em><a href="https://grow.google/intl/ssa/google-certificates"><em>without a CS degree</em></a><br>**<em>An interesting read on this subject is the article </em><a href="https://calebschoepp.com/blog/2022/productivity-porn/"><em>Productivity porn</em></a><em> by Caleb Schoepp</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e99d61d177c0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datamindedbe/mastering-cloud-can-we-do-better-than-certificates-e99d61d177c0">Mastering Cloud: can we do better than certificates?</a> was originally published in <a href="https://medium.com/datamindedbe">Dataminded</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Will Dagger revolutionize CI/CD?]]></title>
            <link>https://medium.com/datamindedbe/will-dagger-revolutionize-ci-cd-4bde1eb3fdd4?source=rss-9224abecf903------2</link>
            <guid isPermaLink="false">https://medium.com/p/4bde1eb3fdd4</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[dagger]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Jan Vanbuel]]></dc:creator>
            <pubDate>Thu, 06 Oct 2022 09:21:20 GMT</pubDate>
            <atom:updated>2022-10-06T09:21:20.058Z</atom:updated>
            <content:encoded><![CDATA[<p>In our previous <a href="https://medium.com/datamindedbe/dagger-vs-the-current-state-of-ci-cd-b2c6659dc97a">blog post,</a> we briefly pointed out some of the pain points of CI/CD systems. This second part of our series on <em>Dagger vs. the current state of CI/CD</em> introduces and explores <strong>Dagger</strong>, a new tool that promises to take away (part of) those pains.</p><h3>What is Dagger?</h3><p>Dagger is a CI/CD tool built on top of <a href="https://github.com/moby/buildkit">BuildKit</a>, that makes use of the <a href="https://github.com/cue-lang/cue">CUE language</a> for writing and validating CI/CD pipelines. It tries to improve the developer experience of writing such pipelines, by closing the gap between local and remote CI runs. You can build powerful CI/CD pipelines quickly and run them anywhere. It is possible to test and debug them locally while avoiding CI vendor lock-in. The main enabler? BuildKit!</p><h4>BuildKit?</h4><p>BuildKit is a container build tool maintained by the Moby project and, at the time of writing, the default build engine of Docker. At the core of BuildKit lies a binary intermediate format called LLB*, short for &quot;low-level builder&quot;. From the tl;dr of the official GitHub repo: &quot;LLB is to Dockerfile what LLVM IR is to C.&quot; It defines the dependency graph for the different build steps, and the BuildKit engine then finds an optimal execution path. To avoid repeating the same steps over and over after an intermediate failure, it maintains a build cache. The result is the execution speed and caching that we&#39;re used to from Docker. The key insight from the Dagger creators is that BuildKit&#39;s graph execution model can be applied to, well, any directed acyclic graph (DAG). And what are CI/CD pipelines, if not DAGs?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*YDkc9-NrMya6zafjhoygCg.png" /><figcaption>Image courtesy of dagger.io</figcaption></figure><p>As the name suggests, LLB is quite a low-level language. We don&#39;t write our container build definitions in LLB; we write them in Dockerfiles. Docker translates your Dockerfile to LLB, which then gets executed by the BuildKit engine. Similarly, Dagger uses a Dagger file front-end that gets converted to LLB. But instead of crafting their own configuration language, the Dagger team decided to use an existing one: CUE.</p><h4>CUE?</h4><p>Configure. Unify. Execute. CUE is a young configuration language aimed at constraining and validating data. It looks and feels a bit like a less-verbose, typed cousin of JSON, or a less error-prone, but still easy-to-read version of YAML. A detailed overview of the CUE language is outside the scope of this blog post, but a solid introduction can be found <a href="https://bitfieldconsulting.com/golang/cuelang-exciting">here</a> or in the <a href="https://cuelang.org/docs/about/">official docs</a>. We’ll explain the bits of CUE used in this blog post as and when we need them.</p><p>In short, Dagger CI/CD pipelines are DAGs defined in CUE, which get translated to LLB and executed by BuildKit. To makes this a bit more tangible, let’s have a look at a short example, shall we?</p><h3>Taking it for a spin: Terraform example</h3><p>We’re going to get our hands dirty by writing a Dagger pipeline to deploy infrastructure on AWS with Terraform. All the example code of this section can be found in our GitHub repository <a href="https://github.com/datamindedbe/dagger-exploration">dagger-exploration</a>. If you haven’t installed the dagger CLI yet, follow the instructions in the <a href="https://docs.dagger.io/1200/local-dev">official Dagger docs</a>. If you&#39;re on macOS or Linux and use the Homebrew package manager, you can simply run brew install dagger.</p><p>To start with a new Dagger pipeline, you first need to initialize a project in an empty directory by executing the following command in your favorite shell:</p><p>dagger project init</p><p>This generates a cue.mod folder, which will be mostly empty. Next, create a new file. You can name it anything you want, e.g. terraform.cue. Do make sure that it has the .cue extension. Although the CUE language does not have a specified extension, Dagger only interprets files with that extension. Now copy-paste the following lines of CUE into your file:</p><pre>// terraform.cue</pre><pre>package terraform</pre><pre>import (<br>	&quot;dagger.io/dagger&quot;<br>	&quot;dagger.io/dagger/core&quot;<br>	&quot;universe.dagger.io/x/ezequiel@foncubierta.com/terraform&quot;<br>)</pre><p>This defines a package namespace terraform and the imports that are necessary for developing a Terraform deployment pipeline with Dagger**.</p><p>Next, run dagger project update. This will save all dependencies referred to in your pipeline definition in the cue.mod folder, under pkg. Under the import section, copy-paste the following lines:</p><pre>// terraform.cue</pre><pre>dagger.#Plan &amp; {<br>    actions:<br>        tfSource: core.#Source &amp; {<br>            path: &quot;./infra&quot;<br>	}<br>	init: terraform.#Init &amp; {<br>	    source: tfSource.output<br>	}<br>}</pre><p>Before delving a bit more into the syntax of this snippet of CUE, let’s analyze the bits specific to Dagger. <em>All</em> Dagger pipelines require an instance of a dagger.#Plan (in a bit, we&#39;ll talk about the meaning of the # and &amp; characters and other CUE syntax elements), and the plan struct should contain a set of actions. An action is some kind of abstraction built from other actions built from other actions… If you go down the rabbit hole, all dagger actions evaluate (= are joined together) into a stew of <a href="https://docs.dagger.io/1222/core-actions-reference">core actions</a>, such as reading and writing to/from a file (including sockets), encrypting/decrypting a secret, building and running containers, …. It is precisely this set of “atomic” actions that the Dagger engine translates into LLB, ready to be gobbled down by BuildKit.</p><p>Each of the actions is a step in your pipeline, that potentially depend on other steps. If you’re familiar with Makefiles, you could also think of them as ‘targets’, as they play the same role. You can run them locally by executing dagger do {action}. The snippet above contains two actions: tfSource and init. The first action is an instance of core.#Source and takes as input a local path named infra. The second action, init, takes as input the output of the first action, which are the contents of that folder.</p><p>If you create an empty infra directory next to your CUE pipeline definition, you could already give it a try and run dagger do init. This won&#39;t do much, as we haven&#39;t written any Terraform configuration yet.</p><h4>Intermezzo: CUE</h4><p>Let’s talk a bit about CUE syntax. The # in CUE denotes a definition. A definition is used to validate some configuration input. You could think of a definition as a type, but that would be a half-truth, as there is <a href="https://cuelang.org/docs/tutorials/tour/types/types/">no distinction between types and values in CUE</a>. Informally, a definition is an underspecified value. A definition could for example be:</p><pre>#MyDefinition: {<br>    a: int<br>    b: string<br>}</pre><p>The &amp; character is called a &quot;join&quot;, and merges two values. You could think of a CUE definition as a blueprint (a bit like a class, or the builder pattern in object-oriented programming) or a function, that you can feed inputs via the join operator.</p><p>In the snippet of the previous subsection, there are three definitions: dagger.#Plan, core.#Source, and terraform.#Init. In case you didn&#39;t guess it yet, the namespace prefixes indeed indicate we&#39;re importing the definitions from the packages in the import section, i.e. dagger, core and terraform.</p><h4>We all need validation</h4><p>Let&#39;s continue with our Terraform pipeline example. First, we&#39;ll define some infrastructure in Terraform&#39;s HCL language by creating an s3.tf file in the infra directory with the contents:</p><pre>// infra/s3.tf</pre><pre>resource &quot;aws_s3_bucket&quot; &quot;dagger_bucket&quot; {<br>    bucket = &quot;example-dagger-bucket-xyz&quot;<br>}</pre><p>This creates an S3 bucket with the name &quot;example-dagger-bucket-xyz&quot;. In order for this code to work, you&#39;ll want to change the bucket argument for a unique string of your choice.</p><p>We can check our infrastructure snippet for mistakes by adding a validate action to our plan:</p><pre>// terraform.cue</pre><pre>dagger.#Plan &amp; {<br>    actions:<br>        tfSource: core.#Source &amp; {<br>            path: &quot;./infra&quot;<br>        }<br>	init: terraform.#Init &amp; {<br>	    source: tfSource.output<br>	}</pre><pre><strong>        validate: terraform.#Validate &amp; {<br>            source: init.output<br>        }</strong><strong>	</strong>		<br>}</pre><p>You can check that our HCL code contains no mistakes by running dagger do validate. If there are no errors printed to stdout, we&#39;re good to go and deploy our infrastructure!</p><h4>Confidential input</h4><p>Now that we have defined our infrastructure, we need to pass a set of AWS credentials to our Dagger pipeline in order to authorize it to deploy infrastructure in our stead. More generally, most CI/CD pipelines need some sort of credentials to communicate with protected services that are included in the pipeline definition.</p><p>Dagger supports three ways of incorporating secrets: via environment variables, via files, and via the output of other actions. For those first two variations, dagger has the notion of a client, which it uses to fetch those type of credentials. A client can be either remote or local, and can expose next to files and environment variables also sockets (which are useful if you want to interact with e.g. a Docker daemon).</p><p>Let&#39;s keep it simple and configure our AWS credentials as environment variables, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. To instruct Dagger to fetch these credentials, we define a client section as part of our plan:</p><pre>// terraform.cue</pre><pre>dagger.#Plan &amp; {<br><strong>    client: env: {<br>        AWS_ACCESS_KEY_ID:     dagger.#Secret<br>        AWS_SECRET_ACCESS_KEY: dagger.#Secret<br>        AWS_REGION:            dagger.#Secret | &quot;eu-west-1&quot;<br>    }</strong><br>...<br>}</pre><p>This tells Dagger that it should browse the client&#39;s environment variables for those three secrets, with AWS_REGION being optional; if it&#39;s not configured, Dagger will use the default value eu-west-1. Note that these secrets are instances of dagger.#Secret. This means Dagger knows that these values should be treated with care, and will not end up sprinkled around in the logs.</p><p>Finally, we configure a terraform.#Apply action with those environment variables:</p><pre>// terraform.cue</pre><pre>dagger.#Plan &amp; {<br>    client: env: {<br>        AWS_ACCESS_KEY_ID:     dagger.#Secret<br>        AWS_SECRET_ACCESS_KEY: dagger.#Secret<br>        AWS_REGION:            dagger.#Secret | &quot;eu-west-1&quot;<br>    }<br>    actions: {<br>        tfSource: core.#Source &amp; {<br>            path: &quot;./infra&quot;<br>        }<br>        init: terraform.#Init &amp; {<br>            source: tfSource.output<br>        }<br>        validate: terraform.#Validate &amp; {<br>            source: init.output<br>        }<br><strong>        apply: terraform.#Apply &amp; {<br>            source: validate.output<br>            env: {<br>             AWS_SECRET_ACCESS_KEY: client.env.AWS_SECRET_ACCESS_KEY<br>             AWS_ACCESS_KEY_ID:     client.env.AWS_ACCESS_KEY_ID<br>             AWS_REGION:            client.env.AWS_REGION<br>            }<br>        }</strong><br>    }<br>}</pre><p>Et voilà, that&#39;s it! Running dagger do apply locally should create an S3 bucket in our AWS account.</p><h4>Integrating with your CI/CD provider of choice</h4><p>After developing and testing your pipeline locally, you&#39;ll want to run it on a remote CI/CD platform. Dagger can run on any provider that supports containerized tasks, and the Dagger team itself has written several <a href="https://docs.dagger.io/1201/ci-environment">copypasta configurations</a> for the most popular CI/CD providers, such as GitHub, GitLab, CircleCI, etc. It&#39;s quite easy to set up, and the result is a uniform set of pipelines.</p><h3>Will Dagger revolutionize CI/CD?</h3><p>So far, we avoided answering the question that is the click-bait title of our post (sorry 😬). And too be honest, it&#39;s probably still too early to give a definitive answer to this question (again, sorry 😬). But here&#39;s an overview of some of the things we like/don&#39;t like about Dagger:</p><h4>Hell yes!</h4><ul><li>Dagger is fast. The caching feature allows you to iterate quickly and debug your pipelines in no time. And you can be confident that they work the same on your local machine and on a remote CI server.</li><li>We ❤ CUE. There&#39;s a lot to love about the language: it adds robustness to your configuration, giving you more confidence that your pipeline is configured correctly, while at the same time keeping it DRY. It allows you to create powerful abstractions which feel more elegant than existing JSON/YAML template-based solutions. In addition, there is now also a CUE language server, open-sourced by the Dagger team. Features such as autocomplete and jump-to-definition can be used in your IDE of choice, which further improve the developer experience of writing CI/CD pipelines.</li><li>Dagger is community-driven. A lot of CI vendors rely on the community to develop custom integrations for their platform. If Dagger succeeds in consolidating those efforts into a single ecosystem, a lot of development time can be put to more productive use.</li></ul><h4>Maybe not…</h4><ul><li>CUE is a relatively new and therefore not (yet) widely adopted language; there is certainly a learning curve to start using Dagger. For a lot of pipelines, it will be faster to write a Makefile that you can run both locally and remotely. Alternatively, you could use <a href="https://earthly.dev/">Earthfiles</a>, which are still very readable (a mix between Make and Dockerfile syntax), and which also leverage the speed and caching capability of BuildKit. You just won&#39;t be able to create abstractions.</li><li>In your remote configuration, you typically run a single (or a few) action(s). These actions depend on other actions, but these are not specified in the remote configuration. This means that the visualization of your pipeline in the UI of your CI system gets kind of borked. You can &quot;recover&quot; this functionality by chopping up your pipeline in smaller pieces, but then you tie yourself again to a particular CI system. It is likely that Dagger will at some point come with their own CI offering that solves all of that and more.</li><li>You&#39;ll have to relinquish some of the features of your favorite CI platform. For example: with Azure DevOps, you can create the pipeline via a web UI. In this web UI, you start from a template, and you are presented with a list of auto-fetched parameters for configuring the template (e.g. name of a storage account, service principal, credential stores, …). With Dagger, you&#39;ll have to look up those values yourself.</li></ul><p>Feel free to let us know if you think we missed some important arguments, either pro or contra. In the third part of this series, we&#39;ll dive a bite deeper into the Dagger pipeline spec and write a custom Dagger definition for a command-line-interface (CLI) tool.</p><p>By <a href="https://medium.com/u/9186109e2397">Hannes De Smet</a> and <a href="https://medium.com/u/9224abecf903">Jan Vanbuel</a></p><p><em>*If you want to learn more about LLB you can check out a </em><a href="https://blog.mobyproject.org/introducing-buildkit-17e056cc5317"><em>post</em></a><em> by Tonis Tiigi.</em></p><p>**<em>If you think this looks a lot like Go code, you’re not mistaken. The creator of CUE, Marcel Van Lohuizen, was for years a member of the Go team at Google</em>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4bde1eb3fdd4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datamindedbe/will-dagger-revolutionize-ci-cd-4bde1eb3fdd4">Will Dagger revolutionize CI/CD?</a> was originally published in <a href="https://medium.com/datamindedbe">Dataminded</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Quality Libraries: The Right Fit]]></title>
            <link>https://medium.com/datamindedbe/data-quality-libraries-the-right-fit-a6564641dfad?source=rss-9224abecf903------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6564641dfad</guid>
            <category><![CDATA[data-pipeline]]></category>
            <category><![CDATA[data-validation]]></category>
            <category><![CDATA[data-quality]]></category>
            <dc:creator><![CDATA[Jan Vanbuel]]></dc:creator>
            <pubDate>Mon, 24 Aug 2020 12:50:54 GMT</pubDate>
            <atom:updated>2020-09-16T07:13:31.263Z</atom:updated>
            <content:encoded><![CDATA[<h4>A high-level comparison of TensorFlow Data Validation, Great Expectations, and Deequ</h4><h3>Unit tests for data</h3><p>Data products derived from Big Data usually rely on a complex chain of data pipelines. But those data products, whether it’s a simple BI dashboard, or an advanced ML model that predicts consumer behaviour, are only as good as the data that you feed them. Or, as the common adage goes: <a href="https://hbr.org/2018/04/if-your-data-is-bad-your-machine-learning-tools-are-useless">“garbage in, garbage out”</a>.</p><p>There are a multitude of ways for things to go wrong (and according to Murphy’s law, they inevitably will): data can get lost, get delayed, be unavailable, its schema can suddenly change ... Moreover, what you consider “garbage” might differ depending on whether you’re a data engineer or a data analyst/data scientist, and who’s at the receiving end of your pipeline. One man’s trash is another man’s treasure; it’s nice if your feature column doesn’t contain many null values, but if its predictive power is zilch, its business value will be null .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*JQqY-8zeYpm5lgHmqVhyrQ.jpeg" /><figcaption>Not all data is created equal: one man’s trash is another man’s treasure. Copyright Irene Liebler.</figcaption></figure><p>At Data Minded, we believe that a significant part of data quality validation can and should be automated. A straight-forward statistical analysis of a batch of data already gives a good idea of what is to be expected from subsequent batches. More advanced machine learning techniques can be used to catch anomalies which would get lost (i.e. averaged out) in the simple statistical description.</p><p>That being said, we do recognise the value of incorporating specific domain knowledge into the validation chain by means of explicitly defined rules, knowledge which an AI agent might not so easily pick up. Moreover, the agent should be carefully tuned, as an overly sensitive quality monitoring tool leads to alert-fatigue and neglect. Which is almost as bad as having no monitoring at all.</p><p>Luckily, several open source libraries exist nowadays that can help you monitor the data passing through your data pipelines and make sure it behaves nicely. These libraries allow you to test your data, like you would test your code. Three such libraries stand out, mainly in terms of the size of the community supporting them: <a href="https://github.com/tensorflow/data-validation">Google’s TensorFlow Data Validation</a>, <a href="https://github.com/great-expectations/great_expectations">Superconductive’s Great Expectations</a> and <a href="https://github.com/awslabs/deequ">Amazon’s Deequ</a> (476, 2.477 and 1.095 stars on GitHub, respectively).</p><p>We decided to take each of these libraries for a spin and get a feeling of their capabilities. This article is a summary of our findings.</p><h3>Greatest common divisor</h3><p>From a bird’s-eye view, all three libraries can be used to implement the following workflow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*L67J5k4TVnfcO8aO2mjo_g.png" /><figcaption>Data quality validation workflow</figcaption></figure><ul><li>Step 1: ingest a batch of data to be validated</li><li>Step 2: fetch a set of rules that your data should comply with. In case you don’t have a set of rules available yet, each of the libraries offers the capability to propose a few simple rules by profiling your data.</li><li>Step 3: calculate statistics of your data and compare against the schema/set of rules to validate the data</li><li>Step 4: store the validation results and/or calculated metrics</li><li>Step 5: Take action based on the validation result (e.g. quarantine data, send notifications, …)</li></ul><p>Besides data validation, all three libraries offer the possibility of profiling your data (to some extent) without validating it. Now that we know their similarities, let’s see what sets them apart.</p><h4>1. TensorFlow Data Validation</h4><p>TensorFlow Data Validation (TFDV) is part of the <a href="https://www.tensorflow.org/tfx">TensorFlow Extended</a> (TFX) suite, developed and used by Google for their production ML pipelines. TFDV runs on top of <a href="https://beam.apache.org/">Apache Beam</a>; so in principle you have access to the multiple Beam runners (Spark, Flink, Dataflow, …) to execute your validation pipeline.</p><p>Being developed by Google, it doesn’t come as a surprise that TFDV works well out-of-the-box with Google’s own data formats (TFRecord), and with the Beam DataFlow runner. To use the Spark runner, however, you have to be willing to put in some extra work. Native support is also provided for pandas data frames and csv files, but if you want other data sources, you’ll have to write your own connector.</p><p>Compared to the other two libraries, TFDV attributes more weight to data profiling. In each validation run, TFDV calculates statistics of all columns, unless specified otherwise. If your dataset is large, this could be computationally quite expensive. Great Expectations and Deequ, on the other hand, only calculate statistics that are necessary for validation, and provide profiling on the side.</p><p>Output-wise, everything in TFDV is Protobuf, Google’s own wire format. The set of constraints your data should comply with? schema.proto. Validations? anomalies.proto. Statistics? statistics.proto. Additionally, TFDV also gives you the option to write these protobufs to plain text files.</p><p>A big plus for TFDV is its visualisation capabilities; the library makes use of Google’s<a href="https://pair-code.github.io/facets/"> Facets</a> Overview, which allows you to either visualize a single batch of data, or two batches of data side by side. You can include these Facets in a jupyter notebook, or embed them in your website.</p><h4>2. Great Expectations</h4><p>If you’ve read the eponymous novel by Charles Dickens, it’s hard not to chuckle when pulling Great Expectations (GE) from the PyPi repository*:</p><p>pip install great-expectations</p><p>At its core, GE’s goal is to validate your data by letting you define <em>expectations</em> about your data. In contrast to TFDV, it tries to make this as easy as possible by providing multiple backends (pandas, Spark, SQL), and multiple datasources and stores(file system, S3, data warehouses such as Redshift, BigQuery, Snowflake, …). All of this information (i.e. the data sources, stores, expectation suites, …) is stored in a single configuration yaml file.</p><p>Although the library exposes a Python API, it’s more convenient to use Great Expectations’ CLI to get started. After configuring your data source(s), and optionally allowing GE to infer a few simple expectations, you’re launched into a jupyter notebook which allows you to quickly iterate and fine-tune your expectations. GE also gives you the option to define your own custom expectations, both at the column and individual record level.</p><p>GE integrates out of the box with Slack so you can get notified when an expectation fails. Just pass a Slack web hook in the configuration yaml file and you’re done. In addition, GE comes with a static website, the so called <em>data docs</em>, to visualize the results of a validation job. You can either self-host these data-docs, or tell GE to publish the static website to S3.</p><p>Compared to TFDV, GE focuses less on profiling, and more on validation. Still, GE does offer basic profiling, providing you with a summary of the statistics of your data. Similarly, GE can generate a draft expectation suite based on these statistics, but expects you to fine-tune the suite in a notebook.</p><p>Because of its many features, the Great Expectations docs are a bit unwieldy. Of the three libraries, we found GE’s documentation to lack in clarity and conciseness.</p><h4>3. Deequ</h4><p>Lastly, there is Amazon’s Deequ library. Deequ is written in Scala, and built on-top of Spark. Where GE goes at lengths to accommodate you with all kinds of sources and stores for your data, Deequ keeps it simple: you’re responsible for getting and storing your data, the only thing you have to do is make sure that a some point it should reside within a Spark DataFrame. There are no bells and whistles, no fancy visualisations and no integrations with notification tools and the like.</p><p>There are, however, two features which set Deequ apart, namely the differential or stateful calculation of metrics, and its anomaly detection capabilities.</p><p>The stateful calculation of metrics allows you to update metrics for datasets which are subject to change (think of an OLTP database that grows during the day). Instead of recalculating the metrics for the entire dataset, Deequ persists the already calculated metrics in a file system, either locally or on S3, and then aggregates these with the metrics of newer data.</p><p>The anomaly detection feature of Deequ stores metrics for different batches in a MetricsRepository (again, in a local file system or S3). In addition to detecting anomalies based on absolute or relative rates of change, or simple thresholds (which is what TFDV and GE do), Deequ also gives you the option to detect anomalies based on a running average and standard deviation of those metrics.</p><p>Scala’s steeper learning curve compared to Python makes it more of a niche language. Taking this into consideration, we suspect Deequ to be mostly prevalent in the data engineering community. It’s a library written by data engineers, for data engineers.</p><h3>Conclusion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*sNsJbZFBQAfHifF7Dn602A.gif" /></figure><p>It goes without saying that each of the libraries has its own strengths and weaknesses; your choice of library will depend on the needs of your specific use case. Are you building ML pipelines, a GCP enthusiast, and do you speak fluently protobuf? TFDV FTW. Do you want to include a validation step in several pipelines, with different sources and stores, and a bunch of other integrations? Get a notification in case of failure and be able to visualise what failed and why? Great Expectations might be your thing. Do you want something more simple, yet powerful? Do you need more advanced anomaly detection or incremental computation of your metrics? Deequ is right up your alley.</p><p>P.S.: It should be said that none of the libraries actually runs your data pipelines —they’re pipeline libraries and not pipeline platforms. In the end, when you’re ready to go into production, you’ll need to submit the validation job to a workflow orchestrator such as Airflow, Luigi, Kubeflow, ...</p><p><em>* The main protagonist in Charles Dickens’ novel ‘Great Expectations’ is named Pip.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6564641dfad" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datamindedbe/data-quality-libraries-the-right-fit-a6564641dfad">Data Quality Libraries: The Right Fit</a> was originally published in <a href="https://medium.com/datamindedbe">Dataminded</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>