<?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 Ricardo Souza on Medium]]></title>
        <description><![CDATA[Stories by Ricardo Souza on Medium]]></description>
        <link>https://medium.com/@ricardo.atsouza?source=rss-1b454eecda63------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xowt8kQ9aALDKrLfsDxbnw.jpeg</url>
            <title>Stories by Ricardo Souza on Medium</title>
            <link>https://medium.com/@ricardo.atsouza?source=rss-1b454eecda63------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 13:26:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ricardo.atsouza/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[ETL Diaries: Moving away from Legacy Pipelines with a Custom Data Framework]]></title>
            <link>https://medium.com/dev-jam/etl-diaries-moving-away-from-legacy-pipelines-with-a-custom-data-framework-111c7b37e5b9?source=rss-1b454eecda63------2</link>
            <guid isPermaLink="false">https://medium.com/p/111c7b37e5b9</guid>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[batch-processing]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[etl]]></category>
            <dc:creator><![CDATA[Ricardo Souza]]></dc:creator>
            <pubDate>Tue, 01 Dec 2026 08:39:50 GMT</pubDate>
            <atom:updated>2026-12-01T08:39:50.952Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tuP0yqGXCK3zg0RNuaK4DA.png" /></figure><p><em>Even though we might hold strong opinions on how exactly an ETL should be built, we all agree on its basic premise: extract, transform, and load (or, in case of a ELT, extract, load, then transform). However, for reasons ranging from inexperience to restrictive company decisions, simple data movement can become incredibly cumbersome.</em></p><h3>A very dire landscape</h3><p>Few days after joining a data team in one of my previous roles, I was tasked to investigate and solve a few bugs in our data pipelines. At first sight, the data in a small group of tables were not up to date, affecting some dashboards and reports. At first, it sounded like a simple problem.</p><p>Not long after starting to dig, it was clear that those tables were outdated by <strong>3 to 6 months</strong>. At this point, one might wonder how no one ever noticed. After looking further, I got to know that the current ETL scripts are being executed in an single EC2 instance. Logs? Only the ones from last execution. Where? Stored in said EC2 instance. Process monitoring? “ehh… sorry?”</p><p>While the code was at least in (cough cough) BitBucket, the deployments were done manually by copying the files via `scp`. So, my task <em>actually </em>was:</p><ul><li>to fix the bash code;</li><li>get an approved review and merge;</li><li><em>manually</em> copy the files via `scp`;</li><li>check the schedule in the cronjob, and</li><li>double-check the secrets that (manually added as environment variables)</li></ul><p>It was a beautiful setup!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*qKdIdnSAlDGULxtGEoAaog.png" /></figure><p>This was not fun <em>at all</em>, but there were <strong>a lot</strong> of opportunity to improve things. The slightly challenging part was to convince management that something had to change.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*0Z3tXWNgIll_AcKwfVRJCA.png" /></figure><h3>Solutions?</h3><p>Just because ETLs are simple, that doesn’t mean it is simply a matter of executing a script somewhere. As just like any software, it can become very complicated very fast:</p><ul><li>How to find the necessary logs to solve a problem?</li><li>How to <em>easily</em> execute failed runs?</li><li>How to guarantee <em>idempotency</em>?</li><li>How to load big data sets?</li><li>How to partition the data?</li><li>How to get an alert in case something fails?</li><li>The list goes on and on…</li></ul><p>It is not a surprise that there are a few companies specialized in ETL, such as <a href="https://www.stitchdata.com/">Stitch</a> and <a href="https://airbyte.com/">AirByte</a>. There are also open source solutions, such as <a href="https://www.singer.io/">Singer taps</a>.</p><p>The problem we often had with third party solutions was that they were limited in a few aspects. Observability, for example, was not something easily provided out of the box. Support in case of failures was often not efficient and frustrating. Fixes to on-going problems, slow. And of course, any customization towards our business was simply off the table (disclaimer: these experiences are from a few years back; current third-party solutions may have improved since then).</p><p>To us, then, the solution had to come from within.</p><h3>In-house solution</h3><p>After weeks of evaluations, management ultimately decided that at first a third party would be used for ETLs. The problem though is that not all integrations were supported and those would yet require custom code. For those integrations, an in-house solution would be developed — and there were a considerable number of them.</p><p>For those, singer taps were out of question to me. That was another headache that I didn’t wanna get into: outdated code and often poorly programmed. My idea was to implement something more robust.</p><p>At this moment I started developing a more permanent solution on the side — what we simply called “Data Framework”. A framework that would handle (almost)<strong> everything</strong> that is ETL related. It would:</p><ul><li>simplify the development of custom-made integrations</li><li>define standard arguments for inputs and outputs</li><li>publish functional and non-functional metrics on every execution</li><li>contain additional libraries for database connection, configurations, logging, secret handling and network.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*T1N1XHqumBynlDkOfJJjSw.png" /></figure><p>All the different modules were under a library — the Data Library. Each module <em>can</em> be used separately if desired. The idea, though, was for each ETL to create a class inheriting from Data Framework, which will orchestrate the execution and usage of all other different modules.</p><p>Roughly, this is how the <strong>Framework</strong> class looks like:</p><pre>import configuration as config<br><br>class DataFramework:<br>    def __init__(self) -&gt; None:<br>        load_configuration_from_file()<br>        create_metrics()<br><br>        self.job_id = uuid.uuid4()<br><br>    def date_from(self) -&gt; str:<br>        # Defaults to yesterday&#39;s date<br>        return self.__arguments.date_from<br><br>    def date_to(self) -&gt; str:<br>        # Defaults to today&#39;s date<br>        return self.__arguments.date_to<br><br>    def run(self) -&gt; None:<br>        start_time = int(time.time())<br>        try:<br>            self.main()<br><br>            records_loaded = self.metric_records_loaded()<br>            records_saved = self.metric_records_saved()<br>            records_failed = self.metric_records_failed()<br>        except Exception as e:<br>            logging.error(e)<br>            raise e<br>        finally:<br>            end_time = int(time.time())<br>            observe_execution_time(end_time - start_time)</pre><p>There are many more details to it, but the above implementation covers the idea. That is:</p><ol><li>The `__init__` method loads configuration, create metrics and assign a job id for this execution;</li><li>The `run` method calls the `main` method (which is later overwritten by a subclass).</li><li>When it finished, gather a certain number of metrics.</li><li>On failure, logs and raises.</li><li>At the end, observe the execution time.</li></ol><p>The ETLs themselves were defined as a subclass of DataFramework. Then, with CI/CD, each ETL would be containerized with <a href="https://www.docker.com/">Docker</a> and executed later. Therefore, defining an ETL then became as simple as:</p><pre>class EtlExample(DataFramework):<br>    def main(self) -&gt; None:<br>        # Gather data<br>        # Transform<br>        # Send to database<br><br>if __name__ == &quot;__main__&quot;:<br>    EtlExample().run()</pre><p>From here, the framework handles all the boilerplate. In the example below, the class “GetDataETL” grabs data from a specific URL, runs through the pagination and saves each collection of items into a database. This is clearly not a complete example, but gives you an idea of how it works.</p><pre>class GetDataETL(DataFramework):<br>    def main(self) -&gt; None:<br>        with postgres.connect() as conn:<br>            for page in self.extract_data_from_endpoint(<br>                date_from=self.date_from(),<br>                date_to=self.date_to(),<br>            ):<br>                conn.insert_data(&quot;target_table&quot;, page)<br><br>    def extract_data_from_endpoint(<br>        self, date_from: str, date_to: str<br>    ) -&gt; Generator[list[dict], None, None]:<br>        page = 0<br>        while True:<br>            response = http.get(<br>                _URL.format(<br>                    datefrom=date_from,<br>                    dateto=date_to,<br>                    page=page,<br>                )<br>            )<br>            response.raise_for_status()<br><br>            if not response.text:<br>                return<br><br>            yield json.loads(response.text)<br>            page += 1</pre><p>It is worth noticing: there is nothing <em>particularly</em> novel here. This solution was to simply combining concepts established years ago — such as frameworks, polymorphism and inheritance — in a smart way, in order to meet business requirements while yet adhering to good engineering practices.</p><h3>How did it evolve?</h3><p>Once we deployed our first ETLs using this framework, the pain instantly vanished. CI/CD was running smoothly, containers were executed in Fargate and orchestrated with Apache Airflow. Logs were all captured and kept, metrics were being captured by our old friend Prometheus, alerts were created in Grafana and, from then on, management was convinced that this was the way to go. Later we had many more custom ETLs being built and we were able to reliably put an on-call rotation in place.</p><p>This framework also allowed the data setup to get better: we added data quality checks and SLAs to each individual pipeline.</p><p>As for me, I got the opportunity to lead the continuous development of the Data Framework. And, from the mess and pain that once was, none left. Now there was a mature framework, 90% covered with unit tests and good practices.</p><h3>Conclusive thoughts</h3><p>The journey was long, however the impact was positively felt across the data team and many others in the company. The whole process was now automatic, logs are accessible and retained, code is tested, deployments are automatic, stateless and (in most cases) idempotent. It was incredibly easy to run locally (for testing purposes) and you would get the same behavior when running in the cloud/ production environment.</p><p>Most of the ETL code was in a monorepo, being easy for developers to reference each other’s code. With format, linting, and typing tools, we also achieved an important level of readability, which also sped up development in general. Finally people from other teams were also able to collaborate. :)</p><p>The lessons that really pops out is a classic we have all heard before: it is incredibly easy to mess up something just because it looks simple, and while it can be very hard to stick to a more proper solution, it really pays off in the long run.</p><p>It is, though, sometimes yet surprising that, yet again, we face the same issues for the very same reasons.</p><h3>What about AI?</h3><p>We built this framework before generative AI became a daily engineering tool, yet its structure turns out to be ideal for AI-assisted development. LLMs thrive when given strict boundaries and clear patterns — and struggle when asked to wire up sprawling infrastructure from scratch. Because DataFramework encapsulates logging, secrets, metrics, and orchestration behind a single main() contract, an AI assistant only needs to generate focused extraction and transformation logic, while quality controls catch mistakes before deployment. Good software architecture doesn&#39;t just help human teammates collaborate; it creates the exact guardrails needed to use AI safely in production.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=111c7b37e5b9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dev-jam/etl-diaries-moving-away-from-legacy-pipelines-with-a-custom-data-framework-111c7b37e5b9">ETL Diaries: Moving away from Legacy Pipelines with a Custom Data Framework</a> was originally published in <a href="https://medium.com/dev-jam">Devjam</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>