<?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"><channel><title><![CDATA[Poolbeg Data Stacks]]></title><description><![CDATA[Ernesto Ongaro is a data professional with over 15 years of experience. He has held various roles in data analysis, warehousing and product marketing. Currently]]></description><link>https://poolbeg.co</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1672244468257/J_KBlUS9t.png</url><title>Poolbeg Data Stacks</title><link>https://poolbeg.co</link></image><generator>RSS for Node</generator><lastBuildDate>Fri, 15 May 2026 06:12:00 GMT</lastBuildDate><atom:link href="https://poolbeg.co/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Last of Dying Breeds]]></title><description><![CDATA[The picture above is of my Omega mechanical watch that I purchased for my wedding in 2016. It was handcrafted by a Swiss watchmaker in Biel/Bienne in 1969. The area is known as Watch Valley, where all Patek Philippe, Rolex, TAG Heuer, and many other ...]]></description><link>https://poolbeg.co/last-of-dying-breeds</link><guid isPermaLink="true">https://poolbeg.co/last-of-dying-breeds</guid><category><![CDATA[watches]]></category><category><![CDATA[llm]]></category><category><![CDATA[omega]]></category><dc:creator><![CDATA[Ernesto]]></dc:creator><pubDate>Sun, 23 Jul 2023 21:59:13 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1690148959757/2bde1bd4-29cc-426a-8601-6828ecdcc3bc.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The picture above is of my <a target="_blank" href="https://www.omegawatches.com/en-us/watch-omega-geneve-omega-st-135-0070">Omega</a> mechanical watch that I purchased for my wedding in 2016. It was handcrafted by a Swiss watchmaker in Biel/Bienne in 1969. The area is known as <a target="_blank" href="https://en.wikipedia.org/wiki/Watch_Valley">Watch Valley</a>, where all Patek Philippe, Rolex, TAG Heuer, and many other fine Swiss brands have manufactured their watches since the 1700s. A watchmaker would go through years of apprenticeship, journeymanship, and finally mastery of their trade.</p>
<p>I loved the watch as soon as I wore it for the first time, and started to love it even more when I started reading about traditional watchmaking, and the love, skill and craftsmanship that went into making these timepieces. The year 1969 was special. Not only did we land on the moon that year (on which Neil Armstrong wore an <a target="_blank" href="https://airandspace.si.edu/collection-objects/chronograph-armstrong-apollo-11/nasm_A19731247000">Omega Speedmaster</a>), but also it was the year that the Japanese watchmaker Seiko introduced the Quartz watch.</p>
<p>Electronic quartz watches were and are superior to mechanical watches from a precision, manufacturing and operation perspective. You don't need to wind them or move with them and they keep much more precise time (mechanical watches lose ~10 seconds per day, quartz lose ~1 second a year). They are much cheaper to manufacture to scale.</p>
<p>The writing was on the wall for traditional mechanical watches. Watch Valley was in trouble, sales of traditional watches dropped very quickly in the late 70s and 80s and many skilled artisans lost their jobs. Of course, it wasn't just quartz, the Swiss watchmaking industry had also become stagnant, overproduced and the Franc was expensive to export.</p>
<blockquote>
<p>between 1970 and 1985 Swiss watch employment fell from over 90 thousand to 30 thousand employees<br />-Federation of the Swiss watch industry (FH)</p>
</blockquote>
<p>So this is why I treasure my 1969 Omega watch, it represents the end of an era, the last of dying breeds. Over the weekend I listened to Yuval Noah Harari <a target="_blank" href="https://lexfridman.com/yuval-noah-harari/">interviewed</a> by Lex Fridman (warning it's 2 hours and 52 minutes long, nearly as long as <a target="_blank" href="https://www.imdb.com/title/tt15398776/">Oppenheimer</a>!). As it's 2023, of course, AI was discussed and Fridman commented:</p>
<blockquote>
<p>And you very well could be one of the last historians, human historians to have ever lived.</p>
</blockquote>
<p>Harari accepted that this very well could be true, that already the power of LLMs/AI shows that the days of the historian, may too be numbered. The brilliant mind of a craftsman like Harari, who spends two hours every day in silent meditation and has written some of my favorite books (like <a target="_blank" href="https://www.ynharari.com/book/homo-deus/">Homo Deus</a>) may soon be obsolete.</p>
<p>Yet, history takes unexpected turns. The Swiss watch industry has made a healthy recovery, there's even a <a target="_blank" href="https://www.nytimes.com/2023/03/26/fashion/watches-workforce-switzerland.html">shortage</a> of watchmakers. It turned out that people do not care about the accuracy of timekeeping, we care about the craftsmanship, the brands, and the legacy. Of course, we can't compare luxury goods to philosophical topics like history. It gives me hope that AI will not replace all forms of craftsmanship and that we will continue to value the skills and creativity of human craftsmanship.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690149111881/3d66414e-41a5-4edd-a109-90d0dcad87a6.jpeg" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Treat Your Tables Like Cattle, Not Pets]]></title><description><![CDATA[In 2006 when I first started working with servers, the company I worked at gave our private cloud infrastructure iconic, powerful, Greek-inspired names like Athena and Archimedes.
These machines ran for years, and I was in charge of maintaining them....]]></description><link>https://poolbeg.co/treat-your-tables-like-cattle-not-pets</link><guid isPermaLink="true">https://poolbeg.co/treat-your-tables-like-cattle-not-pets</guid><category><![CDATA[dbt]]></category><category><![CDATA[data]]></category><category><![CDATA[Devops]]></category><dc:creator><![CDATA[Ernesto]]></dc:creator><pubDate>Wed, 15 Feb 2023 07:17:13 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/YBPlELmdJAI/upload/36638e5a609cff81f3c6f4846109a802.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In 2006 when I first started working with servers, the company I worked at gave our private cloud infrastructure iconic, powerful, Greek-inspired names like Athena and Archimedes.</p>
<p>These machines ran for years, and I was in charge of maintaining them. They rarely got rebooted and it was really hard to remember exactly what configuration had been applied. I had nightmares about one of these long-lived things having a catastrophic failure. How quickly would I be able to rebuild it from scratch?</p>
<p>The problem started when we had multiple people with admin access making changes. This eventually led to an incident where a public port of our telephony system (<a target="_blank" href="https://en.wikipedia.org/wiki/Asterisk_(PBX)">Asterisk</a>) was accidentally exposed and hackers made thousands of dollars worth of phone calls from China to Cuba. Oops. How could this incident be prevented in the future? It seems that our pet strategy wasn't working.</p>
<p>Around 2012, Randy Bias started the whole pets vs. cattle <a target="_blank" href="http://cloudscaling.com/blog/cloud-computing/the-history-of-pets-vs-cattle/">thing</a> as a way of describing the difference between how on-premise stacks vs cloud stacks should be managed. Ultimately the disposability of servers is the key difference in management styles. The analogy isn't very vegan-friendly but it does hold.</p>
<p>My experience working with cloud databases for the last decade or so has taught me that cloud database objects should also be treated as disposable.</p>
<h2 id="heading-why-you-should-throw-your-tables-away">Why you should throw your tables* away...</h2>
<p><em>\</em>This applies to any object that is configured in your data store: databases, tables, views, users, roles, grants, really anything.*</p>
<p>My philosophy here is that one-off configuration changes are fast to make but become costly over time. For example; creating a table and then applying a <code>grant</code> statement means that the next person that creates that table has to remember to add the same statement and any statements applied after. This is compounded in large multi-admin systems when the configuration is constantly changed. Take this series of events and configuration changes:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1672436238063/ef3d63e8-4bd5-4499-a651-46d07f3eb725.png" alt class="image--center mx-auto" /></p>
<p>When you have 100s of tables to manage, and dozens of users the problem starts to emerge. Here's what happens when you treat your data objects like pets:</p>
<ul>
<li><p><strong>The configuration will change over time, especially with many developers, causing errors and confusion.</strong></p>
</li>
<li><p><strong>You need to provision too much access to users, causing insecurity.</strong></p>
</li>
<li><p><strong>You will end up with things you didn't intend to, creating errors.</strong></p>
</li>
<li><p><strong>It's difficult to roll back changes or audit them, causing instability.</strong></p>
</li>
<li><p><strong>It would take you hours or days to restore things, causing downtime.</strong></p>
</li>
</ul>
<p>All of this means after some time with a complex system you will have security, stability, confusion and generally a hard-to-operate system. You'll be back where I was in 2006!</p>
<h2 id="heading-treating-tables-like-cattle">Treating Tables like Cattle</h2>
<blockquote>
<p>My experience working with cloud databases for the last decade has taught me that cloud database objects should also be treated as disposable</p>
</blockquote>
<p>The idea is simple. Instead of applying configuration slowly over time, and expecting database objects to be long-lived; we apply configuration at build time and rebuild everything often. This means treating them as disposable and rebuilding them often, rather than making slow, incremental changes over time. By doing this, you can ensure that your database objects are consistently configured and avoid the problems that come with multiple people making changes to them.</p>
<p><strong>The first step in this journey is to abstract configuration away from business logic.</strong> Business logic is usually expressed in a <code>SELECT</code> statement that might look like this</p>
<pre><code class="lang-sql">case when
 status = 'shipped' and
 return_flag is not true and
 payment_status = final
then 'settled' else 'active'
<span class="hljs-keyword">end</span>
</code></pre>
<p>While configuration is things like this <code>CREATE TABLE</code> or <code>GRANT</code></p>
<p>One way to think about it is to break down the <a target="_blank" href="https://www.geeksforgeeks.org/sql-ddl-dql-dml-dcl-tcl-commands/">sublanguages</a> of SQL and group them into <em>logic</em> and <em>configuration:</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1672442223339/c9a6bc30-f338-4b38-b0b1-ca9d73d5e386.png" alt class="image--center mx-auto" /></p>
<p>It's a simplistic bifurcation, one I'll explore in a future post.</p>
<h3 id="heading-enter-dbttm">Enter dbt™</h3>
<p>My current employer has built dbt and dbt Cloud to help developers build, test, and maintain their data infrastructure. It allows users to define their data transformations and models in code, rather than as messy SQL statements or impossible-to-version GUIs. This makes it easier to version control changes to the data infrastructure and to automate the process of building and testing data changes.</p>
<p>Overall, dbt simplifies the process of building and maintaining a data infrastructure, making it easier for developers to work with data and reducing the risk of errors and downtime. I may be a bit biased; but <a target="_blank" href="https://www.getdbt.com/dbt-labs/about-us/">I'm not alone</a>, the thing that feels magic to me about <a target="_blank" href="https://docs.getdbt.com/docs/about/overview">dbt</a> is that it lets you focus on <strong>logic, while configuration is done largely automatically under the hood.</strong> This makes it incredibly powerful.</p>
<p>Here are some of the ways legacy "pet" problems are overcome with the "cattle" approach:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Pet Farm Issue</td><td>The Cattle Approach</td><td>The dbt™ Way</td></tr>
</thead>
<tbody>
<tr>
<td><em>The configuration will change over time, especially with many developers</em></td><td>Configuration is stored in a file, which is version controlled.</td><td><a target="_blank" href="https://docs.getdbt.com/reference/model-configs">Configuration</a> is largely done in <code>dbt_project.yml</code></td></tr>
<tr>
<td><em>You need to provision too much access to users</em></td><td>Configuration is applied by an automated bot, not end-users.</td><td>The user running <code>dbt build</code> in production is elevated, developers aren't.</td></tr>
<tr>
<td><em>You will end up with things you didn't intend to</em></td><td>Configuration is easier to audit if it's in one place</td><td>Changes are tested, reviewed by analytics engineers and put into production by an orchestrator.</td></tr>
<tr>
<td><em>It's difficult to roll back changes or audit them</em></td><td>Configuration is stored in a file, vs piecemeal over time.</td><td>Every change is version controlled in git, every change is logged.</td></tr>
<tr>
<td><em>It would take you hours or days to restore things</em></td><td>Simply re-apply configuration and logic.</td><td>A single <code>dbt build</code> can build an entire warehouse, configuration and logic.</td></tr>
</tbody>
</table>
</div><p>In summary, to prevent configuration issues with your database objects, consider using a tool like dbt to manage them in code and follow the "cattle" approach by treating them as disposable. This will help you maintain a stable and secure system that is easy to scale.</p>
<p>To get started, quantify the problems that your "pet" approach is causing; is there evidence for outages caused? additional tickets created? difficult to hire senior staff? This helps build a strong <strong>why</strong> for change.</p>
<p><em>Footnotes:</em></p>
<p><em>¹Not all database objects are available via dbt natively today; some folks use scripts like</em> <a target="_blank" href="https://github.com/randypitcherii/dbt_workspace/blob/production/dbt/macros/snowflake_utils/workspace_setup/get_workspace_setup_script.sql"><em>these</em></a> <em>run via a</em> <a target="_blank" href="https://docs.getdbt.com/reference/commands/run-operation"><em>run-operation</em></a><em>, whilst others would opt for another declarative tool like</em> <a target="_blank" href="https://github.com/Snowflake-Labs/terraform-provider-snowflake"><em>Terraform</em></a> <em>to manage closer-to-infrastructure objects like databases.</em></p>
]]></content:encoded></item></channel></rss>