from __future__ import unicode_literals

import sqlparse
from django import template

register = template.Library()


@register.filter
def sqlformat(sql):
    return sqlparse.format(str(sql), reindent=True)

from __future__ import unicode_literals

import sqlparse
from django import template

register = template.Library()


@register.filter
def sqlformat(sql):
    '''
    Format SQL queries.
    '''
    return sqlparse.format(str(sql), reindent=True, wrap_after=120)

Use less vertical space in query formatting
Use less vertical space in query formatting

  from __future__ import unicode_literals
  
  import sqlparse
  from django import template
  
  register = template.Library()
  
  
  @register.filter
  def sqlformat(sql):
+     '''
+     Format SQL queries.
+     '''
-     return sqlparse.format(str(sql), reindent=True)
+     return sqlparse.format(str(sql), reindent=True, wrap_after=120)
  
Use less vertical space in query formatting
## Code Before:
from __future__ import unicode_literals

import sqlparse
from django import template

register = template.Library()


@register.filter
def sqlformat(sql):
    return sqlparse.format(str(sql), reindent=True)

## Instruction:
Use less vertical space in query formatting
## Code After:
from __future__ import unicode_literals

import sqlparse
from django import template

register = template.Library()


@register.filter
def sqlformat(sql):
    '''
    Format SQL queries.
    '''
    return sqlparse.format(str(sql), reindent=True, wrap_after=120)
