Symptoms
In a project that uses dbt (the dbt Support plugin is installed and enabled), SQL files cannot be run directly from the editor:
- The Execute (▶) button on the SQL editor toolbar is missing, or it is shown but greyed out and inactive.
- Ctrl+Enter does not run the statement, and the Execute action is absent from the editor context menu.
- The same statements run without issue from a query console attached to the data source.
- Disabling the dbt Support plugin restores SQL execution; re-enabling it disables the button again.
In some builds the missing toolbar also affects SQL files elsewhere in the same project, not only files inside dbt directories.
Environment
- Customer type: Personal and commercial customers
- Region affected: All regions
- Product affected: PyCharm and DataSpell with the dbt Support plugin
Cause
The dbt Support plugin registers SQL files located in dbt directories as dbt/Jinja files. In affected builds this removed the standard SQL execution toolbar from those files — and in some configurations from other SQL files in the same project — so the regular Execute action was unavailable.
Resolution
A fix is available in the PyCharm 2026.2 EAP (build 262.8034 and later). After updating, file handling is split by location:
- SQL files outside dbt directories stay regular SQL files and run against the configured data source as before.
- SQL files inside dbt directories are recognized as dbt/Jinja files and run through dbt actions — Run model, Test model, and Preview model. These files now carry a distinct dbt icon so they are easy to tell apart from regular SQL.
Update to the latest PyCharm 2026.2 EAP or newer build to get the fix. Progress is tracked in Unable to directly execute a SQL file when it's in a dbt project, implemented via Can't execute statement in PyCharm dbt project.
If updating is not yet an option, one of the following restores execution on earlier builds:
- Run the statements from a query console attached to the data source instead of from the file.
- For SQL files that are not part of dbt, open Settings, search for File Types, and confirm that the
*.sqlpattern is associated with the SQL file type. - Temporarily disable the dbt Support plugin when dbt-specific features are not needed.
Comments
0 comments
Please sign in to leave a comment.