Back to Blog
How To
AirOps Team
July 15, 2024

How to use AI to automatically generate a Python script using dbt syntax

Table of Contents

Section Name

Get the latest in growth and AI workflows delivered to your inbox each week

Thank you for subscribing!
Oops! Something went wrong while submitting the form.

SHARE

dbt release 1.3 brought Python support to dbt.   🎉 

This is great news – SQL is powerful, but Python helps data practitioners unlock even more value from their data.

That said, most analysts find that Python is a much trickier language to learn. 

Fortunately, you don’t have to be fluent in Python to use it in your dbt workflows. Keep reading to learn how to use Data Sidekick, a free AI-assisted data tool from AirOps, to generate Python scripts from your dbt models.

Use artificial intelligence to instantly generate Python scripts from dbt data models

Data Sidekick contains a variety of recipes that automate common data-related tasks, including writing dbt SQL, generating YAML entries for dbt models, and generating Python scripts (using the correct structure and syntax) for use inside dbt. 

To generate a complete Python script that uses dbt syntax, Sidekick combines context from your data warehouse with the power of AI to generate a complete Python script that uses dbt syntax.

This is what the dbt Python Model Creator recipe looks like in action:

dbt Python Model Creator is just one of many recipes in Sidekick. You can also use it to:

  • Write SQL queries using plain English  🪄
  • Auto document table schemas ✍️
  • Optimize SQL queries to improve speed and trim your warehouse bill 💸

… and more (we’re always working on new recipes).

Sidekick is completely free for individual use. You don’t even need a credit card to sign up – jump in and give your Python powers an instant boost.

See how Data Sidekick’s dbt Python Model Creator recipe works in real life

Want to see how Sidekick performs in real life

Check out how Kyle Dempsey, Head of CX and Solutions Architecture at AirOps, uses Sidekick to supercharge his Python skills. ⬇

Before Sidekick, how long did it take you to write Python scripts for your dbt models?
I’m a SQL veteran, but writing, testing, and deploying Python scripts takes me a lot longer. I can do it, but I’m not super efficient.

If writing a SQL query takes me anywhere from 30 seconds to 30 minutes, creating a full Python script can take twice as long (or longer, depending on the complexity of the script).
How has Sidekick changed the way you work with Python?
Depending on what exactly I’m doing, Sidekick can save me hours of time researching, building, and testing Python scripts. When I use multiple recipes in my workflow, like the dbt Python Model Creator, dbt SQL Writer, and dbt SQL Config, I can be even faster and more efficient.

Scale your most ambitious SEO strategies

Use AI-powered workflows to turn your boldest content strategies into remarkable growth

Book a CallStart Building