From 1ca47d01c4b5532749679f5130a4272b910e76b5 Mon Sep 17 00:00:00 2001 From: Anurag Anjaria Date: Tue, 17 Dec 2024 16:20:11 -0500 Subject: [PATCH] Add sql syntax highlighting to dbt asset descriptions (#26393) ## Summary & Motivation Adds SQL syntax highlighting to raw sql code in dbt asset descriptions. Only for dbt assets, when the dbt asset exposes the raw sql. ## How I Tested These Changes Spun up the sample dbt project and navigated to a dbt asset. The sql code in the description has syntax highlighting. Light mode: image Dark mode: image > @salazarm we had discussed using custom CSS to make the blue text stand out more in dark mode, but it appears to be fairly readable in my browser. Let me know if you feel we still need custom CSS here. ## Changelog > Not sure if this needs a changelog? I can add one if necessary. --- python_modules/libraries/dagster-dbt/dagster_dbt/asset_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_modules/libraries/dagster-dbt/dagster_dbt/asset_utils.py b/python_modules/libraries/dagster-dbt/dagster_dbt/asset_utils.py index 5b2d8f9cb7d5b..68fdaea3e2629 100644 --- a/python_modules/libraries/dagster-dbt/dagster_dbt/asset_utils.py +++ b/python_modules/libraries/dagster-dbt/dagster_dbt/asset_utils.py @@ -573,7 +573,7 @@ def default_description_fn(dbt_resource_props: Mapping[str, Any], display_raw_sq or f"dbt {dbt_resource_props['resource_type']} {dbt_resource_props['name']}", ] if display_raw_sql: - description_sections.append(f"#### Raw SQL:\n```\n{code_block}\n```") + description_sections.append(f"#### Raw SQL:\n```sql\n{code_block}\n```") return "\n\n".join(filter(None, description_sections))