Skip to content

Feat: Add an --explain flag to sqlmesh plan to list out plain steps that will happen in finer detail. #4316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sungchun12 opened this issue May 5, 2025 · 0 comments
Labels
Improvement Improves existing functionality

Comments

@sungchun12
Copy link
Contributor

I met with the SELECT TOP group and SQLMesh can feel opaque at times in how it operates. This is especially true with destructive vs. non-destructive changes to incremental models. Further complicating this is --forward-only plans. Before a user makes a complicated change, it's helpful to get a logical explanation of what SQL operations will take place.

Should be easy at a glance to verify that the potential SQL operations are behaving as expected. For example, I want to make sure a forward only change to an incremental model will drop or change the data type of a column properly before I apply the plan.

sqlmesh plan dev --explain
sqlmesh plan dev --forward-only --explain

(.venv) ➜  sqlmesh-demos git:(sung/vscode) ✗ sqlmesh plan dev --forward-only  --explain    


Differences from the `dev` environment:

Models:
└── Directly Modified:
    └── demo__dev.customers

---                                                                                                                                                          
                                                                                                                                                             
+++                                                                                                                                                          
                                                                                                                                                             
@@ -65,4 +65,4 @@                                                                                                                                            
                                                                                                                                                             
 SELECT                                                                                                                                                      
   *                                                                                                                                                         
 FROM final                                                                                                                                                  
-LIMIT 5                                                                                                                                                     
+LIMIT 10                                                                                                                                                    

Directly Modified: demo__dev.customers (Forward-only)
   Will apply this new SQL model definition next time this runs on a schedule
Apply - Virtual Update [y/n]: 

The look and feel is similar to these plainer term steps in the full walkthrough: https://sqlmesh.readthedocs.io/en/latest/examples/incremental_time_full_walkthrough/#making-changes

Image

Internal slack thread discussing this

@izeigerman izeigerman added the Improvement Improves existing functionality label May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Improves existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants