<?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 Bruno Schroeder on Medium]]></title>
        <description><![CDATA[Stories by Bruno Schroeder on Medium]]></description>
        <link>https://medium.com/@bruno-schroeder?source=rss-6a49b800612f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*TsN-VCrajtWUTdUeuEA9eA.jpeg</url>
            <title>Stories by Bruno Schroeder on Medium</title>
            <link>https://medium.com/@bruno-schroeder?source=rss-6a49b800612f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 03:51:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bruno-schroeder/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[DuckDB introduction and possible use cases]]></title>
            <link>https://bruno-schroeder.medium.com/duckdb-introduction-and-possible-use-cases-4829edd60888?source=rss-6a49b800612f------2</link>
            <guid isPermaLink="false">https://medium.com/p/4829edd60888</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-engineer]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Bruno Schroeder]]></dc:creator>
            <pubDate>Wed, 27 Mar 2024 21:56:48 GMT</pubDate>
            <atom:updated>2024-03-27T21:56:48.383Z</atom:updated>
            <content:encoded><![CDATA[<p>In the last few weeks, one new (actually a not-so-new) buzzword came up on my LinkedIn: <strong>DuckDB</strong>. At first, I thought “Ok, someone created a new open-source MySQL-based database”, I couldn&#39;t be any wronger.</p><p>After some tests locally I was able to see the potential of this amazing tool and think about some using cases on my daily work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ljuahYDvlP4MVfyofObMrg.jpeg" /></figure><h4>What is DuckDB?</h4><p>Before diving into the use cases, let&#39;s hear from the creators:</p><blockquote>DuckDB is <strong>a fast in-process analytical database</strong>. DuckDB supports a feature-rich SQL dialect complemented with deep integrations into client APIs.</blockquote><p>Don’t stick with the word “database”, DuckDB can be much more. In my case, I used it to replace Pandas (anywhere near a database). The tool can also be specified as a tool for data modeling, data analysis, etc.</p><h4>Installation</h4><p>When talking about setting up a database locally we always think that we will have to run an executable file or maybe run a Docker container. However, as I mentioned, I used it to replace Pandas, so to run DuckDB on top of Python is just simple as:</p><pre>pip install duckdb</pre><h4>Basic data exploring example</h4><p>Imagine that you need to explore a 600MB CSV file, what would be your first option? Maybe Excel, but it may not load the file. Pandas? Yes, but what about “Out of Memory” issues?</p><p>Another option would be to load it into a PySpark cluster on Databricks or locally on Docker, but you need to have the infrastructure for it.</p><p>That&#39;s when DuckDB comes in. Using this <a href="https://excelbianalytics.com/wp/wp-content/uploads/2020/09/5m-Sales-Records.zip">file</a>, the tool can read it and run a group-by query almost instantly!</p><pre>import duckdb<br><br>duckdb.sql(<br>    &#39;&#39;&#39;<br>    SELECT<br>        region,<br>        sum(total_profit)<br>    FROM read_csv(&#39;5m Sales Records.csv&#39;, normalize_names=True)<br>    GROUP BY ALL<br>    &#39;&#39;&#39;<br>).show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*qXVDAKfupBMIRJosUTkHLA.png" /></figure><p>After some tests and reading, there are some possible use cases to use daily.</p><h4>Data exploring</h4><p>As mentioned above, the tool can easily handle a big CSV file. This can facilitate your daily basis to explore the files that you received from your stakeholders with sales from the last 10 years.</p><p>Another factor is the use of SQL to query the data. I am not gonna lie, I am not the best Excel person (far from that actually). Being able to use SQL on any CSV or Excel is a big game-changer for me.</p><p><em>Note: DuckDB can also read Parquet and JSON files</em></p><h4>Data validation</h4><p>BigQuery is the main data platform at my current job. When ingesting a new source, we need to validate if everything is fine when compared to a spreadsheet.</p><p>Those validations are usually a manual job using Excel to compare if every ID is available on BigQuery, if the values are correct, if dates are matching, etc.</p><p>On my next validation, I plan to use DuckDB, how? I will export my BigQuery data as CSV, load both the BQ export and validation spreadsheet into DuckDB, and compare them using a simple JOIN.</p><h4>Replace a data modeling job</h4><p>As mentioned above, BigQuery is the main data platform that I use. For those who are not familiar with the tool, it charges you based on the number of bytes processed. This can be a two-edge knife, it is a really fast tool for large sets of data, but a high cost as well.</p><p>All of our data is ingested on GCS, so BigQuery reads it as an external table, does a QUALIFY with the ROW_NUMBER function to avoid duplicity, and saves it to a staging table.</p><p>I tested DuckDB to replicate this exact process for one specific staging table. BigQuery took almost 2 minutes to finish, and DuckDB took 7 minutes.</p><p>What is the gain? Processing cost, BigQuery would charge us based on the data volumetry, DuckDB cost would be the Virtual Machine 7 minutes cost running on a cloud provider (Much cheaper)</p><h4>Wrapping up</h4><p>DuckDB can be a facilitator for data professionals when dealing with datasets locally. The SQL use is the main advantage and can save you a lot of time. I wish to use it more in my current work to understand better the pros and cons when dealing with production daily data.</p><p>I still have some doubts about its use as a database. I didn’t mention it, but you can (as expected by the definition “analytical database”) save the data on tables, export your database so others can use it, etc. I don’t know what the infrastructure size necessary to run it, but it has a lot of potential regarding query performance.</p><p>Did you use DuckDB already? Let me know!</p><p><a href="https://duckdb.org/docs/">DuckDB official docs</a></p><p><em>All tests were done using a Macbook Air M2 8GB</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4829edd60888" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Some thoughts after 1 year of creating Airbyte custom connectors]]></title>
            <link>https://bruno-schroeder.medium.com/some-thoughts-after-1-year-of-creating-airbyte-custom-connectors-a2078095861a?source=rss-6a49b800612f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2078095861a</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[airbyte]]></category>
            <category><![CDATA[data-engineer]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Bruno Schroeder]]></dc:creator>
            <pubDate>Mon, 19 Feb 2024 20:41:30 GMT</pubDate>
            <atom:updated>2024-02-20T12:52:13.019Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JdWfwP0-kK2-h1Z6i79CLw.jpeg" /></figure><p>The current company that I am part of acquires e-commerce brands, which means that each brand has its own management system, sometimes they sell on a not well-known marketplace, but in most of the cases we have an API available to ingest their data and consolidate it on our Data Lake.</p><p>So we need to have a solution that may (and probably won&#39;t) have a connector ready for us to use or has an easy way to create new and standardized ingestion processes, that’s when our friend Airbyte comes in place. (Thanks to our former Data Engineer manager!)</p><p>The tool became our main ingestion tool and over a year span, we created over 20 custom connectors. This was enabled by its user-friendly CDK which makes our job much easier, avoiding Taylor-made scripts that are not reusable.</p><p>After spending this period focused on ingesting data through it, there are some thoughts that I want to share about developing custom connectors on Airbyte.</p><h4>A true love, but not at first sight</h4><p>I remember pretty well the day that I had the first contact with an Airbyte’s connector code. My boss asked me to take a look at why one of the official connectors was throwing errors. I had a pretty hard time and he helped me understand what was going on (If you are reading this, thank you <a href="https://www.linkedin.com/in/felipetancredo/">Felipe Tancredo</a>).</p><p>One month later I was asked to create a custom connector from scratch, you can imagine how I felt. So I started searching for learning resources. Bad news, I just found one, good news, it’s great! I am talking about the <a href="https://docs.airbyte.com/connector-development/tutorials/cdk-tutorial-python-http/getting-started">official tutorial</a>.</p><p>After some (expected) struggles, I finished the first production version in about 1–2 weeks, which is a lot thinking about a code ingesting a simple API with a date interval and page parameters.</p><p>Since this connector, I created more than 10 ingestions using Airbyte, after each time it became faster, I would say that today it takes less than 5 days to finish a connector (disconsidering task discovery time). In the last month, for example, I translated a Taylor-made script to Airbyte pattern in less than 2 hours. I couldn’t imagine this happening when thinking about my first impression.</p><h4>Standardization leads to an easy maintenance</h4><p>Not gonna lie, sometimes takes more time to create an Object Oriented script following all Airbyte CDK requirements than a simple Python vanilla script. However, those requirements enable a high level of standardization even for a fast-growing data environment.</p><p>Imagine this scenario, you work for a company that has 30 API sources, and each one has its own script that might be running on a container, VM, or even on someone’s machine. What is the probability that all those scripts are using the same variable names, methods, and credentials management? I would say pretty low. Now imagine you need to do some maintenance on one of these scripts because its creator is on vacation hanging out with Mickey at a Disney park, how would you know how to test, how the script works, and where is it running, I bet you won’t call him (Please don&#39;t).</p><p>That’s when standardization becomes a factor. Airbyte forces you to define the same methods and configuration files, and has a single way to run it on your computer to test. Basically, an Airbyte API connector will not be so different when compared to another one of the same type (API).</p><p>On my last vacation I just had to explain to my partner some corner API cases, not how the code works, because it will always be almost the same! (Yes, I was at Disney).</p><h4>Before building a connector, understand the API you must</h4><p>It may sound obvious but I think this is always good advice. As mentioned earlier, building the connectors becomes faster each time, but this can lead to mistakes that could be avoided with a deep discovery.</p><p>This happened to one of my latest connectors. The scenario was simple, an API that had an orders endpoint that receives a date interval and a page parameter. What did I think? Okay, my connector will receive a start date parameter, I will call the API with an interval starting from that date to today, increasing the page number until I don’t have any data to ingest.</p><p>It worked, until the need to ingest more historical data. I triggered the code on Airbyte with the start date of January 1st, 2023. On the day after I checked the minimum order date ingested was from August, not January.</p><p>After digging into the API, I noticed that it returned the data in reversed chronological order, and after a certain number of pages, it started throwing errors. The solution? Divide the ingestion using Airbyte’s stream slices, which I used other custom connectors as the base (Standirlization once again!).</p><p>This not only worked but the whole historical ingestion reduced from 2 hours (with errors) to less than 40 minutes. The error could have been avoided if I tested a high page number, or maybe paid more attention to the reverse chronological order.</p><h4>Airbyte won’t be perfect for all solutions</h4><p>Yes, we still have ingestions that are not done on Airbyte. This is due to a lot of factors, such as infrastructure limitations (like APIs), sources that are not APIs or Databases, etc.</p><p>The main point on our environment is: Whenever possible, Airbyte will always be our first option. We understand that even with its flaws (topic for another article), it is our best solution.</p><p>If we can’t fit the tool in one scenario it is completely fine, we just need to make sure that the whole team is familiar with this different kind of process.</p><h4>Conclusion</h4><p>It may seem that I am biased towards the tool (maybe I am), but I really think that its connector development is one of the best in the market. Airbyte is not a perfect tool, it has flaws and will not suit all scenarios. However, in my experience, our maintenance time decreased with an increase in code quality since we adopted it as our main ingestion tool.</p><p><em>Questions, suggestions, discussions? Let me know!</em></p><h4>Useful links</h4><p><a href="https://docs.airbyte.com/connector-development/tutorials/cdk-tutorial-python-http/getting-started">Creating HTTP API Source on Airbyte</a></p><p><a href="https://docs.airbyte.com/">Airbyte Official Docs</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2078095861a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>