<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Butch Landingin</title>
    <description>The latest articles on DEV Community by Butch Landingin (@butchland).</description>
    <link>https://dev.to/butchland</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F241598%2F864b6c7c-c443-4dee-a05c-f39c65fda286.jpeg</url>
      <title>DEV Community: Butch Landingin</title>
      <link>https://dev.to/butchland</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/butchland"/>
    <language>en</language>
    <item>
      <title>My Brush with Analytics Engineering</title>
      <dc:creator>Butch Landingin</dc:creator>
      <pubDate>Sat, 14 May 2022 09:05:32 +0000</pubDate>
      <link>https://dev.to/butchland/my-brush-with-analytics-engineering-34b5</link>
      <guid>https://dev.to/butchland/my-brush-with-analytics-engineering-34b5</guid>
      <description>&lt;p&gt;&lt;strong&gt;TLDR; dbt-cli + VS Code + &lt;a href="https://marketplace.visualstudio.com/search?term=dbt&amp;amp;target=VSCode&amp;amp;category=All%20categories&amp;amp;sortBy=Relevance"&gt;VS Code dbt-related extensions&lt;/a&gt; + &lt;a href="https://gitpod.io/workspaces"&gt;gitpod&lt;/a&gt; = &lt;a href="https://github.com/butchland/dbt-bigquery-gitpod-config/blob/main/quickstart.md"&gt;best online dbt development workflow&lt;/a&gt;!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--W868GB_D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/butchland/dbt-bigquery-gitpod-config/raw/main/images/term7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--W868GB_D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/butchland/dbt-bigquery-gitpod-config/raw/main/images/term7.png" alt="gitpod vscode editor with dbt" width="880" height="527"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;To give some background, I have been a longtime programmer, and have worked on all kinds of enterprise software systems for various verticals (aka Java enterprise systems). I have worked with all kinds of RDBMSes over the years (Oracle, MS SQL Server, Postgres, etc.) and while I am not a DBA, I considered myself somewhat proficient with SQL (including knowing how to use the native query optimizers and optimizing ORM queries).&lt;/p&gt;

&lt;p&gt;Boy oh boy, did I have a lot to learn when confronted with the &lt;em&gt;Modern Data Stack (MDS)&lt;/em&gt;!  Instead of an ad hoc, almost mystical process of building queries to visualize the data, now we had a clear template to create a pipeline of SQL data transformations from standardization, deduplication, materialization and joins and other steps that makes it easy to create dashboards and other visualization frontends. I also learned about CTEs (Common Table Expressions) that make SQL more maintainable and window functions that make it more powerful. I loved that part of the MDS development workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  10 Things I hate about...
&lt;/h2&gt;

&lt;p&gt;However, there were also some things I hated. One was having to use a &lt;a href="https://console.cloud.google.com/bigquery"&gt;web console to run queries&lt;/a&gt; (despite some cool stuff like query syntax validation and schema aware autocompletion). The other was not being able to use version control. The SQL queries were stored in an opaque storage location that was accessible only through the web console. Other stuff I didn't like was having to manually run queries to materialize views after updating the SQL and having to check the downstream views to see if they broke. &lt;/p&gt;

&lt;h2&gt;
  
  
  Towards a better workflow
&lt;/h2&gt;

&lt;p&gt;I know now that a lot of these issues could have been dealt with by &lt;a href="https://www.getdbt.com/"&gt;dbt&lt;/a&gt;, except for &lt;strong&gt;ONE&lt;/strong&gt;: having to use a web console to build and run queries - even &lt;strong&gt;dbt cloud&lt;/strong&gt; provides a &lt;a href="https://docs.getdbt.com/docs/dbt-cloud/cloud-ide/the-dbt-ide"&gt;web IDE&lt;/a&gt; which is a web console app to build and maintain SQL views and tables as well as run queries. &lt;/p&gt;

&lt;p&gt;Of course I also know about the &lt;a href="https://docs.getdbt.com/dbt-cli/cli-overview"&gt;dbt cli&lt;/a&gt; - I love &lt;em&gt;dbt cli&lt;/em&gt; (aka &lt;em&gt;dbt-core&lt;/em&gt;)!!! All I needed was a good editor - and right now, &lt;strong&gt;VS Code&lt;/strong&gt; is the &lt;em&gt;editor-du-jour&lt;/em&gt; for folks like me. So I was so happy to find some &lt;a href="https://marketplace.visualstudio.com/search?term=dbt&amp;amp;target=VSCode&amp;amp;category=All%20categories&amp;amp;sortBy=Relevance"&gt;VS Code extensions&lt;/a&gt; that made the dbt development workflow a joy for me -- specifically the &lt;a href="https://marketplace.visualstudio.com/items?itemName=innoverio.vscode-dbt-power-user"&gt;vscode-dbt-power-user extension&lt;/a&gt; which provides lots of cool stuff too long to mention, the &lt;a href="https://marketplace.visualstudio.com/items?itemName=bastienboutonnet.vscode-dbt"&gt;vscode-dbt extension&lt;/a&gt; which provides really useful dbt and sql snippets, and &lt;a href="https://marketplace.visualstudio.com/items?itemName=dorzey.vscode-sqlfluff"&gt;sqlfluff&lt;/a&gt; -- the sql formatter and linter. &lt;/p&gt;

&lt;h2&gt;
  
  
  Previewing SQL Results
&lt;/h2&gt;

&lt;p&gt;However, there was still one piece missing that would allow me to be weaned from any sql web console -- the ability to preview sql results. In the dbt cloud web IDE, this is known as &lt;a href="https://docs.getdbt.com/docs/dbt-cloud/cloud-ide/the-dbt-ide#compiling-and-running-sql"&gt;preview sql button&lt;/a&gt;. Whenever I used VS Code with the dbt cli, I still had to login to my cloud DWH web console and run the compiled queries in order to preview the results -- not a good developer experience IMHO.&lt;/p&gt;

&lt;h2&gt;
  
  
  VS Code, dbt, and BigQuery
&lt;/h2&gt;

&lt;p&gt;So I decided to built it myself and here it is: the &lt;a href="https://marketplace.visualstudio.com/items?itemName=butchland.vscode-dbt-bigquery-power-user"&gt;vscode-dbt-bigquery-power-user&lt;/a&gt; -- I know that's a mouthful, haha. It's a fork of the &lt;a href="https://marketplace.visualstudio.com/items?itemName=innoverio.vscode-dbt-power-user"&gt;vscode-dbt-power-user&lt;/a&gt; extension that adds a preview of the sql results (as well as download the results in csv, text and json formats)&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--F2Va1tT6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/butchland/vscode-dbt-bigquery-power-user/raw/master/images/query-runner-screenshot.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--F2Va1tT6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/butchland/vscode-dbt-bigquery-power-user/raw/master/images/query-runner-screenshot.png" alt="query runner preview" width="880" height="467"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But there's a catch -- right now it only supports &lt;strong&gt;Big Query&lt;/strong&gt;. But with some elbow grease, I plan to support all the other major cloud DWHs as well as Postgres (and maybe SQL Server?) databases. I also plan to enhance my vscode extension to add the other stuff like analyzing the &lt;em&gt;dbt manifest json&lt;/em&gt; file and extracting the schema from the underlying tables. Plus of course incorporating any other cool stuff the original &lt;strong&gt;vscode-dbt-power-user&lt;/strong&gt; will be adding (my extension is a fork of the &lt;strong&gt;vscode-dbt-power-user query&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;What's the experience like? It's not perfect -- it doesn't provide the same level of smart autocompletion that native DWH sql cloud consoles have -- but most of the time I just do a star query to get all the column names and copy the results over to a temp file, so its not a big deal. But at least for me, its a 100 times better since I can now do with SQL all the other stuff I do with other programming language files like JavaScript and Python -- version control, diffs, linting, autoformatting etc. So, in my so humble, but of course &lt;strong&gt;BIASED&lt;/strong&gt; opinion -- &lt;strong&gt;it's a total game changer!&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  VS Code, dbt and Big Query Online
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;But wait, there's more&lt;/strong&gt;! I got interested in what would make dbt more effective in improving the lives of analytics engineers -- and learned about the &lt;a href="https://analyticsengineers.club/"&gt;Analytics Engineers Club&lt;/a&gt; which was founded by Claire Carroll (formerly of dbt labs) and and provided training to grow data analysts into effective analytics engineers. And I agree with their viewpoint that at some point, analytics engineers need to learn to use the &lt;em&gt;dbt cli&lt;/em&gt; and be comfortable with using the terminal as well as the other software engineering practices. &lt;/p&gt;

&lt;p&gt;But as a teaching company, they weren't really happy with having to deal with installation and configuration issues that their students had to undergo every time they enrolled in a course and &lt;a href="https://analyticsengineers.club/teaching-the-real-tools/"&gt;sought to look for alternatives&lt;/a&gt;. As of late, their solution has been to provide to use a desktop VS Code editor connecting to pre-provisioned EC2 instance. &lt;/p&gt;

&lt;p&gt;But I think I've found a something BETTER! &lt;a href="https://gitpod.io/workspaces"&gt;Gitpod&lt;/a&gt; is the solution! It provides an &lt;strong&gt;VS Code&lt;/strong&gt; editor online experience so close to my desktop experience that I pretty much would use it when I can't use my desktop VS Code editor -- and with very little friction compared to a desktop experience. No need to pre-provision instances or even install VS Code on your desktop.&lt;/p&gt;

&lt;p&gt;So I built a project that would allow you to create a pretty good dbt work environment with a VS Code editor online -- the only thing you need is a dbt project hosted on github. If you want to try it out &lt;a href="https://github.com/butchland/dbt-bigquery-gitpod-config/blob/main/quickstart.md"&gt;click here&lt;/a&gt; for more &lt;em&gt;(note: of course it installs and leverages my &lt;a href="https://marketplace.visualstudio.com/items?itemName=butchland.vscode-dbt-bigquery-power-user"&gt;vscode-dbt-bigquery-power-user&lt;/a&gt; extension)&lt;/em&gt;!&lt;/p&gt;

&lt;p&gt;If you find the extension useful, don't forget to rate the extension or star the github repo. And if you have suggestions or experience problems with the extension or the setup, please file a issue in the project's issue tracker!&lt;/p&gt;

</description>
      <category>dbt</category>
      <category>vscode</category>
      <category>analytics</category>
      <category>sql</category>
    </item>
  </channel>
</rss>
