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: 

Is there a command in sql cell to ignore formatting for some lines like `# fmt: off` in Python cells

jonathan-dufaul
Valued Contributor

In python cells I can add the comments `# fmt: off` before a block of code that I want black/autoformatter to ignore and `# fmt: on` afterwards. Is there anything similar I can put in sql cells to accomplish the same effect?

Some of the recommendations make the code far less legible.

Also is there any way to ignore single lines in the python cell?

2 REPLIES 2

The sql formatter I'm using is whatever databricks notebooks in the workspace themselves are using (with Ctrl-Shift-F). Is that link related to databricks?

I'll accept since it looks like the answer is a no for an ignore command in sql cells.

I found out that you can ignore single lines in python cells by putting `# fmt: skip` at the end. There has to be a space between the `#` and fmt or else you'll get a "AssertionError: INTERNAL ERROR: Black produced different code on the second pass of the formatter. Please report a bug on https://github.com/psf/black/issues." error

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