diff options
| author | Patrick Schemitz <patrick.schemitz@digitalbriefkasten.de> | 2018-03-03 15:13:18 +0100 |
|---|---|---|
| committer | Patrick Schemitz <patrick.schemitz@digitalbriefkasten.de> | 2018-03-03 15:13:18 +0100 |
| commit | 6dac1d9c98742e5e7df1281d09d33db67fdde9a6 (patch) | |
| tree | 1fd4ed745b5e977bf068e5fc3868efa77215e79f /sqlparse/formatter.py | |
| parent | 9cf45ebf8c9d59442e4739befeac968002510699 (diff) | |
| download | sqlparse-6dac1d9c98742e5e7df1281d09d33db67fdde9a6.tar.gz | |
indent all identifiers, including the first one, by width instead of keyword length
Diffstat (limited to 'sqlparse/formatter.py')
| -rw-r--r-- | sqlparse/formatter.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sqlparse/formatter.py b/sqlparse/formatter.py index 6bd8033..ecb1e2f 100644 --- a/sqlparse/formatter.py +++ b/sqlparse/formatter.py @@ -56,6 +56,14 @@ def validate_options(options): options['truncate_strings'] = truncate_strings options['truncate_char'] = options.get('truncate_char', '[...]') + indent_columns = options.get('indent_columns', False) + if indent_columns not in [True, False]: + raise SQLParseError('Invalid value for indent_columns: ' + '{0!r}'.format(indent_columns)) + elif indent_columns: + options['reindent'] = True # enforce reindent + options['indent_columns'] = indent_columns + reindent = options.get('reindent', False) if reindent not in [True, False]: raise SQLParseError('Invalid value for reindent: ' @@ -161,6 +169,7 @@ def build_filter_stack(stack, options): char=options['indent_char'], width=options['indent_width'], indent_after_first=options['indent_after_first'], + indent_columns=options['indent_columns'], wrap_after=options['wrap_after'], comma_first=options['comma_first'])) |
