<?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 Edson Nogueira on Medium]]></title>
        <description><![CDATA[Stories by Edson Nogueira on Medium]]></description>
        <link>https://medium.com/@edsoncezar16?source=rss-8e03d44dba6e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*EETeDpatW9tPcoqn-s1CmQ.jpeg</url>
            <title>Stories by Edson Nogueira on Medium</title>
            <link>https://medium.com/@edsoncezar16?source=rss-8e03d44dba6e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 12:22:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@edsoncezar16/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[Asset Level Concurrency Limits via Declarative Scheduling]]></title>
            <link>https://medium.com/@edsoncezar16/asset-level-concurrency-limits-via-declarative-scheduling-c4da3a875cf4?source=rss-8e03d44dba6e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4da3a875cf4</guid>
            <category><![CDATA[dagster]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-platforms]]></category>
            <category><![CDATA[concurrency]]></category>
            <dc:creator><![CDATA[Edson Nogueira]]></dc:creator>
            <pubDate>Fri, 08 Nov 2024 17:52:32 GMT</pubDate>
            <atom:updated>2024-11-08T17:52:32.766Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Cover image showcasing the Dagster logo and an asset graph that represents concurrency limits being applied." src="https://cdn-images-1.medium.com/max/1017/1*bvjrOKC8vR5oBAUg8AmUoQ.png" /></figure><p>TL;DR: A tutorial on how to effectively define concurrency limits at the asset level in Dagster.</p><p>One of the most sought-after characteristics of data workflows is parallelism¹, which, in the context of Dagster, is a close companion of partitions.</p><p>Basically, <a href="https://docs.dagster.io/concepts/partitions-schedules-sensors/partitions">Dagster partitions</a> bring two main benefits to data workflows:</p><ul><li>Efficiency: We can retrieve and process only the necessary data, thus optimizing computing time and costs(!).</li><li>Parallelism: given that partitions can be processed independently, we can handle many at once given available resources.</li></ul><p>That last condition is the non-trivial aspect when designing workflows in Dagster because of the following concepts:</p><ul><li><strong>Assets</strong>: definitions of the computations that happen in the data pipelines, in addition to metadata on the by-products of these computations so we understand what is being produced.</li><li><strong>Runs</strong>: the actual processes launched in some execution environment (e.g. container, or local subprocess). <strong>A single run can target multiple assets</strong>.</li></ul><p>So, resource constraints are determined by the assets’ compute functions, whereas resource availability is dictated by runs, which might span multiple assets with distinct resource needs. This is usually the case when using declarative scheduling with an automation condition that materializes an asset after any dependency updates.</p><h4>Concrete example of undesired results</h4><p>Let’s consider the following Dagster configuration file:</p><figure><img alt="Example of a Dagster config file that specifies tag concurrency limits." src="https://cdn-images-1.medium.com/max/455/1*eTS1bL4cVHe1WgQ2zp8DBQ.png" /></figure><p>This will limit to at most one concurrent run with a tag key “expensive” across all runs launched by Dagster, regardless of its value.</p><p>Given that, let also consider the following definitions file, which simulates a case where one of the assets requires too many memory resources so that its partitions should not be processed in parallel:</p><figure><img alt="Dagster definitions file for the undesired results example." src="https://cdn-images-1.medium.com/max/1024/1*U6xnq-5oEMewobrGDTn02w.png" /></figure><p>This will result in the following asset graph:</p><figure><img alt="Screenshot of the Dagster UI when loading the given definitions, displaying the resulting asset dependency graph." src="https://cdn-images-1.medium.com/max/1024/1*OKkb6cHdLjbkiDqjD_Lhsw.png" /></figure><p>If we materialize the partitions from the root asset, we can notice that the default automation condition sensor will launch the runs for all partitions of the “expensive” asset simultaneously:</p><figure><img alt="Screenshot demonstrating that all partitions of the expensive asset have been launched in parallel." src="https://cdn-images-1.medium.com/max/1024/1*dJtx1yXkUaqYhrTCmVYF9w.png" /></figure><p>The reason for this is that the <strong>runs</strong> associated with each partition did not have the “expensive” tag, which was expected to propagate from the definition at the asset decorator (via the <strong>op_tags</strong> argument) of the expensive asset, as shown next (for instance, clicking on one of those “View all tags (6)” toggles:</p><figure><img alt="Screenshot demonstrating that the run launched did not have the expected tag." src="https://cdn-images-1.medium.com/max/489/1*xvJxOdCYajBeHVTrCJkXcA.png" /></figure><p>There is a <a href="https://github.com/dagster-io/dagster/issues/8979">long-running discussion</a> in the Dagster community about this topic. One of the attention points is that different assets might define conflicting key-value pairs for the same run.</p><h4>The good news: automation conditions sensors are flexible!</h4><p>Since the introduction of automation conditions in <a href="https://dagster.io/blog/dagster-1-8-call-me-maybe">Dagster’s 1.8 release</a>, one of the main advantages of this new declarative automation framework has been the ability to “control the blast radius” of the default sensor, paraphrasing Dagster founder <a href="https://medium.com/u/835451854df2">Nick Schrock</a> himself.</p><p>In practice, we can define multiple automation condition sensors that target specific assets. In addition, the sensor definition gives direct control over the <strong>run tags</strong> that will be present in runs launched by it.</p><p>So, putting it all together, we modify our Dagster definitions to the following:</p><figure><img alt="Updated definitions file with custom automation conditions that enable run tags." src="https://cdn-images-1.medium.com/max/1024/1*sW-O5i7r5PU3cSl_kVIQhg.png" /></figure><p>After this change, if we go back and materialize the root asset partitions once again, we observe the following behavior when runs for partitions of the expensive assets are launched:</p><figure><img alt="Concurrency limitation successfully achieved." src="https://cdn-images-1.medium.com/max/1024/1*7Rdcyzn7mFqDbdVspbqKaQ.png" /></figure><p>Here, we can clearly see that the “expensive” tag in the launched runs. Consequently, the runs for other partitions of the expensive asset are queued while one of them is executing, thus effectively limiting concurrency for a specific asset.</p><p><strong>Resource-based concurrency limits</strong></p><p>As a final remark, it is worth mentioning that we simplified our example to apply the same limit for the “expensive” tag regardless of its value. However, we can have different limitation needs depending on which resource is being exhausted, so an improved setup to deal with such scenarios could look like the following:</p><figure><img alt="Example of improved concurrency limit setup using a resource-based approach." src="https://cdn-images-1.medium.com/max/455/1*d6aJafMQTZK-_4NJWHPXyA.png" /></figure><h4>Acknowledgments</h4><p>The author deeply thanks <a href="https://medium.com/u/a2990fe26c6e">Gustavo Zago Canal</a> for invaluable discussions and collaboration on this issue, which led to the conception of the presented solution for the asset-level concurrency problem, which is always a hot debate topic in the Dagster community.</p><p><strong>Footnotes</strong></p><ol><li>We acknowledge that <a href="https://towardsdatascience.com/concurrency-and-parallelism-what-is-the-difference-bdf01069b081">concurrency and parallelism are not the same thing</a>, but for the scope of the main discussion, this distinction is irrelevant, or at least out of scope.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4da3a875cf4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unit Tests with Dagster and dlt]]></title>
            <link>https://medium.com/@edsoncezar16/unit-tests-with-dagster-and-dlt-7818978ee827?source=rss-8e03d44dba6e------2</link>
            <guid isPermaLink="false">https://medium.com/p/7818978ee827</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[dagster]]></category>
            <category><![CDATA[dlt]]></category>
            <dc:creator><![CDATA[Edson Nogueira]]></dc:creator>
            <pubDate>Mon, 14 Oct 2024 13:01:32 GMT</pubDate>
            <atom:updated>2024-10-14T13:01:32.436Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Cover image for the article, showcasing the article title and the logs of Dagster and dlt beneath it." src="https://cdn-images-1.medium.com/max/1024/1*1zMigl9Q8s--WDC5SkGBNQ.png" /></figure><p>TL;DR: A practical guide to bring Software Engineering best practices for data pipelines, improving data quality and time-to-value.</p><p>In a recent series of articles, culminating with a <a href="https://medium.com/@edsoncezar16/dagster-dbt-on-aws-ecs-oss-deployment-guide-922923a051ba">Dagster OSS deployment guide on AWS</a>, it was highlighted how using Dagster can completely change the value perception of a Data Platform for stakeholders.</p><p>However, that is not the only benefit of using Dagster. By design, it also makes it easier to implement best practices from Software Engineering into data workflows, in particular unit tests.</p><p>The fact that even experienced data engineers state that <a href="https://www.linkedin.com/posts/jwvangelder_dataengineering-testing-activity-7247885686807179264-57_Z?utm_source=share&amp;utm_medium=member_desktop">it is rare to see testing across data projects</a> is very unfortunate, since properly scoped tests enable a faster development lifecycle and, as a consequence, lower time-to-value for data teams. In addition, it also helps improving data quality, which seems to be the Achille&#39;s heel of the vast majority of business.</p><p>In this article, a concrete example on how to adopt Software Engineering best practices in Data workflows with Dagster and dlt is discussed.</p><h4><strong>Data Platform Engineering</strong></h4><p>To understand the motivation behind the tech stack decisions and workflow that will follow, we have to agree on a definition of what good <a href="https://dagster.io/blog/rise-of-the-data-platform-engineer">data platform engineering</a> means.</p><p>A <a href="https://www.youtube.com/watch?v=-L6ViEPnyLA&amp;t=1470s">recent seminar</a> given by Pedram Navid, which is strongly recommended, showcases a view that closely resembles the view of the the author of this article, which is presented next. Essentially, good Data Platform Engineering should have the following traits:</p><ul><li>Software Engineering at its root: tests, version control, documentation, environments, (you got it) …</li><li>Enables other engineers and stakeholders: allows seamless collaboration between engineers and showcases value for stakeholders.</li></ul><p>Based on the above definition, a no-brainer tech stack is:</p><ul><li>Dagster: in the author’s view, it is a framework that makes those seemingly intractable problems become easily solvable ones by design.</li><li>dlt: lightweight data ingestion engine, with a seamless integration with Dagster and out-of-the-box capabilities for most use cases.</li><li>dbt: if there is a data tool infamous for incorporating SWE best practices by design it is this one, right?</li></ul><h4>Core Repo Structure</h4><p>For our discussion, we will focus on the following repo structure:</p><figure><img alt="Screenshot displaying how the relevant files for the discussion of the article are organized in the repo." src="https://cdn-images-1.medium.com/max/199/1*GZhNDoDuTOXRUDkWOUcvdA.png" /></figure><h4>Setting Up the Pipeline</h4><p>Lets consider a specific use case of moving data from a BigQuery table into a Postgres database. This can be addressed via dlt using the <a href="https://dlthub.com/docs/dlt-ecosystem/verified-sources/sql_database/">sql_database source</a>:</p><pre># dlt_sources/sql_database_pipeline.py<br><br># flake8: noqa<br>from typing import Any<br><br>import dlt<br>import os<br><br>import dlt.common<br>from dlt.sources.sql_database import sql_table, Table<br>from dlt.common.libs.sql_alchemy import Select<br><br><br>internal_pipeline = dlt.pipeline(<br>    pipeline_name=&quot;internal_reporting&quot;,<br>    destination=&quot;postgres&quot;,<br>    dataset_name=&quot;internal_tools&quot;,<br>    dev_mode=os.getenv(&quot;DAGSTER_DEPLOYMENT&quot;, &quot;local&quot;) == &quot;local&quot;,<br>    progress=&quot;log&quot;,<br>)<br><br><br>@dlt.source<br>def employee(<br>    bigquery_credentials: str = dlt.secrets.value,<br>) -&gt; dlt.sources.DltResource:<br>    &quot;&quot;&quot;Returns a dlt resource for fetching employee data from the<br>    `employee` bigquery table using the given<br>    bigquery credentials.<br><br>    Uses a query adapter callback to modify the SELECT statement to be executed.<br>    &quot;&quot;&quot;<br><br>    def _query_adapter(select: Select[Any], table: Table) -&gt; Select[Any]:<br>        if table.name == &quot;employee&quot;:<br>            # this is SqlAlchemy table.<br>            # modify where and limit clauses<br>            return select.where(table.columns.email != &quot;cutoff&quot;).limit(10000)<br><br>    return sql_table(<br>        credentials=bigquery_credentials,<br>        table=&quot;employee360&quot;,<br>        schema=&quot;internal_reporting&quot;,<br>        reflection_level=&quot;full_with_precision&quot;,<br>        query_adapter_callback=_query_adapter,<br>    )<br><br><br>if __name__ == &quot;__main__&quot;:<br>    internal_pipeline.run(employee_360())</pre><p>To set up the BIGQUERY_CREDENTIALS environment variable, we need a Service Account JSON file and a project name. A utility to create a valid string for this variable is the following:</p><pre># generate_bigquery_credentials/main.py<br><br>import base64<br>import json<br>import typer<br><br>app = typer.Typer()<br><br><br>@app.command()<br>def generate_bigquery_credentials(project_name: str, sa_json_path: str) -&gt; None:<br>    &quot;&quot;&quot;Takes in the name of a Bigquery project, a string with the absolute path<br>    to a Service Account JSON file, and prints a `bigquery_credentials` string for usage<br>    in the dlt sql_database source.<br>    &quot;&quot;&quot;<br>    with open(sa_json_path) as fp:<br>        bq_sa_json = json.load(fp)<br><br>    encoded_bytes = base64.b64encode(bytes(json.dumps(bq_sa_json), &quot;utf-8&quot;))<br><br>    encoded_str = str(encoded_bytes, &quot;utf-8&quot;)<br><br>    bq_credentials = f&quot;bigquery://{project_name}?credentials_base64={encoded_str}&quot;<br><br>    print(f&quot;\nBIGQUERY_CREDENTIALS={bq_credentials}&quot;)</pre><h4>Setting Up Tests</h4><p>At this point, you might wonder: “So what? Will I need to setup a sandbox BigQuery for that and incur costs every time I run pytest?”</p><p>Not really. The whole point for any successful testing strategy is to find the appropriate scope for the tests. For instance, taking the above example where we have a pipeline that the main business requirements are:</p><ul><li>Uses a placeholder value (“cutoff”) to identify which records should not be loaded;</li><li>Limits the query results.</li></ul><p>The fact that in dlt we have <a href="https://dlthub.com/docs/reference/explainers/how-dlt-works">sources and destinations</a> connections decoupled from the pipeline logic, we can simply create <a href="https://docs.pytest.org/en/stable/explanation/fixtures.html#about-fixtures">fixtures</a> that emulates those external systems to validate our logic and <strong>keep that validation regardless of ongoing development.</strong></p><pre># internal_data_plaftorm_tests/test_assets.py<br><br>import pytest<br>import duckdb<br>import dlt<br>from dlt_sources.sql_database_pipeline import employee_360<br>from pathlib import Path<br><br><br>@pytest.fixture(scope=&quot;module&quot;)<br>def mock_atf_bigquery(tmp_path_factory) -&gt; Path:<br>    tmp_dir = tmp_path_factory.mktemp(&quot;data&quot;)<br>    source_path = tmp_dir / &quot;source.duckdb&quot;<br>    with duckdb.connect(source_path) as con:<br>        con.sql(&quot;CREATE SCHEMA internal_reporting;&quot;)<br>        con.sql(<br>            &quot;&quot;&quot;<br>            CREATE TABLE internal_reporting.employee (id INTEGER, email VARCHAR);<br>            &quot;&quot;&quot;<br>        )<br>        data = (<br>            [(i, &quot;test@example.com&quot;) for i in range(5)]<br>            + [(i, &quot;cutoff&quot;) for i in range(5, 10)]<br>            + [(i, &quot;test@example.com&quot;) for i in range(10, 10010)]<br>        )<br>        bulk_insert_stmt = (<br>            &quot;INSERT INTO internal_reporting.employee VALUES&quot;<br>            + &quot;, &quot;.join(map(str, data))<br>            + &quot;;&quot;<br>        )<br>        con.sql(bulk_insert_stmt)<br>    print(source_path)<br>    return source_path<br><br><br>def test_atf_internal_pipeline_logic(mock_atf_bigquery):<br>    dest_path = mock_atf_bigquery.parent.joinpath(&quot;destination.duckdb&quot;)<br>    mock_pipeline = dlt.pipeline(<br>        pipeline_name=&quot;test_internal_reporting&quot;,<br>        destination=dlt.destinations.duckdb(dest_path),<br>        dataset_name=&quot;internal_tools&quot;,<br>        dev_mode=True,<br>    )<br>    mock_pipeline.run(employee_360(f&quot;duckdb:///{mock_atf_bigquery}&quot;))<br>    with mock_pipeline.sql_client() as con:<br>        assert not con.sql(<br>            &quot;SELECT * FROM employee WHERE EMAIL = &#39;cutoff&#39;&quot;<br>        ).fetchone()<br>        assert (<br>            len(con.sql(&quot;SELECT * FROM employee&quot;).fetchall())<br>            == 10000<br>        )</pre><p>Finally…</p><figure><img alt="Screenshot displaying a successful run of pytest for the internal reporting pipeline." src="https://cdn-images-1.medium.com/max/1024/1*bWsXsMwvTaETq-lyk8c-gQ.png" /></figure><p>This way we can be confident that our logic is valid, reducing the potential issues to be catch on expensive computations in staging/prod environments.</p><figure><img alt="Screenshot showing successful materialization of a previously tested asset." src="https://cdn-images-1.medium.com/max/1024/1*Eq0YJkqibnxk2EfZ4npz-A.png" /></figure><h4>Conclusions</h4><p>There have been many arguments on “Data Engineering is not Software Engineering”, and rightfully so; the author also shares this point of view, but it is undisputable that there are (many) intersections. In particular, best practices such as testing and documentation should be cornerstone to data pipeline development.</p><p>We have presented a concrete example of how to implement properly scoped unit tests using Dagster and dlt. The core idea is: fixture your sources and destinations as needed and validate you logic while developing, not after expensive batch runs in staging environments.</p><p>In the next article, we will emphasize the documentation aspect of Data Platform Engineering, and how we develop an efficient framework to ensure every data asset is as valuable to stakeholders as they are to developers. Stay tuned!</p><h4>Acknowledgements</h4><p>The author deeply thanks the Internal Data Platform team at Artefact Latam, especially Leonardo Brandão and Douglas Fonseca, for the openness to explore new ideas and unknown tools; it has been delightful to work with you guys!</p><p>Another Artefactor that deserves special thanks is Ligia Bozzi for the encouragement and support for technical writting.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7818978ee827" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dagster + dbt on AWS ECS: OSS Deployment Guide]]></title>
            <link>https://medium.com/@edsoncezar16/dagster-dbt-on-aws-ecs-oss-deployment-guide-922923a051ba?source=rss-8e03d44dba6e------2</link>
            <guid isPermaLink="false">https://medium.com/p/922923a051ba</guid>
            <category><![CDATA[dagster]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[dbt]]></category>
            <dc:creator><![CDATA[Edson Nogueira]]></dc:creator>
            <pubDate>Tue, 23 Jul 2024 12:36:11 GMT</pubDate>
            <atom:updated>2024-07-23T12:36:11.115Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Background image containing the article title and the logos of Dagster, dbt, and AWS." src="https://cdn-images-1.medium.com/max/1024/1*kz_VeNM_RF6uQcGWiECFpQ.png" /></figure><p>TL;DR: leveraging the discussions in the<a href="https://medium.com/indiciumtech/dagster-dbt-a-new-era-in-the-modern-data-stack-971f0c88a9df"> Dagster Power User</a> series, we thoroughly explain a simplified Terraform deployment template to get a Modern Data Platform up and running on AWS ECS.</p><h3>Architecture Overview</h3><p>The core components of the OSS Dagster Deployment are shown in the following<a href="https://docs.dagster.io/deployment/overview"> dagster docs diagram</a>:</p><figure><img alt="Dagster OSS architecture diagram." src="https://cdn-images-1.medium.com/max/800/0*TeD8H5GDuMzukI7u" /></figure><p>Thus, regardless of the specific environment (i.e. cloud provider and specific solutions used), we have the following key elements:</p><ul><li><strong>Dagster Web Server</strong>: hosts the UI which will provide the sought-after single pane of glass for data assets and be the main form of interaction for technical and business-oriented stakeholders.</li><li><strong>Dagster Daemon</strong>: the “brain” behind Dagster functionality, responsible for executing schedules and sensors, loading user code, and retrieving data from user requests.</li><li><strong>Code Locations</strong>: these services deploy Dagster assets from different teams, e.g. EL assets from Data Engineers and dbt assets from Analytics Engineers.</li><li><strong>Core Infrastructure</strong>: This encompasses elements such as databases, object storage for logs, container services, load balancers, etc.</li></ul><p>We pick up AWS as the cloud provider. For the container service, we choose ECS, which has proven itself a simple and effective solution for container orchestration, especially in contexts where a dedicated team with expertise on Kubernetes is unavailable.</p><p>Before diving deeper into the final repo structure, we emphasize that based on the Dagster design, a more principled approach would consist of at least 3 repos for a typical data analytics project:</p><ul><li>IaC repo: with the deployment of the core infrastructure and Dagster services;</li><li>EL code location: where assets using, e.g., <strong>dagster-embedded-elt</strong>, are defined and deployed;</li><li>dbt code location: with a dbt project and using the <strong>dagster-dbt</strong> integration for asset deployment.</li></ul><p><strong>We strongly recommend the above approach</strong>, which provides a clear separation of concerns, faster iteration, and development by independent teams. However, for simplicity, we have kept all those contexts in a single repo to avoid managing too many dependencies.</p><h3>Repo Structure</h3><p>Given the above context, we add the following folders to the repo root:</p><figure><img alt="Directory structure for infra modules." src="https://cdn-images-1.medium.com/max/293/0*Dp6cDkMV_E6AKyuf" /></figure><p>The <strong>scripts</strong> folder provides utilities for easily running the Terraform commands while maintaining the modularity at an adequate level to our context: a single module for a gigantic <em>tf apply</em> operation would not make sense conceptually nor practically.</p><p>We will not emphasize the specifics of the code in those scripts, as it will not add substantially to the conceptual mapping between Dagster concepts and infrastructure deployment. For that matter, we now dive deeper into the key aspects of the infra modules.</p><p>We use the following principles for structuring the Terraform modules: <strong>main.tf </strong>contains the configurations (e.g. local variables, data sources) necessary for the remaining files, and we also try to isolate each conceptual component (e.g. vpc, database) into its file, for easier maintenance and troubleshooting.</p><h3>Base Infrastructure</h3><p>This first infrastructure stack deploys the basic components for our cloud application: the Dagster metadata database (using RDS for Postgres) and dedicated object storage for logs (S3 bucket).</p><figure><img alt="Terraform file structure for base infra module." src="https://cdn-images-1.medium.com/max/278/0*mIKvvSIV3dlz7B2S" /></figure><p>The only non-trivial point here to discuss is the tagging strategy for subnets in <strong>vpc.tf</strong>, which is designed so that we can easily filter for private/public subnets in other Terraform modules using<a href="https://developer.hashicorp.com/terraform/language/data-sources"> data sources</a>:</p><figure><img alt="Terraform code for vpc deployment in base infra module." src="https://cdn-images-1.medium.com/max/488/0*BoLcIkVIodO4vwJH" /></figure><h3>Core Infrastructure</h3><p>In this stack, we deploy the components of the base infrastructure necessary to run the Dagster services: ECS cluster, and load balancer, and we also opt-in to create a Route 53 record. The main reason for keeping this stack separate from the previous base stack is “disaster recovery”: in case it is needed, we can run a Terraform destroy operation and redeploy the entire ECS cluster without losing the application metadata that is stored in the logs bucket and the Postgres database.</p><figure><img alt="Terraform file structure for core infra module." src="https://cdn-images-1.medium.com/max/261/0*k-o3SkI3V3JlzLBv" /></figure><h3>Dagster Daemon and Web Server</h3><p>Finally, we deploy the main Dagster services to our cluster: we leverage the docker image build reference from the<a href="https://github.com/dagster-io/dagster/tree/1.7.13/examples/deploy_ecs"> official guide for ECS deployment</a>, but adapt the setup based on the deprecated integration between Docker Compose and Amazon ECS to a full ECS setup. In the <strong>outputs.tf </strong>file we return the Dagster web server URL.</p><figure><img alt="Terraform file structure for dagster infra module." src="https://cdn-images-1.medium.com/max/265/0*txEEpWP_-ZV5cKsL" /></figure><h3>Code Locations</h3><p>Finally, we deployed the code locations built along the series.</p><figure><img alt="Terraform file structure for locations infra module." src="https://cdn-images-1.medium.com/max/264/0*uwCzBBU91M4FQ2Qa" /></figure><p>Here, a point of attention is in the secrets definition, where we must ensure they have the required tag for automatic ingestion in the containers of Dagster launched runs. In particular, let’s take a look at the <strong>dbt_secrets.tf </strong>file:</p><figure><img alt="Terraform code for AWS Secrets deployment in locations module." src="https://cdn-images-1.medium.com/max/562/0*mVdQmxlrJEvLhr2W" /></figure><p>Notice that we added the tag key <strong>dagster-env</strong> to the secrets: this is the key set up in the <strong>dagster.yaml</strong> file when deploying the Dagster instance.</p><p>After successfully deploying these services, we finally achieved the end-to-end data lineage and observability features that make Dagster stand out as the go-to solution for <strong>data orchestration.</strong></p><figure><img alt="Asset lineage after successful code location deployment." src="https://cdn-images-1.medium.com/max/800/0*HPqfFr-0P39MPln6" /></figure><h3>Conclusions</h3><p>We have provided a conceptual overview of the main Dagster components and how to structure Terraform modules for a conceptually sound deployment on Amazon ECS. This template can be easily adapted to production setups: the main required change is restricting access to the load balancer. Further documentation is available in the<a href="https://github.com/techindicium/dagster-power-user"> series public repo</a>.</p><h3>Acknowledgments and Perspectives</h3><p>The author thanks<a href="https://www.indicium.tech/?r=0"> Indicium</a> for the collaboration in the Dagster Power User series, where the importance of value generation for data teams was emphasized, asserting that this responsibility has to begin right from the foundations of the Data Platform.</p><p>In this context, it was shared how using Dagster as the orchestration engine enables unprecedented levels of value perception for all stakeholders, with its lineage and data cataloging features, besides the opportunities for cost optimizations with declarative scheduling.</p><p>These discussions call attention to the evolving needs of data platform engineering and the ever-growing data team&#39;s need to move up in the value chain. Dagster was purpose-built to address these needs, so we should expect a rise in adoption in the following years.</p><p>Will Dagster become the go-to choice in the data orchestration landscape? Only time will tell us, but one thing is for sure: it has raised the bar and provided a unique alternative for data-oriented workflows, especially when the stack includes dbt.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=922923a051ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Declarative scheduling and the dagster-dbt library]]></title>
            <link>https://medium.com/indiciumtech/declarative-scheduling-and-the-dagster-dbt-library-ddfc5294d672?source=rss-8e03d44dba6e------2</link>
            <guid isPermaLink="false">https://medium.com/p/ddfc5294d672</guid>
            <category><![CDATA[dagster]]></category>
            <category><![CDATA[modern-data-stack]]></category>
            <category><![CDATA[declarative-pipeline]]></category>
            <category><![CDATA[dbt]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Edson Nogueira]]></dc:creator>
            <pubDate>Fri, 28 Jun 2024 17:58:09 GMT</pubDate>
            <atom:updated>2024-06-28T17:58:09.724Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Cover image for the current article, featuring the series title, the logos of Dagster and dbt, and the article title." src="https://cdn-images-1.medium.com/max/1024/1*zpStkf2qZs06DT1bar67KQ.png" /></figure><h3><strong>dbt </strong>has shaped data transformation, ensuring software engineering and DataOps best practices, such as version control, documentation, and data lineage.</h3><p>By integrating <strong>dbt</strong> with <strong>Dagster</strong>, you can supercharge these features, providing a centralized pane of glass for the whole Data Platform.</p><p>This integration, combined with auto-materialization policies, enables cost-optimized workflows by avoiding unnecessary dbt runs.</p><p>In this article, we will delve into the unique features that make dbt a standout tool within the Modern Data Stack (MDS), how its integration with Dagster extends these benefits to the ingestion pipelines and the broader implications of this integration for data platforms.</p><h3>The “D” in MDS</h3><p>The <a href="https://medium.com/indiciumtech/modern-data-stack-how-to-build-cutting-edge-applications-12ecd759a10e">Modern Data Stack methodology</a> emerged from the necessity of balancing the I.T. and business ends in data initiatives. In summary, the main benefits of this approach are:</p><ol><li>Focus on business outcomes.</li><li>Best practices from software engineering.</li><li>Scalability by leveraging cloud technologies.</li></ol><p>Notice that, so far, we did not mention any specific technology. This is because we can use any combo of technologies and call it a “Modern Data Stack”, as long as the above outcomes are satisfied.</p><p>As discussed in a <a href="https://medium.com/indiciumtech/data-ingestion-with-the-dagster-embedded-elt-library-60d860321d45">previous article</a> in this series, the open-source ingestion landscape has seen a plethora of technologies that are well suited to this purpose, such as Airbyte, Meltano, and dlt.</p><p>However, when it comes to transformation, <a href="https://medium.com/indiciumtech/17-dbt-commands-you-should-start-using-today-581998dbf8f0">dbt</a> has established itself as the standard data transformation tool, given it perfectly encapsulates the 3 key benefits sought after when using the MDS approach, even though some tough competitors are emerging, such as SQLMesh.</p><p>Given this context, a natural question to ask is: what specific features of dbt make it so unique among the MDS tools?</p><p>By keeping an eye on the mentioned benefits, we certainly have to look for those features that bring business outcomes besides I.T. best practices. In particular, the data lineage feature helps achieving expressive results in an increasingly important aspect: data governance.</p><p>With the Dagster-dbt integration, one can extend this feature to the ingestion pipelines as well, enabling end-to-end observability for the whole data platform, as we discussed in our <a href="https://medium.com/indiciumtech/dagster-dbt-a-new-era-in-the-modern-data-stack-971f0c88a9df">initial article</a> of this series.</p><figure><img alt="Image showing dagster-dbt integration in ingestion pipelines." src="https://cdn-images-1.medium.com/max/720/0*YX2vjV4eQqEeO7Bu" /></figure><p>In the following, we will discuss in more detail practical steps to achieve these goals, building upon the EL structure where we left off in our <a href="https://github.com/techindicium/dagster-power-user">public repo</a> in the previous article.</p><h3>dbt + Dagster</h3><p>We will set up a simple dbt project based on the Adventure Works data we worked previously in our ingestion pipelines. For a thorough discussion of what a dbt project is and the main concepts behind it (i.e. models, tests, etc.) we recommend consulting the <a href="https://docs.getdbt.com/docs/get-started-dbt">official getting started guide</a>.</p><p>Now, we will share our thoughts on how to structure the dbt code location.</p><ul><li>Code location structure</li></ul><p>We organize our code location module as follows:</p><figure><img alt="Image showing dbt code location module." src="https://cdn-images-1.medium.com/max/168/0*l3iImwe-1IZMvoA6" /></figure><ul><li>resource.py</li></ul><p>This will define the key links to the dbt project, such as the dbt project dir and a proper dbt cli for running the project.</p><figure><img alt="Image showing code for dbt project dir and dbt cli." src="https://cdn-images-1.medium.com/max/743/0*2dJ42YbQT8XNUnZN" /></figure><ul><li>translator.py</li></ul><p>This is where the mapping between features from the dbt project (e.g. models, tests) and Dagster assets are defined. The integration already comes with a pre-built translator, but the ability to define a custom translator allows you greater flexibility for your specific needs.</p><figure><img alt="Image illustrating code for custom dagster-dbt translator." src="https://cdn-images-1.medium.com/max/819/0*AFPrvX3HSjMy5Hht" /></figure><ul><li>assets.py</li></ul><p>Here is where the magic of the integration happens: we use the translator and the multi-assets decorator provided by the integration to actually generate the Dagster assets.</p><figure><img alt="Image showing code of integration that generates dagster assets." src="https://cdn-images-1.medium.com/max/621/0*LPQiyFNyok41S5-A" /></figure><ul><li>automation.py</li></ul><p>In this case, we leverage the <a href="https://dagster.io/blog/declarative-scheduling">Dagster declarative scheduling</a> capabilities to define auto-materialization policies for our dbt models.</p><figure><img alt="Image showing code of dagster declarative scheduling for auto-materialization for dbt models." src="https://cdn-images-1.medium.com/max/624/0*9fe_dqjvVOgEC0gp" /></figure><ul><li>__init__.py</li></ul><p>Finally, we create our Definitions object with the elements discussed so far.</p><figure><img alt="Image showing dagster-dbt code of definitions object." src="https://cdn-images-1.medium.com/max/298/0*xjiygONOW13YIa3L" /></figure><h3>Cost-optimization with declarative scheduling</h3><p>If you compare the <strong>automation.py</strong> scripts for the EL pipeline and for the dbt models, you will notice that, whereas we used a traditional schedule with the former, for the latter there was no mention of a cron expression whatsoever.</p><p>Instead, what was defined was a declarative schedule: we define the conditions under which we want the asset materializations to happen and let Dagster monitor and trigger them when those conditions are met.</p><p>This is another example of how Dagster can take the MDS to the next level with its data-aware approach.</p><p>In particular, this example of declarative scheduling solves a common problem in orchestrating data pipelines: the dbt models have dependencies between themselves and the ingested raw data in the warehouse.</p><p>The declarative scheduling approach, in this case configured using Auto-Materialization Policies (AMPs), can ensure that a dbt model will run when, and only when, its dependencies have updated. This brings two highly desirable characteristics for the data platform:</p><ul><li>We do not need to worry about a fixed schedule running the dbt models unnecessarily in case there is no new data to process.</li><li>We ensure that, as soon as there is new data to process, the dbt models will be executed, minimizing the delay between ingestion and serving of new data.</li></ul><p>Given the potential for improving cost-optimization and data availability, which are cornerstone factors in the design of data platforms, we can consider Dagster’s declarative scheduling features as a deciding factor in choosing it as an orchestration tool, as many new features in this area that are going to improve upon the current AMPs mechanisms will be available soon.</p><h3>Conclusions</h3><p>Although many technologies can be assembled together to execute a MDS methodology for a given data project, it is hard to imagine one stack that will not have dbt as its transformation tool, since it brings the core principles of the methodology by design.</p><p>When used alongside Dagster, the dbt native data governance capabilities are potentialized for the whole data platform, bringing data observability and a data catalog for free by simply putting the platform up and running.</p><p>We also showed how other Dagster’s declarative scheduling features can potentialize a stakeholder-favorite pillar of data projects: cost optimization.</p><p>In particular, an appropriate setup entails that data is processed as soon as it is available and no redundant compute costs in the warehouse due to dbt runs will appear at the billing report.</p><h3>What is next?</h3><p>In this third article from the <strong>Dagster Power User </strong>series, we discussed the transformation stage in the data platform with dbt and how to leverage Dagster features to potentialize data governance and cost-optimization capabilities.</p><p>After we have our business logic properly implemented in the warehouse, it is showtime (a.k.a. deploy time)!</p><p>That is what we will explore in the next article: how to deploy what we have built and locally tested so far to the cloud.</p><p>Specifically, we will deploy a Dagster instance and our code locations to Amazon ECS using a simple Terraform template.</p><p>Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ddfc5294d672" width="1" height="1" alt=""><hr><p><a href="https://medium.com/indiciumtech/declarative-scheduling-and-the-dagster-dbt-library-ddfc5294d672">Declarative scheduling and the dagster-dbt library</a> was originally published in <a href="https://medium.com/indiciumtech">Indicium AI Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Ingestion with the dagster-embedded-elt Library]]></title>
            <link>https://medium.com/indiciumtech/data-ingestion-with-the-dagster-embedded-elt-library-60d860321d45?source=rss-8e03d44dba6e------2</link>
            <guid isPermaLink="false">https://medium.com/p/60d860321d45</guid>
            <category><![CDATA[dagster]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[dlt]]></category>
            <category><![CDATA[sling]]></category>
            <category><![CDATA[data-ingestion]]></category>
            <dc:creator><![CDATA[Edson Nogueira]]></dc:creator>
            <pubDate>Fri, 07 Jun 2024 19:52:16 GMT</pubDate>
            <atom:updated>2024-06-07T19:52:16.737Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Cover image for this Medium article, with Dagster and dltHub logos, the series title above the logos, and the article title below." src="https://cdn-images-1.medium.com/max/1024/1*0Mt2KCYK3Q556M0a8PEHWg.png" /></figure><p>Open-source<strong> data ingestion</strong> can be challenging without a clear go-to solution.</p><p>But, the <strong>dagster-embedded-elt library</strong> can simplify this process with lightweight integrations.</p><p>In this article, learn to handle <strong>databases</strong> and<strong> filesystems</strong> with <strong>Sling </strong>and <strong>unstructured data</strong> with <strong>dlt</strong> to improve the process of <strong>ingestion</strong> when building a <strong>data platform.</strong></p><h3>Data Ingestion and the Paradox of Choice in Open-Source EL</h3><p>When it comes to <strong>data ingestion</strong>, we are faced with a couple of scenarios:</p><ol><li><strong>Proprietary tools</strong>, such as Fivetran: amazing capabilities, easy setup, but considerable increase in bills. If you can handle justifying the high spending with <strong>EL pipelines</strong>, then you are in a dream scenario.</li><li><strong>Open-source EL</strong>: the company wants all benefits of proprietary <strong>EL tools</strong>, such as <strong>robustness</strong> and <strong>scalability</strong>, but spending the least possible. In this scenario, we are faced with a situation similar to the <a href="https://www.amazon.com.br/Paradox-Choice-More-Less-Revised/dp/0062449923">paradox of choice</a>: with so many options to choose from, without clear winners such as dbt for transformation and Snowflake/Databricks for data warehouse, picking up a subset of tools to define an <strong>EL stack</strong> can be more difficult than it might seem.</li></ol><p>So, assuming you are in the second scenario, you might be considering tools such as <strong>Meltano</strong> or <strong>Airbyte.</strong> Both have their advantages and shortcomings and, depending on the teams’ affinity with those tools, each of them might be the right choice.</p><p>Nevertheless, when we have no outrageous advantages to define a specific tool,<strong> ease of integration </strong>with the remaining data stack begins to gain importance.</p><p>And here is where the<strong> dagster-embedded-elt library</strong> provides an opportunity to use some <strong>data ingestion </strong>tools that are not mainstream in the EL landscape yet, but which have the potential to be so:</p><ul><li><a href="https://docs.dagster.io/integrations/embedded-elt/sling"><strong>Sling</strong></a><strong>: </strong>can handle most databases/warehouses and filesystems you are likely to encounter.</li><li><a href="https://docs.dagster.io/integrations/embedded-elt/dlt"><strong>dlt</strong></a><strong>:</strong> shines when we need to build pipelines for unstructured data (e.g. APIs).</li></ul><p>This duo covers most of, if not any, data sources found in a typical data project and considerably reduces development time of<strong> Dagster</strong> assets due to lightweight integration maintained by the <strong>Dagster</strong> team itself with the help of its vibrant and growing community.</p><h3>How Dagster Integrations can be beneficial for data ingestion</h3><p>To fully understand the importance of an integration, and the benefits of using one that is maintained by the Dagster team itself, let’s recall some important <a href="https://docs.dagster.io/concepts">Dagster concepts</a>:</p><ul><li><strong>Op</strong>: is the core computational unit of the framework. In simple terms, it is “what actually runs” when you materialize an asset. This is the analog of the <strong>task</strong></li><li><strong>Asset</strong>: in simple terms, it is a combo of <strong>op + metadata</strong>: in addition to what executes, it has an additional layer with metadata to translate technical execution into business results. As a bonus, this metadata is accessible in an easy-to-understand way in the Dagster UI.</li></ul><p>In this context, a <strong>Dagster integration</strong> allows you to only focus on using your tool of choice — in the same way you would without any orchestration tool — and, then, <strong>translates</strong> what you have done (“what actually executes”) to Dagster assets.</p><p>For instance, the<strong> </strong><a href="https://docs.dagster.io/integrations/dbt"><strong>dagster-dbt integration</strong></a> is what we would call a <strong>gold standard</strong> for such libraries, and makes orchestrating dbt models as seamlessly as possible.</p><p>That being said, it is important to note that an integration is not strictly necessary to use Dagster with any tool: you can always write your own factory-like code to generate Dagster objects (assets, jobs, etc.) for any tool as well.</p><p>However, using an integration is strongly recommended, as it heavily simplifies the development process and scalability of ingestion pipelines.</p><p>Better yet when such integration is maintained by the Dagster team itself (as the dagster-embedded-elt), which makes it more likely that you will be extracting the full potential of Dagster features.</p><p>Keep reading to find out how to structure projects combining<strong> Sling</strong> and<strong> dbt </strong>with <strong>Dagster,</strong> to improve the<strong> data ingestion</strong> in your projects.</p><h3>Sling + Dagster</h3><p>Here we will share our thoughts on how to structure the project for easier maintenance and faster development with a replication from S3 to Snowflake as example.</p><ul><li>Code Location Structure</li></ul><p>We organize our code location module as follows:</p><figure><img alt="Image illustrating code location module for data ingestion." src="https://cdn-images-1.medium.com/max/184/0*24rzLPxSq4m8M52B" /></figure><ul><li>replication.yaml</li></ul><p>The core object of this setup, which defines the <strong>Sling</strong> streams that will be<strong> converted to assets </strong>in <strong>Dagster.</strong></p><figure><img alt="Image showing code defining Sling streams that will be converted to assets on Dagster for data ingestion." src="https://cdn-images-1.medium.com/max/553/0*mge8tp1YL3t9rzsJ" /></figure><ul><li>resources.py</li></ul><p>Defines the <strong>Dagster</strong> resources for interacting with the <strong>Sling CLI</strong>.</p><figure><img alt="Image illustrating code of Dagster resources for interacting with Sling CLI in data ingestion." src="https://cdn-images-1.medium.com/max/484/0*m1lmK5Q3p73hMgBp" /></figure><ul><li>translator.py</li></ul><p>This is where the <strong>mapping between features</strong> from the original objects (e.g. Sling streams) and Dagster assets are defined. The integrations already come with a pre-built translator, but the ability to define a<strong> custom translator </strong>allows you greater<strong> flexibility </strong>for your specific needs.</p><figure><img alt="Image illustrating code of mapping between features for data ingestion." src="https://cdn-images-1.medium.com/max/699/0*KHTj8ovy6hz7y9T3" /></figure><ul><li>assets.py</li></ul><p>Here is where the magic of the<strong> integration</strong> happens: we use the translator and the multi-assets decorator provided by the integration to actually<strong> generate</strong> the <strong>Dagster assets.</strong></p><figure><img alt="Image illustrating translator codes used to generate Dagster assets for data ingestion." src="https://cdn-images-1.medium.com/max/766/0*DOY051dgtipmU3xM" /></figure><ul><li>automation.py</li></ul><p>Here, we define a job with a schedule to actually orchestrate the materializations of our assets.</p><figure><img alt="Image showing code that defines a job with a schedule to actually orchestrate the materializations of Dagster assets." src="https://cdn-images-1.medium.com/max/642/0*OMjrEsAccTnE9-A9" /></figure><ul><li>__init__.py</li></ul><p>Finally, we create our <strong>Definitions object</strong> with the elements discussed so far.</p><figure><img alt="Image showing code creating definitions object for data ingestion." src="https://cdn-images-1.medium.com/max/702/0*R_oVl5bWGna3Vth2" /></figure><h3>dlt + Dagster</h3><p>Similarly to the previous section, we now explore an ingestion of LATAM countries GDP data from the World Bank API to <strong>Snowflake</strong> as an example to share our thoughts on<strong> best practices </strong>for the <strong>dlt integration.</strong></p><p>We will skip the <strong>automation.py</strong> and <strong>__init__.py</strong> discussion for this case, as it works almost unaltered from the <strong>Sling </strong>scenario, with only straightforward modifications mapping Sling → dlt.</p><ul><li>Code Location Structure</li></ul><figure><img alt="Image illustrating data ingestion code location structure." src="https://cdn-images-1.medium.com/max/191/0*5OasPd7Uiv_0WFKE" /></figure><ul><li>source.py</li></ul><p>The core object of this setup, which defines the<strong> dlt resources</strong> that will be converted to assets in <strong>Dagster.</strong></p><figure><img alt="Image illustrating data ingestion code of the dlt resources to be converted to assets in Dagster." src="https://cdn-images-1.medium.com/max/1024/0*9kSGg6qq7sIpMs4m" /></figure><ul><li>destination.py</li></ul><p>We define the destination explicitly for better management of environment variable credentials.</p><figure><img alt="Image showing code for definition of destination in the data ingestion process." src="https://cdn-images-1.medium.com/max/509/0*Uql_PpoR9tJZY5lK" /></figure><ul><li>translator.py</li></ul><figure><img alt="Image showing code for the translator.py for data ingestion." src="https://cdn-images-1.medium.com/max/678/0*W09xF6nWirQBoNvV" /></figure><ul><li>assets.py</li></ul><figure><img alt="Image showing code for the assets.py in the data ingestion process." src="https://cdn-images-1.medium.com/max/601/0*BBytHUddS2qeBH8-" /></figure><p>After both Sling and dlt assets are defined, the outcome in the UI will look like the following:</p><figure><img alt="Image showing both Sling and dlt assets in the Dagster UI." src="https://cdn-images-1.medium.com/max/516/1*7rmQOy9s_6Z_UcJKkMLSeQ.png" /></figure><p>You can check our <a href="https://github.com/techindicium/dagster-power-user">series’ public github repo</a> where we will parallel the discussions in our series with a concrete implementation of a Modern Data Platform with Dagster + embedded-elt + dbt.</p><h3>Conclusions</h3><p>Choosing the right stack for a data project always involves many tradeoffs such as costs, development time, team experience, and so on.</p><p>Especially when it comes to open-source <strong>data ingestion</strong> tools, where no player really stands out from the sea of options — differently from <strong>dbt</strong> in the transformation helm, the weight of the ease of integration between the overall stack increases.</p><p>In particular, when using Dagster, the dagster-embedded-elt library provides a seamless integration which covers most of the data sources found in any data project: for instance, databases and filesystems with Sling and unstructured data with dlt.</p><p>It provides a sufficiently good starting point for building pipelines in a cost-effective and scalable way. After the pipelines are working, for sure the stakeholders will be happier than if they had a non-negligible bill for data ingestion only, as would happen with proprietary tools.</p><h3>What is next?</h3><p>In this second article from the Dagster Power User series, we discussed the first stage in the logical chain of the building of a data platform: ingestion.</p><p>After we have our raw data in the warehouse at our disposal, it is time for the Analytics Engineers to transform it with dbt to implement the business logic.</p><p>That’s what we explore in the next article: how <strong>Dagster</strong> really shines for its powerful integration with the only certainty in the <strong>Modern Data Stack</strong>, allowing unparalleled observability and governance. Stay tuned!</p><p>Click <a href="https://medium.com/indiciumtech/dagster-dbt-a-new-era-in-the-modern-data-stack-971f0c88a9df">here</a> to read the first article of this series if you haven’t already.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60d860321d45" width="1" height="1" alt=""><hr><p><a href="https://medium.com/indiciumtech/data-ingestion-with-the-dagster-embedded-elt-library-60d860321d45">Data Ingestion with the dagster-embedded-elt Library</a> was originally published in <a href="https://medium.com/indiciumtech">Indicium AI Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dagster + dbt: a New Era in the Modern Data Stack]]></title>
            <link>https://medium.com/indiciumtech/dagster-dbt-a-new-era-in-the-modern-data-stack-971f0c88a9df?source=rss-8e03d44dba6e------2</link>
            <guid isPermaLink="false">https://medium.com/p/971f0c88a9df</guid>
            <category><![CDATA[modern-data-stack]]></category>
            <category><![CDATA[dagster]]></category>
            <category><![CDATA[dbt]]></category>
            <category><![CDATA[data-platforms]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Edson Nogueira]]></dc:creator>
            <pubDate>Fri, 24 May 2024 22:21:56 GMT</pubDate>
            <atom:updated>2024-05-28T18:24:03.865Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cIqMpBQ0m67UYbIGGgOmEw.png" /></figure><p>It does not matter how good your<strong> data platform</strong> is if you don’t manage to convince stakeholders of its value.</p><p>With <strong>Dagster + dbt</strong>, both technical and business people can have a clear picture of the value the <strong>data platform</strong> used in the <strong>Modern Data Stack (MDS)</strong> is bringing to the table in their own perspectives.</p><p>What is Value?</p><p>Knowing how to use the potential of the <strong>Modern Data Stack</strong> precisely to make it tangible for interested parties.</p><p>Keep reading and you will understand…</p><h3>Generating business value with Modern Data Stack</h3><p>We hear all the time that the goal of any <strong>data team</strong> is to generate value to the business with <strong>data</strong>, for example, using<strong> Modern Data Stack</strong>, but at the same time it is not always clear if people share a common notion of value in these contexts, especially when there is not a direct link between what is being built and an immediate monetary return.</p><p>For the purposes of our present discussion, let’s use the following definition commonly employed by the <strong>Indicium’s data products team</strong>:</p><figure><img alt="Image illustrating Indicium’s team’s definition of value when applying Modern Data Stack: perceived benefit vs perceived effort." src="https://cdn-images-1.medium.com/max/299/0*XWfieHIh2XNxLjYi" /></figure><p>The word <strong>perceived</strong> here is key: it emphasizes that it is a subjective concept, and depends on the perspective of the person who is assessing the <strong>value</strong>.</p><p>And it is precisely for failing to recognize that the technical and business perspectives on the <strong>data platform’s value</strong> very often do not agree that many <strong>data initiatives fail</strong>, as they do not gain the required stakeholder’s buy-in and resources to be fully developed.</p><h3>A necessary paradigm shift for the Modern Data Stack</h3><p>It is worth mentioning that the trend of <strong>data engineering teams</strong> needing to move up in the value chain was already presented in the 2022 book <a href="https://www.amazon.com/Fundamentals-Data-Engineering-Joe-Reis-ebook/dp/B0B4VH4T37"><strong>Fundamentals of Data Engineering</strong></a>, by Joe Reis and Matt Housley.</p><p>In<strong> practical settings</strong>, however, what we usually end up seeing is: <strong>data platforms with healthy pipelines</strong>,<strong> good documentation and processes</strong> — which help decrease the denominator in the <strong>value</strong> expression — but without an easy to digest, readily accessible panel of what is actually being produced by the pipelines — which keeps the numerator is practically unaltered.</p><p>With<strong> </strong><a href="https://dagster.io/"><strong>Dagster</strong></a>, we change our rationale about <strong>data pipelines</strong> from tasks to be executed towards assets to be materialized.</p><p>Using the precise definition from the <a href="https://docs.dagster.io/"><strong>Dagster docs</strong></a>, <strong>an asset is an object in persistent storage, such as a table, file, or persisted machine learning model</strong><em>.</em></p><p>This might not seem such a big deal at first, but combined with that asset-first philosophy, the design of the tool and the observability features entailed by it dramatically increase the <strong>perceived benefit</strong> numerator of the <strong>value</strong> equation.</p><p>Therefore, applying that in your <strong>Modern Data Stack </strong>can be a game-changer. Keep reading to understand more.</p><h3>Perceived benefits</h3><p>Remember that killer <a href="https://docs.getdbt.com/terms/data-lineage#dags-directed-acyclic-graphs"><strong>dbt lineage feature</strong></a>?</p><p>Can you imagine such a feature extended over your entire data pipelines, all the way from the ingested tables to the serving layer?</p><p>Besides that, imagine if, together with the lineage graph, we also have details about the last execution of the assets, easy access to run execution logs, all centralized in the UI of a single tool?</p><p>With <strong>Dagster</strong>, we get all that, and essentially a data catalog for free, simply by spinning an instance up and running.</p><p>For instance, the following example uses the dagster-embedded-elt library, which provides native integration with Sling and dlt, together with dbt, so that we can see such comprehensive lineage and materialization information:</p><ul><li>EL assets constructed using Sling:</li></ul><figure><img alt="Image illustrating EL assets constructed using Sling in the context of Modern Data Stack." src="https://cdn-images-1.medium.com/max/983/0*I4yOjPZhH6J4opBF" /></figure><ul><li>dbt assets constructed using dbt</li></ul><figure><img alt="Image of dbt assets constructed using dbt in the Modern Data Stack context." src="https://cdn-images-1.medium.com/max/1024/0*_rO6Lxc-rPBfYCZx" /></figure><ul><li>Global asset lineage, which can be expanded as needed with the use of asset groups:</li></ul><figure><img alt="Image illustrating global asset lineage expanded with asset groups in a Modern Data Stack setting." src="https://cdn-images-1.medium.com/max/1024/0*0bS9QXC5ono2OAQY" /></figure><h3>Battlefield test</h3><p>Alright, all that fancy design and game-changer rationale about data pipelines is beautiful, but how does that actually stand in a real-world project of global reach, with a lot at stake?</p><p>Well, of course we cannot give a definitive answer, but we can share the insights of our recent experience applying all of these concepts in practice with a first-class client money-wise.</p><p>As the <strong>data platform engineer</strong> who has executed most of the technical tasks in the project, I would like to talk first about the development experience, where we can basically emulate our production setup in our local machine and be confident when pushing locally developed pipelines to production.</p><p>That takes us to another level in development speed, and such a fast lifecycle and iterative development enables us to address many data pipeline issues orders of magnitude faster than with conventional tools.</p><p>Now, bringing back the focus towards the stakeholder’s perceived benefits, it suffices to say that, in our first meetings with the client, they said to us that their demands were mainly regarding the observability and monitoring aspects of the data pipelines: they would like to know what, when, and why something went wrong.</p><p>Once we finished our PoC with a couple of ingestions, they were simply mesmerized by the results: in addition to all they wanted, they could have a global view of all assets being produced.</p><p>In addition, along the implementation it was possible to see a <strong>massive reduction in RTO (weeks to hours) and infrastructure spending</strong>.</p><p>Since then, our data platform team gained immense buy-in to take the lead in basically every major decision regarding data architecture and software engineering aspects of the <strong>platform</strong>, which unfortunately is a rare occurrence in data initiatives.</p><p>I hope we pave the way for that occurrence becoming more frequent by our teams adopting the right <strong>Modern Data Stack</strong> tool for the right outcomes.</p><h3>Conclusions</h3><p>In general, <a href="https://www.indicium.tech/pt-br/blog/o-que-e-analytics-engineer-conheca-a-nova-profissao-do-mundo-de-dados"><strong>analytics engineers</strong></a> are closer to the business stakeholders in day-to-day operations, and their delivery is much more tangible, so that they can easily convince stakeholders of the value they are bringing to the table.</p><p>That is rarely an option for <strong>data platform engineers</strong>, as it is hard for people without a technical background to abstract the value behind phrases such as:</p><p>“The tasks are executing without failure, so those tables that our <strong>Analytics Engineers</strong> need to build your <strong>DW </strong>are reliable”.</p><p>Instead, let them easily see what you are building, when it was materialized — and, therefore, reliable — for downstream consumption.</p><p>Make it so easy for them to understand how what you are building connects with the <a href="https://www.indicium.tech/pt-br/blog/data-warehouse-"><strong>data warehouse</strong></a> and <strong>ML models</strong>.</p><p>No longer try to convince a stakeholder of the value of your platform from the engineer perspective: simply increase the value directly on their own.</p><h3>Dagster + dbt in the MDS: What is next?</h3><p>We hope you enjoyed our first article in this <strong>Dagster</strong> series, where we emphasized the single most important reason we believe it has the potential to begin a new era in the <strong>Modern Data Stack</strong>: making the <strong>platform value</strong> tangible for stakeholders.</p><p>Next week, we will start giving more details on that journey to generate value with <strong>Dagster </strong>beginning with the first step on each data workflow: ingestion. Specifically, we will talk about how we can leverage <strong>Dagster’s</strong> native integrations with <strong>open-source EL tools</strong> to build functional and cost-effective <strong>data workflows</strong>.</p><p>Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=971f0c88a9df" width="1" height="1" alt=""><hr><p><a href="https://medium.com/indiciumtech/dagster-dbt-a-new-era-in-the-modern-data-stack-971f0c88a9df">Dagster + dbt: a New Era in the Modern Data Stack</a> was originally published in <a href="https://medium.com/indiciumtech">Indicium AI Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Par ou ímpar? Aplicando o raciocínio probabilístico de maneira consistente.]]></title>
            <link>https://medium.com/suzano-digitaltech/par-ou-%C3%ADmpar-aplicando-o-racioc%C3%ADnio-probabil%C3%ADstico-de-maneira-consistente-1a6d95811b40?source=rss-8e03d44dba6e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a6d95811b40</guid>
            <category><![CDATA[probabilidade]]></category>
            <dc:creator><![CDATA[Edson Nogueira]]></dc:creator>
            <pubDate>Thu, 29 Dec 2022 19:03:28 GMT</pubDate>
            <atom:updated>2023-01-12T19:45:53.712Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introdução</strong></h3><p>Os conceitos fundamentais de estatística sempre geram discussões interessantes, tanto entre o público geral quanto entre profissionais que utilizam a estatística de maneira rotineira em suas atividades.Nesse contexto, talvez nenhum conceito cause mais confusão nas discussões do que o de <strong>probabilidade</strong>. Em particular, mesmo entre profissionais experientes é comum vermos aplicações equivocadas deste conceito.</p><p>Podemos considerar como um exemplo famoso o problema de Monty Hall, resolvido por <a href="https://en.wikipedia.org/wiki/Marilyn_vos_Savant"><em>Marilyn vos Savant</em></a> e no qual mesmo doutores (!) em Matemática discordaram da solução correta antes de verem uma simulação computacional, incluindo o notável Paul Erdös. Uma discussão detalhada e envolvente deste caso pode ser vista no livro <a href="https://www.amazon.com.br/andar-b%C3%AAbado-acaso-determina-nossas/dp/8537818100"><em>O andar do bêbado: como o acaso determina nossas vidas</em></a>, de Leonard Mlodinow, que considero um dos melhores livros que já li até hoje!</p><p>Uma <a href="https://www.linkedin.com/feed/update/urn:li:activity:6960402413706985472?updateEntityUrn=urn%3Ali%3Afs_feedUpdate%3A%28V2%2Curn%3Ali%3Aactivity%3A6960402413706985472%29"><em>enquete</em></a> publicada no Linkedin por Henrique Junqueira Branco, que atua na área de dados como Engenheiro de Machine Learning, perguntava sobre quem tem mais chances de ganhar no par ou ímpar. Vários profissionais e estudantes da área de Ciência de Dados comentaram, e uma quantidade considerável dos participantes votou a favor da escolha ‘par’ usando argumentos que, embora pareçam plausíveis, estão equivocados quando levamos em conta a definição de probabilidade.</p><p>Assim, desenvolvi um <a href="https://github.com/edsoncezar16/par_ou_impar"><em>projeto</em></a> cujo objetivo foi usar a minha experiência acadêmica, com forte ênfase em raciocínio analítico e domínio dos conceitos fundamentais da estatística, e minhas habilidades de programação com a linguagem Python para contribuir com a melhoria da qualidade do raciocínio probabilístico na comunidade de Ciência de Dados, ou mesmo do público geral.</p><h3><strong>Resultados</strong></h3><p>Os principais resultados obtidos foram:</p><ul><li><strong>Demonstração de que, considerando o jogo “clássico” de par ou ímpar, onde cada jogador coloca apenas uma mão, isto é, seleciona um número inteiro entre 0 e 5, a probabilidade de o resultado ser par ou ímpar é de 50% cada.</strong></li></ul><p>Esta demonstração se baseia na definição de probabilidade, isto é, fazendo a enumeração de todos os resultados possíveis (espaço amostral) e definindo um evento favorável (por exemplo, “soma das mãos deu ímpar”). Então, a probabilidade do evento favorável seria a proporção entre os eventos favoráveis e os eventos totais.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/97/1*tmCBWvb-bL7SrT82UC10Nw.png" /><figcaption>Tabela contendo uma enumeração de todos os eventos do jogo de par ou ímpar descrito no problema.</figcaption></figure><p>Neste caso, onde é factível fazer a contagem dos eventos, podemos facilmente obter que o número de eventos favoráveis (ímpar) é 18, o que leva a Prob(ímpar) = 18/36 = 50%.</p><ul><li><strong>Refutação do seguinte argumento: “Cada jogador escolhe um número, que pode ser par ou ímpar. Como par + par = par, ímpar + ímpar = par e par + ímpar = ímpar, há mais possibilidades onde o resultado final é par.”</strong></li></ul><p>Notamos aqui que há uma tentativa similar à anterior, de contar os eventos possíveis e, neste caso, perceber que o evento “par” possui mais eventos no espaço amostral do que o evento ímpar. Entretanto, este raciocínio falha pois a maneira com que os eventos são divididos neste caso não possuem a mesma cardinalidade, como acontecia no caso anterior onde foi enumerada cada possibilidade de valores das duas mãos de cada jogador.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*pWQwF4ENGAeR4AgJJZelbw.png" /><figcaption>Distribuição dos possíveis resultados em eventos do tipo 0 (cada jogador joga um número par), tipo 1 (um jogador joga um número par e o outro joga um número ímpar) e tipo 2 (cada jogador joga um número ímpar).</figcaption></figure><p>O gráfico acima nos mostra que, de fato, embora haja dois “tipos” de evento favoráveis ao resultado par e apenas um “tipo” favorável ao resultado ímpar, a cardinalidade deste último (e consequentemente sua probabilidade de ocorrência) é o dobro da cardinalidade dos dois anteriores, de modo que ao somarmos as probabilidade de cada tipo de evento e associarmos aos resultados correspondentes obteremos a probabilidade de 50% para cada um, como demonstrado anteriormente.</p><ul><li><strong>Refutação do seguinte argumento: “Após somar as mãos dos jogadores, há 6 resultados pares possíveis (0, 2, 4, 6, 8, 10) e apenas 5 ímpares (1, 3, 5, 7, 9). Logo, quem escolhe par tem mais chances de ganhar.”</strong></li></ul><p>Novamente o problema consiste em contar os eventos possíveis, perceber que o evento “par” possui mais eventos no espaço amostral do que o evento ímpar, mas sem notar que a maneira com que os eventos são divididos não possuem a mesma cardinalidade.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*Yk6YJV-I1Y6eDnstNLAQ9Q.png" /><figcaption>Distribuição dos possíveis resultados pelo valor da soma das mãos dos jogadores.</figcaption></figure><p>O gráfico acima nos mostra que, de fato, embora haja seis valores de soma das mãos favoráveis ao resultado par e cinco favoráveis ao resultado ímpar, quando levamos em conta as cardinalidades (e, consequentemente, a probabilidade) dessas somas, obteremos a probabilidade de 50% para par e 50% para ímpar, como se segue:</p><p>Prob(par) = Prob(soma = 0) + Prob(soma = 2) + Prob(soma = 4) + Prob(soma = 6) + Prob(soma = 8) + Prob(soma = 10) = 2,78% + 8,33% + 13,89% + 13,89% + 8,33% + 2,78% = 50%.</p><h3><strong>Conclusão</strong></h3><p>O conceito de probabilidade, que pode se dizer que seja um dos mais fundamentais da estatística, envolve sutilezas que podem se manifestar mesmo em aplicações consideradas triviais à primeira vista, como o exemplo do jogo de par ou ímpar.</p><p>Neste artigo, discutimos como certos argumentos probabilísticos empregados no contexto do par ou ímpar, usados mesmo por alguns profissionais e estudantes da área de Ciência de Dados, podem parecer bem embasados mas, quando analisados à luz da definição de probabilidade, na verdade são equivocados.</p><p>Assim, espero que esta discussão contribua para um melhor entendimento dos conceitos fundamentais da estatística tanto para pessoas relacionadas com aárea de Ciência de Dados ou mesmo do público em geral.</p><h3>Comentários Finais</h3><p>Os gráficos e a tabela utilizados neste texto, bem como mais detalhes sobre os cálculos e o desenvolvimento podem ser encontrados no <a href="https://github.com/edsoncezar16/par_ou_impar"><em>repositório</em></a><em> </em>associado ao projeto no qual este artigo foi baseado como uma descrição estendida.</p><p>Obrigado a você que leu o artigo até aqui. Esta foi a minha primeira publicação no Medium, então quaisquer críticas construtivas são muito bem vindas para que eu melhore nas próximas.</p><p>Espero que este artigo tenha contribuído para sua formação, seja através de um conhecimento novo ou uma leitura agradável sobre algo que você já conhecia mas não com a mesma perspectiva. Abraços e tudo de bom!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a6d95811b40" width="1" height="1" alt=""><hr><p><a href="https://medium.com/suzano-digitaltech/par-ou-%C3%ADmpar-aplicando-o-racioc%C3%ADnio-probabil%C3%ADstico-de-maneira-consistente-1a6d95811b40">Par ou ímpar? Aplicando o raciocínio probabilístico de maneira consistente.</a> was originally published in <a href="https://medium.com/suzano-digitaltech">Suzano DigitalTech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>