cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

SQL Notebook Tab Spacing

KFries
New Contributor II

My SQL notebooks in databricks suffer from having at least several different counts of spaces between tab marks.  It makes it very difficult to maintain pretty code spacing.  What sets the tab spacing in SQL language notebooks, and how is it set/adjusted?  Also, I co-edit the notebooks using git/github and intelliJ (which could be a source of the problem), but I want the indenting to be correct for my tastes as rendered in the databricks notebook because that's where I run it with data.  I am constantly adjusting spacing using the ctrl-squarebracket shortcuts.

2 REPLIES 2

Retired_mod
Esteemed Contributor III

Hi @KFries, It sounds like you're dealing with a common issue with tab spacing in Databricks SQL notebooks. Databricks uses 2 spaces per tab by default, and while you can't change this setting globally, you can manually format your notebook via the "Edit > Format Notebook" option. If you're also using IntelliJ, ensure your tab and indentation settings there match your preferences for Databricks. For consistent formatting across tools, set up your `.editorconfig` file to enforce 2-space indentation in SQL files and use GitHub integration to maintain uniformity. Always format your code before committing to GitHub to keep things clean and consistent.

If you have any more specific issues or need further assistance, feel free to ask!

louisv-bambaw
New Contributor II

Iโ€™m experiencing the same issue with SQL cell indentation in Databricks notebooks. While editing, Iโ€™ve noticed that the indentation level can vary from one cell to another - sometimes itโ€™s two spaces, other times itโ€™s four. This inconsistency makes it challenging to maintain a uniform look across SQL cells.

It would be helpful if there were a dedicated parameter for SQL cell indentation, similar to the existing โ€œIndentation for Python cells in new notebooks (in spaces)โ€ option for Python cells.

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local communityโ€”sign up today to get started!

Sign Up Now