How to use sqlfluff - 1 common examples

To help you get started, we’ve selected a few sqlfluff examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alanmcruickshank / sqlfluff / src / sqlfluff / diff_quality_plugin.py View on Github external
def violations(src_path):
        """Return list of violations.

        Given the path to a .sql file, analyze it and return a list of
        violations (i.e. formatting or style issues).

        :param src_path:
        :return: list of Violation
        """
        linter = get_linter(get_config())
        linter.output_func = None
        linted_path = linter.lint_path(src_path, ignore_non_existent_files=True)
        result = []
        for violation in linted_path.get_violations():
            try:
                # Normal SQLFluff warnings
                message = violation.description
            except AttributeError:
                # Parse errors
                message = str(violation)
            result.append(Violation(violation.line_no(), message))
        return result

sqlfluff

The SQL Linter for Humans

MIT
Latest version published 27 days ago

Package Health Score

97 / 100
Full package analysis

Popular sqlfluff functions

Similar packages