# How I Used ChatGPT to Auto-Generate dbt Model Descriptions from SQL Logic

**URL:** <https://discourse.getdbt.com/t/how-i-used-chatgpt-to-auto-generate-dbt-model-descriptions-from-sql-logic/19796>\
**Category:** Show and Tell\
**Created:** [July 8, 2025, 11:50am UTC](https://discourse.getdbt.com/t/how-i-used-chatgpt-to-auto-generate-dbt-model-descriptions-from-sql-logic/19796 "2025-07-08T11:50:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![benof](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@benof](https://discourse.getdbt.com/u/benof)\
**Post date:** [July 8, 2025, 11:50am UTC](https://discourse.getdbt.com/t/how-i-used-chatgpt-to-auto-generate-dbt-model-descriptions-from-sql-logic/19796/1 "2025-07-08T11:50:43Z")

</div>

Hello

One small but impactful improvement I have made to our dbt workflow is automating the generation of model descriptions by using ChatGPT to analyze the underlying SQL. 😇Descriptions are often neglected / rushed; yet they’re incredibly important for data discovery and documentation.

I built a simple Python script that sends the contents of `.sql` model files to the OpenAI API & returns concise, human-readable descriptions, which I then inject into `schema.yml`. 🙂

This saves a lot of manual writing and helps maintain consistency across the team. It’s particularly useful when onboarding new team members / reviewing legacy models. 🤔

I have set up the script to run locally but I’m exploring adding it to our CI pipeline so model documentation stays fresh with every commit. Has anyone else tried something similar or taken it a step further with test or exposure generation? 🤔 I checked [About documentation | dbt Developer Hub](https://docs.getdbt.com/docs/build/documentation) guide for reference .

When a teammate asked me [what is ChatGPT](https://www.igmguru.com/blog/what-is-chatgpt) , this small tool I hacked together turned out to be the best example of practical usage turning raw SQL into structured, documented knowledge. 🙂Sharing here in case others want to improve model documentation workflows using LLMs.

Thank you !! 🙂
