A SQL linter and auto-formatter for Humans

Overview

SQLFluff

The SQL Linter for Humans

PyPi Version PyPi License PyPi Python Versions PyPi Status PyPi Downloads

codecov CI Tests ReadTheDocs Code style: black

SQLFluff is a dialect-flexible and configurable SQL linter. Designed with ELT applications in mind, SQLFluff also works with Jinja templating and dbt. SQLFluff will auto-fix most linting errors, allowing you to focus your time on what matters.

Dialects Supported

Although SQL is reasonably consistent in its implementations, there are several different dialects available with variations of syntax and grammar. SQLFluff currently supports the following SQL dialects (though perhaps not in full):

We aim to make it easy to expand on the support of these dialects and also add other, currently unsupported, dialects. Please raise issues (or upvote any existing issues) to let us know of demand for missing support.

Pull requests from those that know the missing syntax or dialects are especially welcomed and are the question way for you to get support added. We are happy to work with any potential contributors on this to help them add this support. Please raise an issue first for any large feature change to ensure it is a good fit for this project before spending time on this work.

Templates Supported

SQL itself does not lend itself well to modularity, so to introduce some flexibility and reusability it is often templated as discussed more in our modularity documentation.

SQLFluff supports the following templates:

Again, please raise issues if you wish to support more templating languages/syntaxes.

Getting Started

To get started, install the package and run sqlfluff lint or sqlfluff fix.

$ pip install sqlfluff
$ echo "  SELECT a  +  b FROM tbl;  " > test.sql
$ sqlfluff lint test.sql
== [test.sql] FAIL
L:   1 | P:   1 | L003 | Single indentation uses a number of spaces not a multiple of 4
L:   1 | P:  14 | L006 | Operators should be surrounded by a single space unless at the start/end of a line
L:   1 | P:  27 | L001 | Unnecessary trailing whitespace

Alternatively, you can use the Official SQLFluff Docker Image or have a play using SQLFluff online.

For full CLI usage and rules reference, see the SQLFluff docs.

Documentation

For full documentation visit docs.sqlfluff.com. This documentation is generated from this repository so please raise issues or pull requests for any additions, corrections, or clarifications.

Releases

SQLFluff is in beta phase - expect the tool to change significantly with potentially non-backwards compatible API and configuration changes in future releases. If you would like to join in please consider contributing.

New releases are made monthly. For more information, visit Releases.

SQLFluff on Slack

We have a fast-growing community on Slack, come and join us!

SQLFluff on Twitter

Follow us on Twitter @SQLFluff for announcements and other related posts.

Contributing

We are grateful to all our contributors. There is a lot to do in this project, and we are just getting started.

If you want to understand more about the architecture of SQLFluff, you can find more here.

If you would like to contribute, check out the open issues on GitHub. You can also see the guide to contributing.

Comments
  • Result of `fix` changes on subsequent runs (fix is non-deterministic)

    Result of `fix` changes on subsequent runs (fix is non-deterministic)

    Expected Behaviour

    Running sqlfluff fix my_query.sql -f modifies query format – but running it again on the same file should not make any further changes.

    Observed Behaviour

    Summary: The result changes considerably also on the 2nd run. On further runs the result keeps changing with a minor whitespace change.

    The behavior is demonstrated in this branch: https://github.com/juhoautio/sqlfluff/commits/non_deterministic_fix_bug

    • 1st run: https://github.com/juhoautio/sqlfluff/commit/bc60c5767245be92b1fc7ff1f5666253e7ea7af5
    • 2nd run: https://github.com/juhoautio/sqlfluff/commit/148c91d81808a845a4e068d864e5a418906d4acd
    • 3rd run: https://github.com/juhoautio/sqlfluff/commit/befff642abeb6a5f4de05ccbce9ea38203e01a9f
    • 4th run: https://github.com/juhoautio/sqlfluff/commit/d9bcbf6c984fa0c7138b99009f5898a38681cbdc

    Console output for each command is included below.

    1st run of sqlfluff fix

    $ python -m sqlfluff fix my_query.sql -f
    ==== finding fixable violations ====
    == [my_query.sql] FAIL
    L:   3 | P:  20 | L010 | Keywords must be consistently upper case.
    L:   4 | P:  20 | L010 | Keywords must be consistently upper case.
    L:   5 | P:  23 | L010 | Keywords must be consistently upper case.
    L:   7 | P:  16 | L008 | Commas should be followed by a single whitespace unless
                           | followed by a comment.
    L:   9 | P:   2 | L003 | Indentation not consistent with line #8
    L:   9 | P:   2 | L022 | Blank line expected but not found after CTE closing
                           | bracket.
    L:  10 | P:   6 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  11 | P:  10 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  12 | P:  10 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  13 | P:  10 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  13 | P:  10 | L030 | Function names must be consistently lower case.
    L:  14 | P:   6 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  14 | P:  30 | L031 | Avoid aliases in from clauses and join conditions.
    L:  15 | P:  15 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  15 | P:  15 | L051 | INNER JOIN must be fully qualified.
    L:  15 | P:  38 | L031 | Avoid aliases in from clauses and join conditions.
    L:  16 | P:  15 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  17 | P:  15 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  17 | P:  15 | L051 | INNER JOIN must be fully qualified.
    L:  17 | P:  44 | L031 | Avoid aliases in from clauses and join conditions.
    L:  18 | P:  15 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  19 | P:  17 | L003 | Line over-indented compared to line #8
    L:  20 | P:   6 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  21 | P:   8 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  22 | P:   8 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  23 | P:   6 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  24 | P:   2 | L003 | Indentation not consistent with line #8
    L:  25 | P:   2 | L003 | Indentation not consistent with line #8
    L:  25 | P:   2 | L022 | Blank line expected but not found after CTE closing
                           | bracket.
    L:  26 | P:   6 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  27 | P:  10 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  27 | P:  23 | L010 | Keywords must be consistently upper case.
    L:  28 | P:  10 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  28 | P:  23 | L010 | Keywords must be consistently upper case.
    L:  29 | P:  10 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  29 | P:  29 | L006 | Missing whitespace before -
    L:  29 | P:  29 | L006 | Missing whitespace after -
    L:  29 | P:  42 | L010 | Keywords must be consistently upper case.
    L:  30 | P:  10 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  30 | P:  30 | L006 | Missing whitespace before -
    L:  30 | P:  30 | L006 | Missing whitespace after -
    L:  30 | P:  41 | L006 | Missing whitespace before /
    L:  30 | P:  41 | L006 | Missing whitespace after /
    L:  30 | P:  52 | L006 | Missing whitespace before *
    L:  30 | P:  52 | L006 | Missing whitespace after *
    L:  30 | P:  58 | L010 | Keywords must be consistently upper case.
    L:  30 | P:  78 | L016 | Line is too long
    L:  31 | P:   6 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  31 | P:  26 | L011 | Implicit/explicit aliasing of table.
    L:  31 | P:  26 | L031 | Avoid aliases in from clauses and join conditions.
    L:  32 | P:   6 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  32 | P:  31 | L011 | Implicit/explicit aliasing of table.
    L:  32 | P:  31 | L031 | Avoid aliases in from clauses and join conditions.
    L:  33 | P:   6 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  34 | P:   6 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  35 | P:   2 | L003 | Indentation not consistent with line #8
    L:  36 | P:   1 | L022 | Blank line expected but not found after CTE closing
                           | bracket.
    L:  39 | P:   9 | L030 | Function names must be consistently lower case.
    L:  40 | P:  23 | L005 | Commas should not have whitespace directly before them.
    L:  40 | P:  33 | L030 | Function names must be consistently lower case.
    L:  42 | P:  13 | L030 | Function names must be consistently lower case.
    L:  46 | P:   7 | L003 | Indentation not hanging or a multiple of 4 spaces
    L:  46 | P:  36 | L010 | Keywords must be consistently upper case.
    L:  46 | P:  45 | L048 | Missing whitespace after '2'
    L:  55 | P:   1 | L022 | Blank line expected but not found after CTE closing
                           | bracket.
    L:  57 | P:   9 | L030 | Function names must be consistently lower case.
    L:  64 | P:  13 | L030 | Function names must be consistently lower case.
    L:  69 | P:   1 | L022 | Blank line expected but not found after CTE closing
                           | bracket.
    ==== fixing violations ====
    68 fixable linting violations found
    FORCE MODE: Attempting fixes...
    Persisting Changes...
    == [my_query.sql] PASS
    Done. Please check your files to confirm.
      [16 unfixable linting violations found]
    

    Resulting diff here: https://github.com/juhoautio/sqlfluff/commit/bc60c5767245be92b1fc7ff1f5666253e7ea7af5

    Many formatting fixes, as expected. The result looks good!

    2nd run of sqlfluff fix

    $ python -m sqlfluff fix my_query.sql -f
    ==== finding fixable violations ====
    == [my_query.sql] FAIL
    L:  31 | P:  87 | L016 | Line is too long
    L:  33 | P: 100 | L016 | Line is too long
    L:  51 | P:  47 | L048 | Missing whitespace after '2'
    ==== fixing violations ====
    3 fixable linting violations found
    FORCE MODE: Attempting fixes...
    Persisting Changes...
    == [my_query.sql] PASS
    Done. Please check your files to confirm.
      [2 unfixable linting violations found]
    

    Resulting diff here: https://github.com/juhoautio/sqlfluff/commit/148c91d81808a845a4e068d864e5a418906d4acd

    The formatting still changes greatly. I'm not sure if this is for better or worse, but that's a matter of taste. The problem is that formatting changes at all.

    3rd run of sqlfluff fix

    $ python -m sqlfluff fix my_query.sql -f
    ==== finding fixable violations ====
    == [my_query.sql] FAIL
    L:  57 | P:  47 | L048 | Missing whitespace after '2'
    ==== fixing violations ====
    1 fixable linting violations found
    FORCE MODE: Attempting fixes...
    Persisting Changes...
    == [my_query.sql] PASS
    Done. Please check your files to confirm.
      [2 unfixable linting violations found]
    

    Resulting diff here: https://github.com/juhoautio/sqlfluff/commit/befff642abeb6a5f4de05ccbce9ea38203e01a9f

    Now formatting doesn't change much but it still does: redundant whitespace is added.

    4th run of sqlfluff fix

    $ python -m sqlfluff fix my_query.sql -f
    ==== finding fixable violations ====
    == [my_query.sql] FAIL
    L:  57 | P:  47 | L048 | Missing whitespace after '2'
    ==== fixing violations ====
    1 fixable linting violations found
    FORCE MODE: Attempting fixes...
    Persisting Changes...
    == [my_query.sql] PASS
    Done. Please check your files to confirm.
      [2 unfixable linting violations found]
    

    Resulting diff here: https://github.com/juhoautio/sqlfluff/commit/d9bcbf6c984fa0c7138b99009f5898a38681cbdc

    Adds yet another redundant space character. I suspect it would keep adding it until infinity if sqlfluff fix is run again.

    Steps to Reproduce

    Get my_query.sql from here: https://github.com/juhoautio/sqlfluff/commit/2b99acd9bdfd355fb38c8fafe1d25b43cb2c22b3

    (This query is an obfuscated version of a query that executes successfully in AWS Athena)

    Run python -m sqlfluff fix my_query.sql -f and check the file for changes after each execution.

    Dialect

    Not specified. Dialects are not important here: the expectation here is that sqlfluff can do generic autoformatting on any sql file and the result shouldn't change after the initial run.

    Version

    To make sure that these bugs haven't been fixed recently but are not in a release yet, I ran this with local dev version of sqlfluff.

    The version I used was the latest commit in main branch: https://github.com/sqlfluff/sqlfluff/commit/7fd452dbfb9ab8537b8ca6e92c9489ff04d6172b

    $ tox -e py --devenv .venv
    $ source .venv/bin/activate
    
    $ python -m sqlfluff --version
    python -m sqlfluff, version 0.9.0
    
    $ python --version
    Python 3.7.5
    

    Not using dbt.

    Configuration

    N/A

    bug core 
    opened by juhoautio 53
  • dbt.exceptions.InternalException: Asked to compile <class 'dbt.contracts.graph.compiled.CompiledModelNode'> node, but it has no compiled form

    dbt.exceptions.InternalException: Asked to compile node, but it has no compiled form

    Search before asking

    • [X] I searched the issues and found no similar issues.

    What Happened

    While linting any dbt model the error is raised part-way through linting (apparently after all the fail lines have been produced and displayed).

    I've tried sqlfluff versions

    0.10.1 - no error 0.11.0, 0.13.2, 1.0.0, 1.1.0 - error thrown

    Expected Behaviour

    sqlfluff reports linting failures.

    Observed Behaviour

    SQL model materialising as a view. This is really the WEB_USERS model from the fivetran segment dbt package, just renamed to use our naming standard.

    with
    
    SOURCE as (
      select
        *
      from
        {{ ref('SG__WEB_USERS__UNION') }}
    ),
    
    RENAMED as (
      select
        _DBT_SOURCE_RELATION,
        EMAIL,
    
        {{ sv_utils.get_email_domain('EMAIL') }} as EMAIL_DOMAIN,
    
        {{ sv_utils.is_valid_email('EMAIL') }} as IS_EMAIL_VALID,
    
        ID as USER_ID,
        PERSON_ID,
        USERNAME,
        EMAIL_ADDRESS,
        {{ sv_utils.get_email_domain('EMAIL_ADDRESS') }} as EMAIL_ADDRESS_DOMAIN,
        {{ sv_utils.is_valid_email('EMAIL_ADDRESS') }} as IS_EMAIL_ADDRESS_VALID,
        "NAME" as FULL_NAME,
        SHORT_NAME,
        FIRST_NAME,
        INITIALS,
        SURNAME,
        LAST_NAME,
        USER_TYPE,
    
        CONTEXT_IP as IP,
        -- CONTEXT_LIBRARY_NAME, -- not useful
        SUBSCRIPTIONS,
        CONTEXT_PAGE_SEARCH as PAGE_URL_QUERY,
        CONTEXT_PAGE_URL as PAGE_URL,
        {{ dbt_utils.get_url_host('CONTEXT_PAGE_URL') }} as PAGE_URL_HOST,
        -- CONTEXT_LIBRARY_VERSION, -- not useful
        CONTEXT_PAGE_REFERRER as PAGE_REFERRER,
    
        replace(
          {{ dbt_utils.get_url_host('CONTEXT_PAGE_REFERRER') }},
          'www.',
          ''
        ) as PAGE_REFERRER_HOST,
    
        CONTEXT_PAGE_TITLE as PAGE_TITLE,
        CONTEXT_LOCALE as LOCALE,
        CONTEXT_PAGE_PATH as PAGE_PATH,
        CONTEXT_CAMPAIGN_SOURCE as UTM_SOURCE,
        CONTEXT_CAMPAIGN_MEDIUM as UTM_MEDIUM,
        CONTEXT_CAMPAIGN_NAME as UTM_CAMPAIGN,
        BISLR_ID,
        CONTEXT_USER_AGENT as USER_AGENT,
        case
          when lower(context_user_agent) like '%android%' then 'Android'
          else replace(
            {{ dbt_utils.split_part(
              dbt_utils.split_part('CONTEXT_USER_AGENT',"'('",2),"' '",1) 
            }},
            ';','')
        end as device,
        UUID_TS,
        RECEIVED_AT as RECEIVED_AT_DATE_TIME,
        "ROLE" as COMPANY_ROLE,
        AGENCY_ID,
        ORGANISATION_ID,
        COMPANY_ID,
        COMPANY,
        AGENCY_NAME,
        ORGANISATION_NAME,
        COMPANY_NAME,
        ORGANISATION_TRADING_STYLES,
        COMPANY_FINANCIAL_FORCE_ID,
        COMPANY_CURRENCIES,
        COMPANY_RISK_PROFILES,
    
        AGENCIES,
        HAS_LTD_TERMS,
        AGENCY_ACCOUNT_STATUS,
        PROPOSAL_STATE,
        HAS_LABS_ACCESS,
        HAS_PAYE_TERMS,
        AGENCY_PAYROLL_PROVIDER,
        AML_STATUS,
        AGENCY_SIGN_UP_STATE,
        TIME_SHEETS_AVAILABLE,
        PICTURE_URL,
        AGENCY_HAS_FULL_ACCESS,
        ONLINE_TIMESHEET_PROVIDER,
    
        ROLES,
        ROLES_IS_SUPER_USER,
        ROLES_IS_CLIENT_AUTHORISER,
        ROLES_IS_SONOVATE_ADMIN,
        ROLES_IS_CANDIDATE,
        PERMISSIONS as USERS_PERMISSIONS,
        PERMISSIONS_IS_CLIENT_AUTHORISER,
        PERMISSIONS_IS_SONOVATE_ADMIN,
        PERMISSIONS_IS_CANDIDATE,
    
        "PROFILE" as USERS_PROFILE,
        "SESSION_ID" as USERS_SESSION_ID,
        AUTHENTICATED,
        IMAGE_URL,
        AUTHENTICATION_TOKEN,
        TOKEN,
        PERSON_TOKEN,
    
        LANGUAGE_CODE,
        SETTINGS_DATE_FORMAT,
        SETTINGS_SUBSCRIPTIONS,
        SETTINGS_TIME_ZONE,
        SETTINGS_LANGUAGE,
        SETTINGS_TIME_FORMAT,
        SETTINGS_COUNTRY_CODE,
        SETTINGS_WEEK_START
    
      from
        SOURCE
    ),
    
    FINAL as (
      select 
        *,
        case
          when DEVICE = 'iPhone' then 'iPhone'
          when DEVICE = 'Android' then 'Android'
          when DEVICE in ('iPad', 'iPod') then 'Tablet'
          when DEVICE in ('Windows', 'Macintosh', 'X11')
            then 'Desktop'
          else 'Uncategorized' end as DEVICE_CATEGORY
      from
        RENAMED
    )
    
    select
      *
    from
      FINAL
    
    

    Example verbose output

    fluff.txt

    How to reproduce

    Just a basic sqlfluff lint operation

    sqlfluff lint .\models\base\segment\SG__WEB_USERS.sql

    Dialect

    snowflake

    Version

    0.11.0 0.13.2 1.0.1 1.1.0

    Configuration

    .sqlfluff

    # dbt templating does not keep trailing new lines (L009)
    
    [sqlfluff]
    verbose = 3
    templater = dbt
    dialect = snowflake
    exclude_rules = L009,L031,L034
    ignore_templated_areas = True
    sql_file_exts = .sql,.sql.j2,.dml,.ddl,.SQL
    
    [sqlfluff:rules]
    tab_space_size = 2
    
    [sqlfluff:rules:L010]
    capitalisation_policy = lower
    
    [sqlfluff:rules:L014]
    extended_capitalisation_policy = upper
    
    [sqlfluff:rules:L016]
    max_line_length = 180
    
    [sqlfluff:rules:L019]
    comma_style = leading
    
    [sqlfluff:rules:L030]
    extended_capitalisation_policy = lower
    
    [sqlfluff:rules:L040]
    capitalisation_policy = lower
    
    [sqlfluff:templater:dbt]
    apply_dbt_builtins = True
    load_macros_from_path=./dbt_modules/dbt_utils/macros,./macros
    
    [sqlfluff:templater:dbt:macros]
    # Macros provided as builtins for dbt projects
    dbt_ref = {% macro ref(model_ref) %}{{model_ref}}{% endmacro %}
    dbt_source = {% macro source(source_name, table) %}{{source_name}}_{{table}}{% endmacro %}
    dbt_config = {% macro config() %}{% for k in kwargs %}{% endfor %}{% endmacro %}
    dbt_var = {% macro var(variable) %}item{% endmacro %}
    dbt_is_incremental = {% macro is_incremental() %}True{% endmacro %}
    
    [sqlfluff:templater:jinja:context]
    num_things=456
    tbl_name=my_table
    my_list=['a', 'b', 'c']
    MY_LIST=("d", "e", "f")
    
    [sqlfluff:templater:jinja]
    apply_dbt_builtins = True
    load_macros_from_path=./dbt_modules/dbt_utils/macros
    
    [sqlfluff:templater:jinja:macros]
    # Macros provided as builtins for dbt projects
    dbt_ref = {% macro ref(model_ref) %}{{model_ref}}{% endmacro %}
    dbt_source = {% macro source(source_name, table) %}{{source_name}}_{{table}}{% endmacro %}
    dbt_config = {% macro config() %}{% for k in kwargs %}{% endfor %}{% endmacro %}
    dbt_var = {% macro var(variable) %}item{% endmacro %}
    dbt_is_incremental = {% macro is_incremental() %}True{% endmacro %}
    
    

    .sqlfluffignore

    target/
    dbt_modules/
    macros/
    
    

    Are you willing to work on and submit a PR to address the issue?

    • [ ] Yes I am willing to submit a PR!

    Code of Conduct

    bug dbt 
    opened by reubster 50
  • BigQuery UDFs (#246) and array literals (#337)

    BigQuery UDFs (#246) and array literals (#337)

    Addresses #246 and #337

    • [x] Add support for complex parameter types, e.g. ARRAY<STRUCT<product_id INT64, rating FLOAT64>>
    • [x] Add support for [OPTIONS (library = library_array)]
    • [x] Test this PR against our real-life projects' UDFs
    opened by barrywhart 47
  • Progressbar utility

    Progressbar utility

    Fixes #1536

    There is my proposition for the progressbar utility.

    • single file image

    • for the whole directory image

    • multiple paths image

    It is enabled by default (can be disabled with --disable_progress_bar flag) and rendered for linting and fixing (not for parsing).

    The steps are iterated over

    • paths (if more than 1)
    • files from path (if more than 1)
    • rules for each file
    • also there is one dummy semi-progress bar rendered during parsing, which is just for showing that something happens by printing a label, not a real progress, but it is because of nature of recurrent parsing.

    Pull Request checklist

    • [x] Please confirm you have completed any of the necessary steps below.

    • Included test cases to demonstrate any code changes, which may be one or more of the following:

      • .yml rule test cases in test/fixtures/rules/std_rule_cases.
      • .sql/.yml parser test cases in test/fixtures/dialects (note YML files can be auto generated with python test/generate_parse_fixture_yml.py or by running tox locally).
      • Full autofix test cases in test/fixtures/linter/autofix.
      • Other.
    • Added appropriate documentation for the change.

    • Created GitHub issues for any relevant followup/future enhancements if appropriate.

    opened by adam-tokarski 46
  • Generate substitution placeholders for Jinja

    Generate substitution placeholders for Jinja "{{ }}" sections

    • [x] Fix the "initial blank line before empty substitution" bug
    • [x] Update TemplateSegment to allow empty source_str, update substitution_end instances to specify blank string
    • [x] Test where substitution (blank or not) occurs at the beginning and end of a file, also with 1 or 2 blank lines before or after. Add test(s) that rules L050 and L009 work correctly in these cases.
    • [x] If the template references an undefined variable, then the placeholder gets double added within the unparseable section.
    • [x] Failing L003 tests -- these are mostly failing because L003 tries to indent/align the placeholder blocks. Needs updating to account for these substitution ones (probably just ignore them).
    • [ ] Try adding the "empty substitution" segments as a post-processing step. Trying to include them in "source only slices" is affecting position markers and, ultimately, the behavior of Linter.remove_templated_errors(), which is breaking one or more tests (details in this PR comment).

    Brief summary of the change made

    Fixes #2066

    Are there any other side effects of this change that we should be aware of?

    Pull Request checklist

    • [ ] Please confirm you have completed any of the necessary steps below.

    • Included test cases to demonstrate any code changes, which may be one or more of the following:

      • .yml rule test cases in test/fixtures/rules/std_rule_cases.
      • .sql/.yml parser test cases in test/fixtures/dialects (note YML files can be auto generated with python test/generate_parse_fixture_yml.py or by running tox locally).
      • Full autofix test cases in test/fixtures/linter/autofix.
      • Other.
    • Added appropriate documentation for the change.

    • Created GitHub issues for any relevant followup/future enhancements if appropriate.

    opened by barrywhart 31
  • Parser incorrectly swaps BigQuery struct grammars when `parse_grammar` is not supplied.

    Parser incorrectly swaps BigQuery struct grammars when `parse_grammar` is not supplied.

    Search before asking

    • [X] I searched the issues and found no similar issues.

    What Happened

    When a STRUCT is used in conjunction with an AS alias, it's columns are recognised as datatypes, which can trigger L063.

    Expected Behaviour

    STRUCT column names should not trigger L063.

    Observed Behaviour

    L:   3 | P:   9 | L063 | Datatypes must be upper case.
    L:   4 | P:   9 | L063 | Datatypes must be upper case.
    

    How to reproduce

    Run sqlfluff lint on

    SELECT
        STRUCT(
            some_field,
            some_other_field
        ) AS col,
        STRUCT(
            some_field,
            some_other_field
        )
    FROM table
    

    Dialect

    bigquery

    Version

    0.13.1

    Configuration

    [sqlfluff]
    templater = jinja
    dialect = bigquery
    
    [sqlfluff:rules:L063]
    # Inconsistent capitalisation of datatypes
    extended_capitalisation_policy = upper
    

    Are you willing to work on and submit a PR to address the issue?

    • [ ] Yes I am willing to submit a PR!

    Code of Conduct

    bug parser bigquery 
    opened by dmohns 28
  • L030: built-in tsql functions should be capitalized by L030 while protecting user defined functions

    L030: built-in tsql functions should be capitalized by L030 while protecting user defined functions

    Search before asking

    • [X] I searched the issues and found no similar issues.

    Description

    Looking at my code formatted with sqlfluff so far,

    I found that for example month(), day(), year(), sum(), iif() are not recognized as keywords and thus not capitalized yet.

    As a result, I have gone through https://docs.microsoft.com/en-us/sql/t-sql/functions/functions?view=sql-server-ver16 and created an initial list of t-sql functions:

    ASCII
    CHAR
    CHARINDEX
    CONCAT
    CONCAT_WS
    DIFFERENCE
    FORMAT
    LEFT
    LEN
    LOWER
    LTRIM
    NCHAR
    PATINDEX
    QUOTENAME
    REPLACE
    REPLICATE
    REVERSE
    RIGHT
    RTRIM
    SOUNDEX
    SPACE
    STR
    STRING_AGG
    STRING_ESCAPE
    STRING_SPLIT
    STUFF
    SUBSTRING
    TRANSLATE
    TRIM
    UNICODE
    UPPER
    
    CAST 
    CONVERT
    PARSE
    TRY_CAST
    TRY_CONVERT
    TRY_PARSE
    CURSOR_STATUS
    
    SYSDATETIME 
    SYSDATETIMEOFFSET
    SYSUTCDATETIME
    GETDATE
    GETUTCDATE
    DATE_BUCKET
    DATENAME 
    DATEPART 
    DAY 
    MONTH 
    YEAR 
    	
    DATEFROMPARTS 
    DATETIME2FROMPARTS 
    DATETIMEFROMPARTS 
    DATETIMEOFFSETFROMPARTS 
    SMALLDATETIMEFROMPARTS 
    TIMEFROMPARTS 
    DATEDIFF 
    DATEDIFF_BIG 
    DATEADD 
    EOMONTH 
    SWITCHOFFSET 
    TODATETIMEOFFSET 
    ISDATE 
    	
    ISJSON
    JSON_VALUE
    JSON_QUERY
    JSON_MODIFY
    JSON_PATH_EXISTS
    
    CHOOSE 
    IIF 
    
    ABS
    ACOS
    ASIN
    ATAN
    ATN2
    CEILING
    COS
    COT
    DEGREES
    EXP
    FLOOR
    LOG
    LOG10
    PI
    POWER
    RADIANS  
    RAND  
    ROUND  
    SIGN  
    SIN  
    SQRT  
    SQUARE  
    TAN
    
    APP_NAME
    APPLOCK_MODE
    APPLOCK_TEST
    ASSEMBLYPROPERTY
    COL_LENGTH
    COL_NAME
    COLUMNPROPERTY
    DATABASE_PRINCIPAL_ID
    DATABASEPROPERTYEX
    DB_ID
    DB_NAME
    FILE_ID
    FILE_IDEX
    FILE_NAME
    FILEGROUP_ID
    FILEGROUP_NAME
    FILEGROUPPROPERTY
    FILEPROPERTY
    FULLTEXTCATALOGPROPERTY
    FULLTEXTSERVICEPROPERTY
    INDEX_COL  
    INDEXKEY_PROPERTY  
    INDEXPROPERTY  
    NEXT VALUE FOR  
    OBJECT_DEFINITION  
    OBJECT_ID  
    OBJECT_NAME  
    OBJECT_SCHEMA_NAME  
    OBJECTPROPERTY  
    OBJECTPROPERTYEX  
    ORIGINAL_DB_NAME  
    PARSENAME  
    SCHEMA_ID  
    SCHEMA_NAME  
    SCOPE_IDENTITY  
    SERVERPROPERTY  
    STATS_DATE  
    TYPE_ID  
    TYPE_NAME  
    TYPEPROPERTY  
    VERSION  
    
    CERTENCODED
    PWDCOMPARE
    CERTPRIVATEKEY
    PWDENCRYPT
    CURRENT_USER
    SCHEMA_ID
    DATABASE_PRINCIPAL_ID
    SCHEMA_NAME
    SESSION_USER
    SUSER_ID
    SUSER_SID
    HAS_PERMS_BY_NAME
    SUSER_SNAME
    IS_MEMBER
    SYSTEM_USER
    IS_ROLEMEMBER
    SUSER_NAME
    IS_SRVROLEMEMBER
    USER_ID
    LOGINPROPERTY
    USER_NAME
    ORIGINAL_LOGIN
    PERMISSIONS
    
    TEXTPTR
    
    CUME_DIST
    CURRENT_TIMESTAMP
    DENSE_RANK
    FIRST_VALUE
    FORMAT
    GETDATE
    GETUTCDATE
    GET_TRANSMISSION_STATUS
    LAG
    LAST_VALUE
    LEAD
    MIN_ACTIVE_ROWVERSION
    NEWID
    NEWSEQUENTIALID
    NEXT VALUE FOR
    NTILE
    PARSENAME
    PERCENTILE_CONT
    PERCENTILE_DISC
    PERCENT_RANK
    RAND
    RANK
    ROW_NUMBER
    SUM
    

    Once an initial set of the above is integrated, i can certainly validate it once more and create a PR for all missing items.

    Use case

    easier to read code.

    Dialect

    tsql

    Are you willing to work on and submit a PR to address the issue?

    • [ ] Yes I am willing to submit a PR!

    Code of Conduct

    enhancement t-sql 
    opened by fmms 27
  • Use dbt templater outside of dbt project project root with project_dir config

    Use dbt templater outside of dbt project project root with project_dir config

    This PR is my attempt to get round the linked issue - that sqlfluff with dbt templater must be run from the dbt project directory. This is makes it difficult to include sqlfluff in pre-commit hooks when the root of the git repo is not the same as the dbt project root.

    This PR is still quite a rough draft but as this is my first time contributing I was keen to get some early feedback.

    Current situation

    You can specify the dbt project directory in the .sqlfluff config file:

    [sqlfluff:templater:dbt]
    project_dir = <absolute path to dbt project directory>
    

    But when running sqlfluff from outside this directory an error is thrown by the dbt templater module File %s was not found in dbt project.

    The dbt templater uses the PathSelectorMethod from dbt source code to extract nodes from the dbt manifest corresponding to the current file being linted.

    I believe the root cause of this present issue is that the PathSelectorMethod sets the root of the search to the current working directory.

    root = Path.cwd()

    So my proposed solution is to create a new subclass which allows the root to be set to the dbt_project directory instead.

    Not sure how good an architectural decision this is creating a dbt native class here in SQLFluff - open to alternative suggestions.

    opened by pvonglehn 27
  • 371 Optionally use DBT compiler as the TemplaterInterface

    371 Optionally use DBT compiler as the TemplaterInterface

    Background

    We currently process templating for DBT projects the same way we template "plain" Jinja templated files (through Jinja templater). However DBT projects are special because the DBT library itself extends the context of the Jinja rendering, and DBT uses a package system through which the scope of the templating can also be extended.

    This leads to a couple of problems loading macros (check out the "Related Issues"), and leads us to extend the logic in the Jinja templater.

    Proposal

    I would like to add a new Templater specific to DBT.

    If the users specify that the templater used should be dbt in their configs, they would need to have the DBT package installed (extra dependency). From there we can be sure that the templated SQL is the same, as we re-use the DBT compiler to compile the specific node.

    Related issues

    • #493 Problem with macro order using Jijnja Templater in DBT projects
    • #381 Allow loads macros to throw exceptions in DBT projects
    • #371 Compatibility with DBT utils package
    • #335 Loading macros from files fail when a macro contains another macro
    • #333 Support DBT var()
    • #156 Loads macros from path
    • #516 config.get not supported

    Notes

    Currently this is a POC, the logic needs to be refactored, but I wanted to show a working solution (this actually lints properly DBT models that couldn't be linted with the Jinja templater)

    dbt 
    opened by dmateusp 27
  • Release timeline for 0.4.0.

    Release timeline for 0.4.0.

    I'm putting in place some basic project process at the moment. As part of that I think we should have a place for the discussion around which features will and won't go into the 0.4.0 release.

    The current project board is here: https://github.com/sqlfluff/sqlfluff/projects/2

    As of 6th October, the shortlist looks pretty well populated. I think there are lots of excellent suggestions in there. Before bringing them all in I want to make sure that we have a clear path forward on each one.

    The ones that I think more clarity before we can bring them in are:

    • The concept of a public API.
      • https://github.com/sqlfluff/sqlfluff/issues/289
      • This one I'm happy to take hold of and get some clarity on, and I'm already working through some ideas as part of sqluff online: https://github.com/sqlfluff/sqlfluff-online/issues/14
    • The collection of issues related to macros and dbt libraries:
      • https://github.com/sqlfluff/sqlfluff/issues/156
      • https://github.com/sqlfluff/sqlfluff/issues/371
      • https://github.com/sqlfluff/sqlfluff/issues/156
      • https://github.com/sqlfluff/sqlfluff/issues/381

    I'm going to suggest a date of 24th October for closing the 0.4.0 iteration. By which time we either have to get clear on the second chunk above or we delay it to the 0.5.0 iteration. At that point I'll create the relevant issues and projects for 0.5.0.

    release 
    opened by alanmcruickshank 27
  • `sqlfluff fix` corrupts Jinja for loop

    `sqlfluff fix` corrupts Jinja for loop

    Expected Behaviour

    Output should be semantically equivalent to input, and have valid syntax.

    Observed Behaviour

    Output seems to be corrupted.

    Steps to Reproduce

    $ printf 'SELECT\n    1,\n{%% for _ in [1, 2, 3] %%} 2,{%%endfor %%}\n' |  sqlfluff fix -
    Unfixable violations detected.
    SELECT
        1,
        {% for _ in [1, 2, 3] %}
     {%endfor %}
    

    Note that the contents of the for loop was completely deleted.

    Slightly varying the input causes the output to be corrupted in other ways (e.g. 2 is present but the comma is not, or the 2 is duplicated multiple times).

    Dialect

    None specified

    Version

    SQLFluff ce4e5a344526f7ee61a0950adc079e4d3b5af438, Python 3.9.7

    Configuration

    None

    bug jinja fix corrupts sql 
    opened by CyberShadow 25
  • Warnings are not output in GitHub annotations

    Warnings are not output in GitHub annotations

    Search before asking

    • [X] I searched the issues and found no similar issues.

    What Happened

    Running sqlfluff lint with the --format github-annotation option removes warnings from the output.

    Expected Behaviour

    I would expect the results to be annotated variously as warnings and/or errors, in line with the standard human-readable output.

    Observed Behaviour

    Interestingly, the --annotation-level option seems to change the output level for all errors (e.g. --annotation-level warning sets actual errors to warnings) and still silently drops all actual warnings.

    How to reproduce

    sqlfluff lint --format github-annotation file-with-errors-and-warnings.sql

    .sqlfluff with some rules downgraded to warnings e.g.

    [sqlfluff]
    dialect = postgres
    exclude_rules = L009, L030, L031, L032, L051, L055
    warnings = L001, L005, L006, L008, L010, L016, L023, L050
    

    Dialect

    postres

    Version

    sqlfluff 1.4.5 python 3.8

    Configuration

    [sqlfluff]
    dialect = postgres
    exclude_rules = L009, L030, L031, L032, L051, L055
    warnings = L001, L005, L006, L008, L010, L016, L023, L050
    
    [sqlfluff:rules]
    tab_space_size = 4
    indent_unit = space
    max_line_length = 100
    aliasing = explicit
    

    Are you willing to work on and submit a PR to address the issue?

    • [X] Yes I am willing to submit a PR!

    Code of Conduct

    bug 
    opened by Nate-Wessel 0
  • 2.0.0a1 Auto-migration of deprecated config value `rules:max_line_length` has no effect

    2.0.0a1 Auto-migration of deprecated config value `rules:max_line_length` has no effect

    Search before asking

    • [X] I searched the issues and found no similar issues.

    What Happened

    Running SQLFluff 2.0.0a1 with an existing config file that has rules:max_line_length yields the following warning

    deprecated config value `rules:max_line_length`
    

    which suggests that the (new) value will get automatically applied.

    However, a run of sqlfluff lint throws a lot of L016 warnings with default value (80)

    L: 228 | P:  15 | L016 | Line is too long (106 > 80).
    L: 229 | P:  13 | L016 | Line is too long (106 > 80).
    L: 335 | P:   9 | L016 | Line is too long (227 > 80).
    

    Expected Behaviour

    see above

    Observed Behaviour

    see above

    How to reproduce

    see above

    Dialect

    all

    Version

    2.0.0a1

    Configuration

    [sqlfluff:rules]
    max_line_length = 800
    

    Are you willing to work on and submit a PR to address the issue?

    • [ ] Yes I am willing to submit a PR!

    Code of Conduct

    bug 
    opened by dmohns 0
  • Fix for #4222

    Fix for #4222

    This resolves #4222 and resolves #4226. While there isn't a test case for the latter - fixing the first one makes the bigquery/004-templating test a test of the latter.

    Cases of untaken indents were being handled improperly when the dedent point covered multiple dedents. This now makes sure that all dedents are untaken or otherwise forces a newline.

    opened by alanmcruickshank 2
  • 2.0.0a1 Auto fix produces broken SQL with non-existent Jinja parameter

    2.0.0a1 Auto fix produces broken SQL with non-existent Jinja parameter

    Search before asking

    • [X] I searched the issues and found no similar issues.

    What Happened

    This is a bit of an odd one, but I think we still have to treat this as a bug.

    Consider the follow SQL

    CREATE OR REPLACE TABLE `{{ params.non_existent }}.{{ params.table_name }}`
    AS (
        SELECT *
    FROM table2
    )
    ;
    

    and assume

    params = {
        "table_name": "mytable"
    }
    

    When running sqlfluff fix to fix the lint error in line 4 SQLFluff removes the first backtick ``` from the table.

    CREATE OR REPLACE TABLE {{ params.non_existent }}.{{ params.table_name }}`
    AS (
        SELECT *
        FROM table2
    )
    ;
    

    which is broken.

    Expected Behaviour

    see above

    Observed Behaviour

    see above

    How to reproduce

    see above

    Dialect

    BigQuery

    Version

    2.0.0a1

    Configuration

    bigquery

    Are you willing to work on and submit a PR to address the issue?

    • [ ] Yes I am willing to submit a PR!

    Code of Conduct

    bug 
    opened by dmohns 0
  • 2.0.0a1 Multiline `SELECT` are not correctly indented in CTA

    2.0.0a1 Multiline `SELECT` are not correctly indented in CTA

    Search before asking

    • [X] I searched the issues and found no similar issues.

    What Happened

    Consider the following two examples:

    CREATE TABLE mytable
    AS
    (SELECT
        id,
        user_id
    FROM another_table
    )
    ;
    

    This one ☝️ does not throw any lint errors which is wrong I think. The SELECT should be on a new, indented line.

    Compare this to below example that uses only a single SELECT target.

    CREATE TABLE mytable
    AS
    (SELECT id
    FROM table
    )
    ;
    

    which gets linted to

    CREATE TABLE mytable
    AS
    (
        SELECT id
        FROM table
    )
    ;
    

    Expected Behaviour

    see above

    Observed Behaviour

    see above

    How to reproduce

    see above

    Dialect

    ansi

    Version

    2.0.0a1

    Configuration

    default

    Are you willing to work on and submit a PR to address the issue?

    • [ ] Yes I am willing to submit a PR!

    Code of Conduct

    bug 
    opened by dmohns 0
Releases(2.0.0a1)
  • 2.0.0a1(Dec 28, 2022)

    NOTE: This is an alpha release for testing purposes. There are several new features here, and breaking changes to configuration. We welcome testing feedback from the community, but know that this release may feel less polished than usual.

    Highlights

    This is the first alpha version for 2.0.0. It brings all of the changes to whitespace handing, including a total rewrite of indentation and long line logic (L003 & L016). That brings several breaking changes to the configuration of layout, see the layout docs for more details and familiarise yourself with the new default configuration.

    In addition, for the dbt templater, this introduces a large re-write of the codebase, dropping support for dbt versions before 1.0.0. This leverages functionality from dbt-osmosis to reduce the amount of functionality supported directly by SQLFluff, and performance during testing of the new version has been reported as significantly faster.

    There will likely be more changes to rule classification before a full release of 2.0.0, so anticipate that configuration files may change slightly again in future alpha releases.

    What’s Changed

    • Fixed False Positive for L037 (#4198) @WillAyd
    • Fix #4215 (#4217) @alanmcruickshank
    • don't consider templated whitespace (#4213) @alanmcruickshank
    • show fatal errors regardless (#4214) @alanmcruickshank
    • don't pickle the templater (#4208) @alanmcruickshank
    • MySQL: Support column character set and collation (#4204) @yoichi
    • Fix some issues with Docker Compose environment (#4201) @barrywhart
    • Implicit Indents (#4054) @alanmcruickshank
    • Tweak Coveralls settings (#4199) @barrywhart
    • In addition to Codecov, also upload to Coveralls (#4197) @barrywhart
    • Fix: create table default cast returns unparsable section (#4192) @NelsonTorres
    • Fix JSON parsing issue with diff-quality plugin (#4190) @barrywhart
    • Codecov migration (#4195) @alanmcruickshank
    • Stop adding trailing os.sep if ignore file is on the root of the file… (#4182) @baa-ableton
    • Port dbt-osmosis templater changes to SQLFluff (#3976) @barrywhart
    • Reflow 4: Long Lines (#4067) @alanmcruickshank
    • Fix comment bug on reindent (#4179) @alanmcruickshank
    • Reflow 3: Reindent (#3942) @alanmcruickshank

    New Contributors

    Source code(tar.gz)
    Source code(zip)
  • 1.4.5(Dec 19, 2022)

    Highlights

    This is a bugfix release, primarily for diff-quality. In addition, a new rules for spacing around parenthesis is also included.

    This is also the final 1.x.x release. Following releases will be a series of alpha releases for 2.x.x. If you affected by any outstanding bugs or regressions from this release, consider either rolling backward to a previous release without those issues, or failing forward to on an alpha release for 2.x.x (or a full release if that's out). Note that 2.x.x will bring a selection of breaking changes to config file structure, rule categorisation and dbt support.

    What’s Changed

    New Contributors

    Source code(tar.gz)
    Source code(zip)
  • 1.4.4(Dec 14, 2022)

    Highlights

    Bug fix for 1.4.3 which was incorrectly flagging L006 for concat operators (||) and other two-symbol binary operators.

    What’s Changed

    • Prep version 1.4.4 (#4170) @github-actions
    • Recognise || as an operator to avoid rule L006 flagging it (#4168) @tunetheweb
    • :bug: Check verbosity level of pytest run before running certain tests (#4167) @pwildenhain
    • [snowflake] Add support for snowflake select * exclude/replace syntax (#4160) @moreaupascal56
    Source code(tar.gz)
    Source code(zip)
  • 1.4.3(Dec 14, 2022)

    Highlights

    • Rewrote diff-quality plugin to run SQLFluff as a subprocess. More reliable, easier to switch between diff-quality and running sqlfluff lint directly.
    • New rule L067 enforces consistent syntax for type casts.
    • New rule L068 enforces a consistent number of columns in set queries (e.g. UNION).
    • Initial support for Materialize dialect.

    What's Changed

    New Contributors

    Source code(tar.gz)
    Source code(zip)
  • 1.4.2(Nov 13, 2022)

    Highlights

    This release is less about internals and much more about some quality of life improvements and dialect changes. The most notable are:

    • The introduction of a sqlfluff render command to preview the results of templated sql.
    • Linting errors within templated loops should now only appear once in the linting output.
    • Indentation around jinja {% set %} statements should now be more consistent.
    • Linting errors around unparsable code are now more appropriately handled (with more to come soon on that front).
    • Error messages when specified files aren't found are now more specific.

    We've also got dialect improvements for Redshift, SOQL & SparkSQL.

    What’s Changed

    • Fix type error in get_rules hook of plugin example (#4060) @Samyak2
    • L003: Add missing "pragma: no cover" (#4058) @barrywhart
    • Fix bug in sparksql SELECT statement termination at UNION #4050 (#4052) @anna-azizian
    • Deduplicate violations in the source space (#4041) @alanmcruickshank
    • Use "docker compose", not "docker-compose" (#4055) @barrywhart
    • Allow warnings for specific rules (#4053) @alanmcruickshank
    • Better file not found error #1023 (#4051) @alanmcruickshank
    • Filter out issues in unparsable sections (#4032) @alanmcruickshank
    • Snowflake: ADD and DROP without COLUMN (#4049) @greg-finley
    • Make render command (#4043) @alanmcruickshank
    • Bump after_n_builds to 10 (#4046) @greg-finley
    • Redshift: allows for parenthesis around FROM content (#3962) @adam-tokarski
    • Update CI to use Python 3.11 (#4038) @greg-finley
    • Classify self contained set statements as templated (#4034) @alanmcruickshank
    • Date and Datetime literals in SOQL (#4037) @alanmcruickshank
    • mypy edits for 0.990 (#4035) @alanmcruickshank
    • sparksql: support for create/remove widget clause (#4021) @Coola4kov
    • Redshift CREATE EXTERNAL FUNCTION statement (#4011) @rpr-ableton
    • Update Redshift bare functions (#4012) @rpr-ableton
    Source code(tar.gz)
    Source code(zip)
  • 1.4.1(Oct 31, 2022)

    Highlights

    This is a fix to the configuration migration from 1.4.0. In that release, the configuration of leading/trailing operators would be migrated the wrong way around and precedence between new and old configuration values behaved unexpectedly.

    What’s Changed

    • Prep version 1.4.1 (#4006) @github-actions
    • Config precedence (#4007) @alanmcruickshank
    • Redshift CREATE/ATTACH/DETACH/DROP RLS POLICY statements (#4004) @rpr-ableton
    • Redshift: Add support for APPROXIMATE functions (#3997) @rpr-ableton
    • hotfix to config migration (#4005) @alanmcruickshank
    Source code(tar.gz)
    Source code(zip)
  • 1.4.0(Oct 31, 2022)

    This release brings several internal changes, and acts as a prelude to 2.0.0 which will be released fairly soon. In particular, the following config values have changed:

    • sqlfluff:rules:L007:operator_new_lines has been changed to sqlfluff:layout:type:binary_operator:line_position.
    • sqlfluff:rules:comma_style and sqlfluff:rules:L019:comma_style have both been consolidated into sqlfluff:layout:type:comma:line_position.

    If any of these values have been set in your config, they will be automatically translated to the new values at runtime, and a warning will be shown. To silence the warning, update your config file to the new values. For more details on configuring layout (including some changes yet to come in future versions) see the docs.

    These changes are driven by underlying centralisation in the routines which control layout. While for this release, no breaking changes are expected - you may find slight differences in how SQLFluff handles edge cases. We believe in the majority of cases these are more consistent, but if you find any which are problematic then do post an issue on GitHub as usual.

    Other highlights from this release:

    • Better dbt supportfor graph nodes and avoiding dependency conflicts.
    • Numerous dialect improvements to T-SQL, MySQL, SparkSQL, SQLite, Athena Snowflake, Hive, Postgres & Databricks.

    There have also been first time contributions from 10 new contributors! 🎉🎉🎉

    What’s Changed

    • Prep version 1.4.0 (#3983) @github-actions
    • Snowflake partition nonreserved keyword (#3972) @YilangHe
    • Hive: Add support for EXCHANGE PARTITION in ALTER TABLE (#3991) @nahuelverdugo
    • Resolve parse error on multiple bracketed statements (#3994) @yoichi
    • Enable parsing of CLONE keyword in bigquery dialect (#3984) @realLyans
    • BigQuery: allow nesting of SetExpressionSegment (#3990) @yoichi
    • feat(clickhouse): Support non-standard CREATE TABLE statement (#3986) @tomasfarias
    • Fix Windows CI check (#3992) @greg-finley
    • Snowflake tag reference segment (#3985) @WittierDinosaur
    • Fix Jinja templater issue where undefined callable threw an exception (#3982) @barrywhart
    • Reflow Documentation V1 (#3970) @alanmcruickshank
    • Allow lambda argument columns to be unqualified (#3971) @olagjo
    • document inline configuration (#3981) @alanmcruickshank
    • [BUGFIX] Changing cwd temporarily on manifest load as dbt is not using project_dir to read/write target folder (#3979) @barrywhart
    • Fix type annotation of user_rules in Linter (#3977) @Samyak2
    • Unpin markupsafe (#3967) @judahrand
    • Snowflake frame clause variables (#3969) @WittierDinosaur
    • SparkSQL: added support for : (colon sign) operator (Databricks SQL) (#3956) @karabulute
    • Athena: Add support for using underscore aliases (#3965) @hectcastro
    • Snowflake: ALTER TABLE constraint actions (#3959) @erevear
    • MySQL: Support REPLACE statement (#3964) @yoichi
    • TSQL: Add support for UPDATE STATISTICS option FULLSCAN (#3950) @hectcastro
    • ANSI: fixed typos in docstrings and comments (#3953) @karabulute
    • Postgres: ALTER PROCEDURE (#3949) @krokofant
    • T-SQL: Allow arbitrary expressions in PARTITION BY clause (#3939) @borchero
    • Enable dumping of performance information to csv. (#3937) @alanmcruickshank
    • Consolidate comma style configs (#3945) @alanmcruickshank
    • Adding missing KeywordSegments for different file types in Athena dialect (#3898) @CommonCrisis
    • Add templated block uuids (#3936) @alanmcruickshank
    • Load the full dbt manifest (#3926) @davajm
    • MySQL: Support optional "IF NOT EXISTS" with CREATE TRIGGER (#3943) @yoichi
    • T-SQL: Allow to parse SYNONYM statements (#3941) @borchero
    • Hive: Add support for LATERAL VIEW clause (#3935) @hectcastro
    • Fix crash in L042 on "UNION" or other "set" queries (#3931) @barrywhart
    • Refactor Lexer: Split apart elements_to_segments and refine placement of meta segments. (#3925) @alanmcruickshank
    • Add INSERT INTO <> DEFAULT VALUES to ANSI SQL and T-SQL (#3934) @borchero
    • Break apart reflow classes and extract methods (#3919) @alanmcruickshank
    • T-SQL: Fix indendentation of OUTER APPLY (#3932) @borchero
    • MySQL: Fix create trigger (#3928) @adam-tokarski
    • SparkSQL: Fixed bug with QUALIFY usage without WHERE clause (applies also for Databricks dialect) (#3930) @karabulute
    • T-SQL: Allow specifying join hints (#3921) @borchero
    • SQLite: Add support for table-level CHECK constraint (#3923) @hectcastro
    • sparksql: added * EXCEPT for SELECT clause (#3922) @adam-tokarski
    • Map old configs to new configs (#3915) @alanmcruickshank
    • [issue_3794] allow to use 'usage' as identifier for postgres (#3914) @adam-tokarski
    • DATABRICKS: Add Support for Delta Live Tables (DLT) Syntax (#3899) @R7L208
    • Postgres Revoke fix (#3912) @greg-finley
    • fix: Click output to stderr on errors (#3902) @KingMichaelPark
    • fix issue with empty enum for postgres (#3910) @adam-tokarski
    • feat: Optional numerics for postgres arrays (#3903) @KingMichaelPark
    • fix(test): Return ParseExample namedtuple in get_parse_fixtures (#3911) @tomasfarias
    • Fix typos (#3901) @kianmeng
    • provide custom DeprecatedOption (#3904) @adam-tokarski
    • fix(redshift): Allow keywords in qualified references (#3905) @tomasfarias
    • Reflow centralisation 2: Rebreak (operators & commas) (#3847) @alanmcruickshank
    • Bring L008 into reflow work (#3908) @alanmcruickshank
    • Snowflake: Create network policy ip lists (#3888) @greg-finley
    • MySQL: Implement (key_part, ...) in index definitions (#3887) @yoichi
    • Reflow centralisation 1: Scope + Respace (#3824) @alanmcruickshank
    • Update github badge and add docker badge (#3884) @alanmcruickshank
    Source code(tar.gz)
    Source code(zip)
  • 1.3.2(Sep 27, 2022)

    Highlights

    This is primarily a release for dialect fixes and improvements with additions and changes to TSQL, Snowflake, MySQL & Redshift. The other changes of note are:

    1. Support for warnings when users set old removed config values. This supports future change work by allowing a mechanism to warn if they are used.
    2. Improvements to the fix routines for L014 and L042 to handle some trickier cases.

    What’s Changed

    • Add CreateUserSegment for Snowflake dialect (#3880) @Gal40n04ek
    • raw_segments_with_ancestors (#3878) @alanmcruickshank
    • Adjust TSQL Operators (#3877) @alanmcruickshank
    • Refactor path_to (#3875) @alanmcruickshank
    • Support Removed warning on configs (#3874) @alanmcruickshank
    • MySQL: Support column-path operator for JSON type (#3864) @yoichi
    • T-SQL: ALTER FUNCTION/PROCEDURE/VIEW parsing (#3867) @differgroup
    • MySQL: Support hexadecimal literals and bit value literals (#3869) @yoichi
    • MySQL: Treat double quotes the same as single quotes (#3871) @yoichi
    • Snowflake: COMMIT WORK (#3862) @rglbr
    • Snowflake: AlterShareStatementSegment and CreateDatabaseFromShareStatementSegment (#3858) @moreaupascal56
    • MySQL: Add CREATE/ALTER VIEW (#3859) @wfelipew
    • Redshift: CREATE TABLE LIKE enhancements (#3853) @greg-finley
    • L014 leading underscore capitalization inference fix (#3841) @j-svensmark
    • MySQL: Add extended DROP TRIGGER functionality (#3846) @yoichi
    • Allow standalone aliases in L027 (#3848) @olagjo
    • L042: Enable autofix for some tricky cases (#3700) @barrywhart
    • Snowflake: CREATE FUNCTION IF NOT EXISTS (#3845) @greg-finley
    • ignore functions with more than one element ... (#3792) @fmms
    • MySQL: support remaining constraint parts of CREATE/ALTER TABLE (#3827) @yoichi

    New Contributors

    Source code(tar.gz)
    Source code(zip)
  • 1.3.1(Sep 9, 2022)

    [1.3.1] - 2022-09-09

    Highlights

    • More refactoring of parse structures in preparation for upcoming refactor of formatting/whitespace rules.
    • Fixes some bugs in L003 (indentation).
    • New config flag large_file_skip_byte_limit which applies prior to loading the file.

    What’s Changed

    New Contributors

    Source code(tar.gz)
    Source code(zip)
  • 1.3.0(Aug 21, 2022)

    Highlights

    This release brings several potentially breaking changes to the underlying parse tree. For users of the cli tool in a linting context you should notice no change. If however your application relies on the structure of the SQLFluff parse tree or the naming of certain elements within the yaml format, then this may not be a drop-in replacement. Specifically:

    • The addition of a new end_of_file meta segment at the end of the parse structure.
    • The addition of a template_loop meta segment to signify a jump backward in the source file within a loop structure (e.g. a jinja for loop).
    • Much more specific types on some raw segments, in particular identifier and literal type segments will now appear in the parse tree with their more specific type (which used to be called name) e.g. naked_identifier, quoted_identifier, numeric_literal etc...

    If using the python api, the parent type (such as identifier) will still register if you call .is_type("identifier"), as this function checks all inherited types. However the eventual type returned by .get_type() will now be (in most cases) what used to be accessible at .name. The name attribute will be deprecated in a future release.

    Other highlights:

    • New command-line option --show-lint-violations to show details on unfixable errors when running sqlfluff fix.
    • Improved consistency of process exit codes.
    • Short CLI options for many common options.
    • Jinja templater: When --ignore=templating is enabled, undefined Jinja variables now take on "reasonable" default values rather than blank string (""). This can streamline initial rollout of SQLFluff by reducing or eliminating the need to configure templater variables.

    There are also a ton of other features and bug fixes in this release, including first-time contributions from 11 new contributors! 🎉

    What’s Changed

    New Contributors

    Source code(tar.gz)
    Source code(zip)
  • 1.2.1(Jul 15, 2022)

    [1.2.1] - 2022-07-15

    Highlights

    This is primarily a bugfix release to resolve an issue with the 1.2.0 release where the new version of sqlfluff-templater-dbt relied on functionality from the new version of sqlfluff but the package configuration had not been updated. Versions of the two packages are now pinned together.

    What’s Changed

    Source code(tar.gz)
    Source code(zip)
  • 1.2.0(Jul 13, 2022)

    Highlights

    Major changes include:

    • Adding AWS Athena as a dialect.
    • A fix routine for L046 (whitespace in jinja tags), and the mechanisms for more source-only fixes in future.
    • By default, large files (over 20k characters) are now skipped by sqlfluff. This limit is configurable and disable-able but exists as a sensible default to avoid the performance overhead of linting very large files.
    • For the dbt templater, fatal compilation errors now lo longer stop linting, and these files are now skipped instead. This enables projects to continue linting beyond the offending file and much better logging information to enable better debugging.

    What’s Changed

    New Contributors

    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Jul 3, 2022)

    Highlights

    Major changes include:

    • L066 - New rule to allow you to set min/max length requirements for aliases to ensure they are meaningful
    • L062 - addition of blocked_regex as well as blocked_words
    • L025 - fix several corner cases where aliases were removed inappropriately
    • L059 is now disabled by default for Postgres
    • Many more dialect improvements and bug fixes.

    What’s Changed

    New Contributors

    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Jun 17, 2022)

    Highlights

    This is the first stable release of SQLFluff 🎉🎉🎉.

    • Does this mean there are no more bugs? No.
    • Does this mean we're going to stop developing new features? No.
    • Does this mean that this is a tool that is now broadly usable for many teams? Yes.

    We've intentionally chosen to release 1.0.0 at a time of relative stability within SQLFluff and not at a time when new big structural changes are being made. This means that there's a good chance that this release is broadly usable. This also recognises that through the hard work of a huge number of contributors that we've built out this from a fringe tool, to something which gets over 500k downloads a month and over 4k stars on Github.

    There's still a lot to do, and some more exciting things on the horizon. If you want to be part of this and join the team of contributors, come and hang out in our slack community or on our twitter account where people can help you get started. If you're a long time user, keep submitting bug reports and inputting on issues on Github.

    If you've never used SQLFluff before, or are hesitant about starting to use it in your day to day work, now might be a good time to try it. We have guides on how to get started with the tool, and how to get started with rolling out to a team in our docs.

    What’s Changed

    • Prep version 1.0.0 (#3454) @github-actions
    • Swap to skip file if not found (#3464) @alanmcruickshank
    • Postgres: treat GENERATE_SERIES as a value table function (#3463) @tunetheweb
    • Postgres: Support multiple CONSTRAINTS in CREATE DOMAIN (#3460) @tunetheweb
    • Redshift: Add ANYELEMENT support (#3458) @tunetheweb
    • Postgres: Optional select clause elements and better ON CONFLICT support (#3452) @tunetheweb
    • Add ClickHouse as a dialect (#3448) @tunetheweb
    • Postgres: allow keywords in qualified column references (#3450) @tunetheweb
    • Remove Baron Schwatz Dead Link (#3453) @tunetheweb
    • Postgres: Finish ALTER TYPE (#3451) @greg-finley
    • SparkSQL: Add Delta Syntax for DESCRIBE HISTORY statement (#3447) @R7L208
    • Snowflake: Support Stage data file parameters in FROM clauses (#3446) @tunetheweb
    • Redshift: Support Object unpivoting (#3441) @tunetheweb
    • Python script to automate release (#3403) @greg-finley
    • Remove Delta Lake Reference in README.md (#3444) @R7L208
    • Add databricks dialect as an alias for sparksql dialect (#3440) @R7L208
    • Make all Postgres identifiers quotable (#3442) @tunetheweb
    • Update JinjaAnalyzer and JinjaTracer to handle {% block %} (#3436) @barrywhart
    • SparkSQL: Add support for Delta VACUUM statement (#3439) @R7L208
    • Warning for parsing errors extended to all dialects (#3411) @mdahlman
    • Handle templater validation errors more gracefully (#3433) @alanmcruickshank
    • MYSQL: allow for escaped single quotes (#3424) @mdahlman
    • L027: Fix false positives by reverting the PR for issue #2992: Check table aliases exist (#3435) @barrywhart
    • Allow numeric_dollar templater to have curly braces, update dollar + numeric_dollar templater examples in docs (#3432) @menzenski
    • Allow Redshift IDENTITY column (seed, step) to be optional (#3430) @menzenski
    • L036: Make wildcard behavior configurable (#3426) @barrywhart
    • L034: Don't autofix if numeric column references (#3423) @barrywhart
    • L036: Treat wildcard as multiple select targets (i.e. separate line) (#3422) @barrywhart
    • Snowflake: IDENTIFIER pseudo-function (#3409) @mdahlman
    • SNOWFLAKE: Fully referenced object names in clone statements (#3414) @mdahlman
    • Unpin coverage now issue with 6.3 has been resolved (#3393) @tunetheweb
    • L045: handle UPDATE statements with CTEs (#3397) @tunetheweb
    • L027: Add support for ignore_words (#3398) @dmohns
    • Postgres: Allow CREATE FUNCTION to use Expressions in default values (#3408) @tunetheweb
    • Fix bug in apply_fixes() with leading/trailing whitespace (#3407) @barrywhart
    • Redshift: Correct ALTER TABLE syntax (#3395) @tunetheweb
    • Postgres: Parse index with column sort (#3405) @greg-finley
    • MySQL: Improve SET Syntax for Variable Assignment (#3394) @mdahlman
    • Handle Postgres-style type casts when using the colon_nospaces templating style (#3383) @benji-york
    • Capitalization in help message (#3385) @mdahlman
    • MySQL: Update keywords (#3381) @mdahlman
    • Teradata: Database statement and Set Session Database (#3382) @mdahlman

    New Contributors

    Source code(tar.gz)
    Source code(zip)
  • 0.13.2(May 20, 2022)

    Highlights

    Major changes include:

    • Fix bug causing L003 to report indentation errors for templated code - sorry we know that one's caused many of you some grief :-(
    • Initial support of SOQL (Salesforce Object Query Language).
    • Additional Placeholder templating options.
    • Start of BigQuery procedural language support (starting simple FOR statements and CREATE PROCEDURE statements).
    • New rule L065 to put set operators onto new lines.
    • Many more dialect improvements and bug fixes.

    What’s Changed

    • All dialects: Allow RESPECT NULLS/IGNORE NULLS in window functions (#3376) @tunetheweb
    • Postgres: correct RETURNS TABLE column type (#3379) @tunetheweb
    • L065: Add rule for set operators surrounded by newlines (#3330) @dmohns
    • L064: Apply preferred quote-style for partially templated quoted literals (#3300) @dmohns
    • BigQuery: Support Stored Procedures (#3369) @tunetheweb
    • MySQL extra Boolean operators (&&, ||, !) (#3359) @mdahlman
    • Postgres and Redshift: Support LOCK [TABLE] (#3350) @tunetheweb
    • Placeholder updates: Allow optional braces in dollar placeholders, add colon_nospaces, and cast to string (#3354) @tunetheweb
    • BigQuery: Basic FOR..IN..DO...END FOR support (#3340) @tunetheweb
    • L025: exclude VALUES clauses (#3358) @tunetheweb
    • GitHub Actions: Update existing PR on new runs (#3367) @greg-finley
    • GitHub Actions: Copy draft release notes to CHANGELOG (#3360) @greg-finley
    • GitHub Action to set version number (#3347) @greg-finley
    • Postgres and Redshift: support ALTER SCHEMA (#3346) @mdahlman
    • MySQL: better SELECT..INTO support (#3351) @tunetheweb
    • Postgres: support better function calls in CREATE TRIGGER (#3349) @tunetheweb
    • Misc rule doc updates (#3352) @tunetheweb
    • Snowflake: Move CASE keyword to Unreserved list (#3353) @tunetheweb
    • MySQL: Added support for multiple variables in SET statement. (#3328) @cgkoutzigiannis
    • SOQL: Support date_n_literal (#3344) @greg-finley
    • Update Docs: Getting Started and Index (#3339) @mdahlman
    • SOQL: Disable L026 rule (#3338) @greg-finley
    • Fix critical parse error logged after L003 fix (#3337) @barrywhart
    • SOQL: Disallow non-SELECT statements (#3329) @greg-finley
    • ci: bump github actions (#3336) @Fdawgs
    • Start SOQL dialect (#3312) @greg-finley
    • Hive: support CLUSTER, DISTRIBUTE, SORT BY (#3304) @barunpuri
    • Fix typo in Configuration documentation (#3319) @mdahlman
    • L011: Support MERGE statements (#3292) @tunetheweb
    • BigQuery: Add workaround to fix false-positves of L063 (#3306) @dmohns
    • Snowflake: REMOVE statement rework (#3308) @jmc-bbk
    • Snowflake: PUT statement (#3307) @jmc-bbk
    • Snowflake: GET statement (#3305) @jmc-bbk
    • Snowflake: Support ALTER EXTERNAL TABLE (#3302) @jmc-bbk
    • T-SQL: Fix PIVOT placement (#3298) @jpers36
    • Cleanup role references (#3287) @tunetheweb
    • Adding Typeform and videoask into inthewild.rst (#3296) @omonereo-tf
    • Snowflake: LIST statement enhancement (#3295) @jmc-bbk
    • MySQL: Support Create User (#3289) @greg-finley
    • Snowflake: CREATE STAGE grammar enhancement for file formats (#3293) @jmc-bbk
    • T-SQL: Complete support for delete statement (#3285) @pguyot
    • MySQL: Support account names (#3286) @greg-finley
    • L028: In T-SQL dialect, table variables cannot be used to qualify references (#3283) @barrywhart
    • L007: An operator on a line by itself is okay (#3281) @barrywhart
    • L046 (spaces around Jinja tags) should check all slices in a segment (#3279) @barrywhart
    • L003 bug fix: Not ignoring templated newline (#3278) @barrywhart

    New Contributors

    Source code(tar.gz)
    Source code(zip)
  • 0.13.1(May 6, 2022)

    Highlights

    Major changes include:

    • Addition of "rule groups" (currently core and all) to allow ease of turning on and off groups of rules.
    • Addition of db2 dialect
    • PRS errors are now highlighted in red.
    • Many bugs fixes and dialect improvements

    What’s Changed

    New Contributors

    Source code(tar.gz)
    Source code(zip)
  • 0.13.0(Apr 22, 2022)

    Highlights

    Major changes include:

    • New Rule (L064) for preferred quotes for quoted literals
    • Rule speed improvements and fixing performance regression from 0.12.0
    • Add configuration option to disallow hanging indents in L003
    • Add ignore_words_regex configuration option for rules
    • New GitHub Annotations option
    • Many bug fixes and dialect improvements

    What’s Changed

    New Contributors

    Source code(tar.gz)
    Source code(zip)
  • 0.12.0(Apr 7, 2022)

    Highlights

    Major changes include:

    • Dialect is now mandatory, either in command line, or in config BREAKING CHANGE
    • Rename spark3 dialect to sparksql BREAKING CHANGE
    • L027 now checks tables references exist BREAKING CHANGE
    • New rule L063 to allow Datatypes to have a different capitalisation policy from L010. BREAKING CHANGE
    • Refactor and performance improvements of Delimited and L003
    • Many dialect improvements and fixes

    What’s Changed

    New Contributors

    Source code(tar.gz)
    Source code(zip)
  • 0.11.2(Mar 25, 2022)

    What’s Changed

    • Added Support For Snowflake Inline Comments (#2919) @WittierDinosaur
    • Spark3: Fix bug which did not allow multiple joins (#2917) @tunetheweb
    • Added Snowflake Alter View Support (#2915) @WittierDinosaur
    • Adjust L010 to ignore nulls and booleans covered by L040 (#2913) @tunetheweb
    • Fix bug where L043 corrupts SQL (#2908) @barrywhart
    • Jinja: Add support for Block Assignments (#2907) @barrywhart
    • L042 fix fails with missing function get_identifier() on Postgres, Redshift dialects (#2899) @barrywhart
    • BigQuery: Better Set Operators support (#2901) @tunetheweb
    • Hive: support for complex types in cast rowtype definition (#2896) @KulykDmytro
    • Hive: added json type support (#2894) @KulykDmytro
    • Hive: fix incorrect L027 error for rowtype attribute name (#2893) @KulykDmytro
    • Hive: Add ARRAY support (#2891) @tunetheweb
    • Implemented PIVOT/UNPIVOT Redshift + Fixed Snowflake Bug + Standardized PIVOT/UNPIVOT Parsing (#2888) @PLBMR
    • Fix AssertionError in dbt templater when file ends with multiple newlines (#2887) @barrywhart
    • Hive: Row typecasting in cast function (#2889) @KulykDmytro
    • dbt templater should gracefully skip macro files (#2886) @barrywhart
    • Disable L031 on BigQuery due to complex backtick / project name behavior (#2882) @barrywhart
    • Documentation: Update dbt templater docs with more detail about pros and cons (#2885) @barrywhart
    • BigQuery: Better STRUCT Array Support (#2881) @tunetheweb
    • L042: Detect violations when column is templated (#2879) @barrywhart
    • Improve parsing of BETWEEN statements (#2878) @MarcAntoineSchmidtQC
    Source code(tar.gz)
    Source code(zip)
  • 0.11.1(Mar 17, 2022)

    Highlights

    Major changes include:

    • A number of changes to fix code to make these more robust
    • Improvements to templating blocks
    • generate_parse_fixture_yml options to allow quicker, partial regeneration of YML files
    • Numerous rule fixes including adding auto fix to L042
    • Numerous grammar changes

    What's Changed

    New Contributors

    Source code(tar.gz)
    Source code(zip)
  • 0.11.0(Mar 7, 2022)

    Highlights

    Major changes include:

    • Changes rule L030 to use extended_capitalisation_policy to support PascalCase BREAKING CHANGE
    • Fixes dbt error on ephemeral models
    • Log warnings for fixes that seem to corrupt the parse SQL as may cause incorrect fixes in other rules.
    • Bug fix to rule L011 for implicit aliases
    • Bug fix to rule L019 for commas besides templated code
    • Rule L051 can now optionally be applied to LEFT/RIGHT/OUTER JOINs
    • Improvements to Test Suite
    • Many dialect improvements

    What's Changed

    New Contributors

    Source code(tar.gz)
    Source code(zip)
  • 0.10.1(Feb 16, 2022)

    Highlights

    Major changes include:

    • Improvements to rules L023, L045, L048, L052, L059 to make them more accurate.
    • If sqlfluff fix cannot find a stable fix after runaway_limit iterations (default 10) then no fixes will be applied.
    • Addition of --write-output config to command line so prevent errors corrupting output.
    • Various dialect improvements

    What’s Changed

    • Redshift: Support DATETIME as a valid datatype (#2665) @PLBMR
    • Support L033 for RedShift (#2661) @tunetheweb
    • Fix mistakes in rule yaml tests (#2658) @juhoautio
    • Fix parsing types and add check to test in future (#2652) @tunetheweb
    • Spark3: Support for SORT BY Clause (#2651) @R7L208
    • Migrate issue template from markdown to yaml (#2626) @zhongjiajie
    • L048 - handle more statements and exclude casting operators (#2642) @tunetheweb
    • MySQL support CURRENT_TIMESTAMP() in CREATE TABLE (#2648) @tunetheweb
    • Postgres enhanced DELETE FROM syntax (#2643) @tunetheweb
    • Bug fix: L025 should consider BigQuery QUALIFY clause (#2647) @barrywhart
    • Bug fix: L025 overlooking JOIN ON clause if join expression in parentheses (#2645) @barrywhart
    • L045 not reporting unused CTEs if the query uses templating (#2641) @barrywhart
    • Fix IndexError in L001 (#2640) @barrywhart
    • L052: If require_final_semicolon is set, ensure semicolon after ALL statements (#2610) @barrywhart
    • L023 to also fix extra newlines in CTE (#2623) @juhoautio
    • Spark3: Enhancements for Set Operators (#2622) @R7L208
    • Doc a better choice for default env (#2630) @juhoautio
    • Ensure ordering of fix compatible and config in rules docs (#2620) @zhongjiajie
    • Pin python version for tox -e mypy (#2629) @juhoautio
    • Hitting the linter loop limit should be treated as an error (#2628) @barrywhart
    • Allow file output directly from cli (#2625) @alanmcruickshank
    • BigQuery UNPIVOT and PIVOT fixes (#2619) @tunetheweb
    • L059 quoted identifiers bug (#2614) @tunetheweb
    • Snowflake dialect: Adjust snowflake array access (#2621) @alanmcruickshank
    • Spark3: Test Cases for ORDER BY in SELECT (#2618) @R7L208
    • Fix typos in 0.10.0 changelog (#2605) @tunetheweb
    • TSQL: Indent IF clause expression segments (#2615) @jpers36
    • Spark3: Enhancements for LIMIT Clause (#2612) @R7L208
    • Allow Bare Functions in column constraints (#2607) @tunetheweb
    • Add Oracle at and double at sign (execution symbol) (#2608) @r0fls
    • Spark3: Enhancements to LIKE clause (#2604) @R7L208
    Source code(tar.gz)
    Source code(zip)
  • 0.10.0(Feb 10, 2022)

    Highlights

    Major changes include:

    • Dropping support of DBT < 0.20 ** BREAKING CHANGE **
    • sqlfluff fix no will no longer fix SQL containing parsing or templating errors ** BREAKING CHANGE **
    • New rule L062 to allow blocking of list of configurable words (e.g. syntax, or schemas, or tables you do not want people to use)
    • Lots and lots of docs improvements
    • Looser requirements for click python package

    What’s Changed

    • L046: Detect Jinja spacing issues where segment begins with literal content (#2603) @barrywhart
    • MySQL Add BINARY support (#2602) @tunetheweb
    • Support indenting WINDOWS clauses and (optionally) CTEs (#2601) @tunetheweb
    • Postgres: Support expressions in arrays (#2599) @tunetheweb
    • BigQuery support Array of Structs (#2598) @tunetheweb
    • Support wildcards in triggers (#2597) @tunetheweb
    • Support CTEs in CREATE VIEW statements (#2596) @tunetheweb
    • SQLite Support more CREATE TRIGGER options (#2594) @tunetheweb
    • Snowflake: Support Column Comments in Alter Table statements (#2593) @tunetheweb
    • Redshift: Add DATETIME as reserved keyword (#2591) @tunetheweb
    • Support LIMIT and ORDER BY clauses in Values clauses (#2590) @tunetheweb
    • L016: New option "ignore_comment_clause" to ignore column COMMENTs, etc. (#2589) @barrywhart
    • Bug fix: L016 ("Line is too long") should consider length of prior fixes (#2587) @barrywhart
    • Add mysql INSERT ON DUPLICATE KEY (#2494) @rpr-ableton
    • Snowflake ALTER TABLE: Add multiple columns (#2578) @erevear
    • MySQL: UNIQUE KEY in CREATE TABLE (#2525) @jpy-git
    • Spark3: JOIN clause enhancements (#2570) @R7L208
    • Bug fix: L003 should fix indentation for templated code (#2580) @barrywhart
    • Exasol: Improve COMMENT and WITH [NO] DATA clause usage. (#2583) @sti0
    • Exasol: Allow multiple LOCAL keywords in WHERE clause (#2582) @sti0
    • Exasol: Allow LOCAL keyword within PREFERRING clause (#2579) @sti0
    • Add/Improve docs for config settings: "ignore", "ignore_templated_areas" (#2574) @barrywhart
    • Look for .sqlfluffignore in current directory (#2573) @barrywhart
    • Snowflake: L054 should ignore "WITHIN GROUP" clauses (#2571) @barrywhart
    • Redshift: Support Redshift SUPER Data Types (#2564) @PLBMR
    • Capitalization rules (L010, L014, L030, L040) should ignore templated code (#2566) @barrywhart
    • TSQL: Add Frame clause unreserved keywords (#2562) @jpers36
    • Simple API: Fix bug where omitted parameters still override .sqlfluff (#2563) @barrywhart
    • Spark3: Add Direct File Query (#2553) @R7L208
    • Redshift dialect: replace AnyNumberOf with AnySetOf where it makes sense (#2561) @rpr-ableton
    • jinja and dbt templaters: More robust handling of whitespace control (#2559) @barrywhart
    • Improve how "sqlfluff fix" handles templating and parse errors (#2546) @barrywhart
    • Jinja and dbt templater: Fix "list index out of range" error (#2555) @barrywhart
    • Fix typo in sqlfluffignore docs (#2551) @tunetheweb
    • Correct parsing for BigQuery SELECT REPLACE clauses. (#2550) @elyobo
    • Rules documentation improvements (#2542) @tunetheweb
    • Remove requirement for Click>=8 (#2547) @tunetheweb
    • Allow L059 to be configured to always prefer quoted identifiers (#2537) @niconoe-
    • Adds new rule L062 to allow blocking of certain words (#2540) @tunetheweb
    • Update to latest Black, drop support for dbt < 0.20 (#2536) @barrywhart
    • dbt templater: Fix bug where profile wasn't found if DBT_PROFILES_DIR contained uppercase letters (#2539) @barrywhart
    • Spark3: Added segments & grammar needed for hints (#2528) @R7L208
    • Spark3: parse some VALUES clauses (#2245) @mcannamela
    • TSQL: Allow multiple params in SET statements (#2535) @tunetheweb
    • TSQL: Add indentation for SET statement (#2531) @jpers36
    • Add additional documentation on dbt-adapter in pre-commit (#2530) @robertdefilippi
    • TSQL: Add indentation for UPDATE statement (#2532) @jpers36
    • Fix Snowflake Unordered Select Clause (#2529) @tunetheweb
    • Fix Quoted Literals for Postgres and Redshift affecting rule L039 (#2526) @tunetheweb
    • Postgres specific CTEDefinitionSegment (#2524) @jpy-git

    New Contributors

    • @robertdefilippi made their first contribution in https://github.com/sqlfluff/sqlfluff/pull/2530
    • @niconoe- made their first contribution in https://github.com/sqlfluff/sqlfluff/pull/2537
    • @elyobo made their first contribution in https://github.com/sqlfluff/sqlfluff/pull/2550
    • @erevear made their first contribution in https://github.com/sqlfluff/sqlfluff/pull/2578
    Source code(tar.gz)
    Source code(zip)
  • 0.9.4(Jan 30, 2022)

    [0.9.4] - 2022-01-30

    Highlights

    Major changes include:

    • dbt performance improvements
    • Fix click dependency error.
    • Better datepart versus identifier parsing.
    • Fix some Jinja errors.
    • Various grammar fixes and improvements

    What’s Changed

    • Spark3: test cases for HAVING clause in SELECT statement (#2517) @R7L208
    • Update click version requirement in setup.cfg to match that in requirements.txt (#2518) @barrywhart
    • Postgres: Implement DO Statements + Refactored Language Clause (#2511) @PLBMR
    • Spark3: Support for Grouping Sets, CUBE and ROLLUP in GROUP BY clause of SELECT statement (#2505) @R7L208
    • Refactor date part functions (#2510) @tunetheweb
    • Postgres: EXPLAIN ANALYSE allows British spelling (#2507) @jpy-git
    • "noqa": Add support for ignoring template (TMP) and parse (PRS) errors (#2509) @barrywhart
    • Freeze Black due to incompatibility between 22.1 and flake8-black (#2513) @tunetheweb
    • Support NATURAL JOINS (#2506) @tunetheweb
    • dbt Docker environment: Mount the test profiles.yml at ~/.dbt (#2502) @barrywhart
    • Add dbt_artifacts package to in the wild docs (#2504) @NiallRees
    • Spark3: Support DISTRIBUTE BY clause in SELECT statement (#2503) @R7L208
    • dbt templater: For performance reasons, cache the database connection across models (#2498) @barrywhart
    • Bug fix: Defining and using Jinja macro in the same file causes runtime error (#2499) @barrywhart
    • Spark3: Support CLUSTER BY clause in SELECT statement (#2491) @R7L208
    • Grammar: Adds support for COPY statement for Postgres dialect (#2481) @derickl
    • Add raiserror for T-SQL (#2490) @fdw
    • Enforce parentheses for function definitions in T-SQL (#2489) @fdw
    • Add guards to prevent rule crashes (#2488) @barrywhart

    New Contributors

    • @PLBMR made their first contribution in https://github.com/sqlfluff/sqlfluff/pull/2511

    Full Changelog: https://github.com/sqlfluff/sqlfluff/compare/0.9.3...0.9.4

    Source code(tar.gz)
    Source code(zip)
  • 0.9.3(Jan 26, 2022)

    [0.9.3] - 2022-01-26

    Highlights

    Major changes include:

    • Add ignore_words option for rules L010, L014, L029, L030, L040
    • Fix some issues in 0.9.2 preventing some queries linting

    What’s Changed

    • Prevent L031 throwing exception on unparsable code (#2486) @tunetheweb
    • Add linting of fixtures SQL for critical rules errors to tox (#2473) @tunetheweb
    • Fix L039 for T-SQL comparison operator using space (#2485) @tunetheweb
    • Fix bug in get_alias causing rule Critical errors for T-SQL (#2479) @tunetheweb
    • Tweak GitHub templates (#2471) @tunetheweb
    • Small speed improvement to L054 (#2476) @tunetheweb
    • L003: Revisit recent change to improve speed (#2474) @barrywhart
    • Fix select_crawler issue with some Exasol statements (#2470) @tunetheweb
    • Cleanup date logic by removing DatePartClause and using DatetimeUnitSegment instead (#2464) @tunetheweb
    • Fix L044 exception when final statement has no SELECT (#2468) @tunetheweb
    • Support T-SQL system variables (e.g. @@rowcount) (#2463) @tunetheweb
    • Add base rule to developing rules page (#2462) @tunetheweb
    • L003: Ignore indentation of lines that only exist in templated space (#2460) @barrywhart
    • Ignore words for various rules (#2459) @tunetheweb
    • Support Foreign Key options for MySQL (#2461) @tunetheweb
    • Exclude WINDOW clauses from L054 (#2455) @tunetheweb
    • Fix bug with L026 for simple deletes (#2458) @tunetheweb
    • Spark3: test cases for Common Table Expressions (#2454) @R7L208
    • Fix T-SQL's IDENTITY_INSERT syntax (#2452) @fdw
    • T-SQL: Support stored procedures in insert statements (#2451) @fdw
    • Spark3: Support for LOAD DATA statements (#2450) @R7L208
    Source code(tar.gz)
    Source code(zip)
  • 0.9.2(Jan 24, 2022)

    Highlights

    We are pleased to include 110 improvements and fixes in this release, and welcome 7 new contributors to the code.

    Major changes include:

    • Initial Oracle support (note: SQL, but not PL/SQL)
    • Fix more dbt 1.0.0 connection issues
    • Improved configuration documentation
    • New rule (L059) to flag unnecessary quoted identifiers
    • New rule (L060) to prefer COALESCE instead of IFNULL or NVL
    • New rule (L061) to prefer != over <>
    • Many rule fixes
    • Many dialect improvements

    What’s Changed

    • Prepare version 0.9.2 (#2403) @tunetheweb
    • Add Postgres DROP PROCEDURE support (#2446) @rpr-ableton
    • MySQL Alter table ADD/DROP/RENAME INDEX support (#2443) @tunetheweb
    • Add basic CREATE PROCEDURE support to Postgres (#2441) @tunetheweb
    • Indent T-SQL DECLARE and EXEC statements (#2439) @tunetheweb
    • Hive alternative types: INTEGER, DEC, NUMERIC (#2438) @tunetheweb
    • Implement Snowflake Dateparts (#2437) @tunetheweb
    • Fix rule L028 for T-SQL for params (#2442) @tunetheweb
    • Support CREATE UNIQUE INDEX (#2440) @tunetheweb
    • Make BigQuery typeless STRUCTs Expressions (#2435) @tunetheweb
    • T-SQL support default params and no RETURN value (#2434) @tunetheweb
    • "sqlfluff fix" should report any parse errors found (#2423) @barrywhart
    • Redshift VACUUM support (#2433) @rpr-ableton
    • Add Oracle PROMPT statement (#2413) @r0fls
    • Spark3: Support for INSERT OVERWRITE DIRECTORY with Hive Format (#2389) @R7L208
    • Exasol: Fix escaped identifiers (#2431) @sti0
    • Exasol: Fix LOCAL.ALIAS Syntax (#2430) @sti0
    • Exasol: Allow quoted identifier for various statements. (#2428) @sti0
    • Misc grammar improvements for Snowflake (#2421) @chwiese
    • New rule L061 to use != over <> (#2409) @sti0
    • Correct TRANS to TRAN (#2425) @fdw
    • Remove the "heuristic" slicer, as it was replaced by JinjaTracer (#2422) @barrywhart
    • L060: More specific description (#2419) @jpy-git
    • Fix code formatting in Rule docs (#2418) @tunetheweb
    • Allow UPDATE SET statements in RedShift (#2417) @tunetheweb
    • Add Redshift cursor DECLARE, FETCH & CLOSE support (#2414) @rpr-ableton
    • Add Redshift ANALYZE COMPRESSION support (#2412) @rpr-ableton
    • ANSI Values statement fixes (#2404) @jpy-git
    • Exasol: Overhaul drop statements (#2407) @sti0
    • L044, L045: Handle Exasol VALUES clause (#2400) @barrywhart
    • L060: Use COALESCE instead of IFNULL or NVL. (#2405) @jpy-git
    • Postgres: Fix Values alias regression (#2401) @jpy-git
    • Align line length in Python code to 88 characters (#2264) @chwiese
    • Jinja templater: Allow "load_macros_from_path" to be a comma-separated list of paths (#2387) @barrywhart
    • Add "TRANS" keyword for TSQL (#2399) @fdw
    • Docstrings: Replace double backtics with single quote for lint results. (#2386) @jpy-git
    • Spark3: Support for INSERT OVERWRITE DIRECTORY statements (#2385) @R7L208
    • Fix unnecessary white underline in doc site (#2383) @tunetheweb
    • Rolls back some code cleanup that caused coverage report to show gaps (#2384) @barrywhart
    • Fix "connection already closed" issue with dbt 1.0 and dbt_utils (#2382) @barrywhart
    • Spark3: Support for INSERT [TABLE] data manipulation statements (#2290) @R7L208
    • Comment out line in bug report template (#2378) @jpy-git
    • Postgres: EXPLAIN statement updates (#2374) @jpy-git
    • Make TABLE a non-reserved word in Postgres (#2377) @tunetheweb
    • Snowflake COLUMN is not a reserved word (#2376) @tunetheweb
    • TSQL: Complete ASA Table Index Clause functionality (#2373) @jpers36
    • Add support for Jinja import and include (#2355) @barrywhart
    • Add Redshift INTERVAL datatype support (#2366) @rpr-ableton
    • Whitespace concatenated string literals for MySQL, Postgres and Redshift (#2356) @jpy-git
    • Fix L026 false positive on "SELECT INTO" statement (#2371) @barrywhart
    • Exclude EMIT clauses from rule L013 (#2364) @tunetheweb
    • Functional API: Segments.recursive_crawl (#2369) @jpy-git
    • Complete Redshift CREATE EXTERNAL TABLE support (#2354) @rpr-ableton
    • L041: Fix duplicate DISTINCT corruption (#2365) @jpy-git
    • Bigquery Create View with Options (#2359) @tunetheweb
    • L026: Handle DML statements and multiple levels of nesting (#2336) @barrywhart
    • Postgres & MySQL: cleanup AliasExpressionSegment (#2353) @jpy-git
    • Redefine MySQL Interval segment (#2351) @rpr-ableton
    • Postgres: INSERT INTO table alias (#2349) @jpy-git
    • L043: Remove redundant CASE statement replacing NULLS with NULLS (#2346) @jpy-git
    • Add RedShift DATASHARE support (#2350) @rpr-ableton
    • Various documentation updates (#2347) @tunetheweb
    • Snowflake ALTER TABLE: Drop multiple columns (#2348) @jpy-git
    • Configuration doc: add rule configuration section (#2291) @juhoautio
    • Redshift: create model, show model & data types (#2338) @rpr-ableton
    • L059: Unnecessary quoted identifier (#2341) @jpy-git
    • L043: Use simple replace to apply fixes (#2343) @jpy-git
    • TSQL: Add functionality to PARTITION BY clause (#2335) @jpers36
    • L039 casting operator postgres fix (#2334) @jpy-git
    • AnySetOf grammar (#2326) @jpy-git
    • Redshift: update CREATE TABLE AS match_grammar (#2333) @rpr-ableton
    • Redshift CREATE EXTERNAL TABLE: TABLE PROPERTIES (#2330) @jpy-git
    • Snowflake: Flush out ALTER TABLE's tableColumnAction grammar (#2332) @wong-codaio
    • Snowflake ALTER TABLE: Add clusteringAction (#2329) @jpy-git
    • Snowflake ALTER TABLE: Add searchOptimizationAction (#2328) @jpy-git
    • Fix numeric literal grammar for Postgres/MySQL/Exasol (#2324) @jpy-git
    • L039: Remove spaces between comparison operators (T-SQL) (#2325) @jpy-git
    • Enable setting a target of a dbt profile (#2236) @yu-iskw
    • Snowflake: Add support for column rename (#2327) @wong-codaio
    • Snowflake: Added AlterTableStatement specific for Snowflake (#2267) @wong-codaio
    • Full REFERENCES grammar for CREATE TABLE statement (#2315) @jpy-git
    • Fix Spark numeric literals (#2317) @jpy-git
    • Change type of Snowflake stage paths to fix issues with L044 (#2320) @chwiese
    • Add Bytes Quoted Literals to Spark dialect (#2312) @jpy-git
    • Fix L044 assertion failure with delete stmt & cte (#2321) @barrywhart
    • L003 should consider only literal leading whitespace (ignore templated) (#2304) @barrywhart
    • Redshift: update reserved keywords (#2318) @rpr-ableton
    • docs: Document how to run SQLFluff with local changes to test them (#2316) @kayman-mk
    • Update redshift unreserved keywords (#2310) @jpy-git
    • Fix spark and hive quoted literals (#2311) @jpy-git
    • Oracle Dialect (#2293) @r0fls
    • Redshift dialect: add COPY and UNLOAD statements (#2307) @rpr-ableton
    • L052: Fix case where no preceding segments and mulitline (#2279) @jpy-git
    • Update rule L049 to handle EXEC assignments (#2308) @tunetheweb
    • Remove DATE, DATETIME and TIME from BigQuery DatePart (#2283) @tunetheweb
    • Fix #1292: nocolor and verbose can work in config files (#2300) @cympfh
    • Allow pyproject.toml as extra_config_path (#2305) @jpy-git
    • L009: Handle adding newline after trailing templated code (#2298) @barrywhart
    • added missing "t" in doc for Rule_L020 (#2294) @Xilorole
    • docs: Document configuration keyword for rule L054 (#2288) @tomasfarias
    • Update L009 to operate in raw, not templated space (#2285) @barrywhart
    • Redshift CREATE LIBRARY statements (#2277) @rpr-ableton
    • L025 with 'bigquery' dialect: Correctly interpret calling functions with a table as a parameter (#2278) @barrywhart
    • Spark3: Coverage for REFRESH auxiliary statements (#2282) @R7L208
    • Spark3: Coverage for USE DATABASE statement. (#2276) @R7L208
    • Fix link for editing 'In The Wild' page with new base branch, main (#2280) @barnett
    • Optionally allow additional configurable characters in L057 (#2274) @tunetheweb
    • L025 should look at subqueries (#2273) @barrywhart
    • Add coverage for TRUNCATE statement in Spark3 dialect (#2272) @R7L208
    • Upgrade click version to 8.0+ to support click.shell_completion (#2271) @wong-codaio
    • Improve release checklist to make releases easier (#2263) @tunetheweb
    Source code(tar.gz)
    Source code(zip)
  • 0.9.1(Jan 9, 2022)

    Highlights

    • Fix dbt 1.0.0 connection issue
    • Fix some SQL corruption issues with templated code
    • New components to simplify creating rules
    • Remove support for Python 3.6

    What's Changed

    Source code(tar.gz)
    Source code(zip)
  • 0.9.0(Dec 13, 2021)

    What’s Changed

    This release brings about several great new additions including:

    • dbt 1.0.0 compatibility.
    • CLI and Simple API paramaters to provide custom paths to config files.
    • Refinement to Simple API to return parse output in JSON format rather than as an internal SQLFluff object (BREAKING CHANGE).
    • An Official SQLFluff Docker Image.
    • Grammar improvements across various dialects.
    • A new rule (L057) to check for non-alphanumeric values in identifiers.

    There have also been many bug fixes and improvements to the CI and development processes.

    🚀 Enhancements

    🐛 Bug Fixes

    Source code(tar.gz)
    Source code(zip)
  • 0.8.2(Nov 22, 2021)

    What’s Changed

    One of the biggest new features in this release is the support for SQLAlchemy and other "placeholder" templating within SQL queries. Check out the documentation on how to set it up.

    This release also adds seven new rules. Get some help with your leading whitespace, semi-colon placement, inconsistent column references in GROUP BY/ORDER BY, and getting rid of RIGHT JOIN's among other useful lints with our new rules! See our rules documentation for more details.

    On top of those, we have made loads of grammar improvements across many dialects, improvements to the dbt templater (including issues where sqlfluff fix would corrupt the code :scream:), more fix routines, and lots more improvements.

    🚀 Enhancements

    🐛 Bug Fixes

    Source code(tar.gz)
    Source code(zip)
  • 0.8.1(Nov 7, 2021)

Owner
SQLFluff
SQL Linting and Auto-formatting for Humans
SQLFluff
SQL for Humans™

Records: SQL for Humans™ Records is a very simple, but powerful, library for making raw SQL queries to most relational databases. Just write SQL. No b

Ken Reitz 6.9k Jan 3, 2023
dask-sql is a distributed SQL query engine in python using Dask

dask-sql is a distributed SQL query engine in Python. It allows you to query and transform your data using a mixture of common SQL operations and Python code and also scale up the calculation easily if you need it.

Nils Braun 271 Dec 30, 2022
A simple python package that perform SQL Server Source Control and Auto Deployment.

deploydb Deploy your database objects automatically when the git branch is updated. Production-ready! ⚙️ Easy-to-use ?? Customizable ?? Installation I

Mert Güvençli 10 Dec 7, 2022
dbd is a database prototyping tool that enables data analysts and engineers to quickly load and transform data in SQL databases.

dbd: database prototyping tool dbd is a database prototyping tool that enables data analysts and engineers to quickly load and transform data in SQL d

Zdenek Svoboda 47 Dec 7, 2022
Easy-to-use data handling for SQL data stores with support for implicit table creation, bulk loading, and transactions.

dataset: databases for lazy people In short, dataset makes reading and writing data in databases as simple as reading and writing JSON files. Read the

Friedrich Lindenberg 4.2k Jan 2, 2023
Anomaly detection on SQL data warehouses and databases

With CueObserve, you can run anomaly detection on data in your SQL data warehouses and databases. Getting Started Install via Docker docker run -p 300

Cuebook 171 Dec 18, 2022
Simple DDL Parser to parse SQL (HQL, TSQL, AWS Redshift, Snowflake and other dialects) ddl files to json/python dict with full information about columns: types, defaults, primary keys, etc.

Simple DDL Parser Build with ply (lex & yacc in python). A lot of samples in 'tests/. Is it Stable? Yes, library already has about 5000+ usage per day

Iuliia Volkova 95 Jan 5, 2023
edaSQL is a library to link SQL to Exploratory Data Analysis and further more in the Data Engineering.

edaSQL is a python library to bridge the SQL with Exploratory Data Analysis where you can connect to the Database and insert the queries. The query results can be passed to the EDA tool which can give greater insights to the user.

Tamil Selvan 8 Dec 12, 2022
A pandas-like deferred expression system, with first-class SQL support

Ibis: Python data analysis framework for Hadoop and SQL engines Service Status Documentation Conda packages PyPI Azure Coverage Ibis is a toolbox to b

Ibis Project 2.3k Jan 6, 2023
PyRemoteSQL is a python SQL client that allows you to connect to your remote server with phpMyAdmin installed.

PyRemoteSQL Python MySQL remote client Basically this is a python SQL client that allows you to connect to your remote server with phpMyAdmin installe

ProbablyX 3 Nov 4, 2022
SQL queries to collections

SQC SQL Queries to Collections Examples from sqc import sqc data = [ {"a": 1, "b": 1}, {"a": 2, "b": 1}, {"a": 3, "b": 2}, ] Simple filte

Alexander Volkovsky 0 Jul 6, 2022
Python script to clone SQL dashboard from one workspace to another

Databricks dashboard clone Unofficial project to allow Databricks SQL dashboard copy from one workspace to another. Resource clone Setup: Create a fil

Quentin Ambard 12 Jan 1, 2023
Databank is an easy-to-use Python library for making raw SQL queries in a multi-threaded environment.

Databank Databank is an easy-to-use Python library for making raw SQL queries in a multi-threaded environment. No ORM, no frills. Thread-safe. Only ra

snapADDY GmbH 4 Apr 4, 2022
Some scripts for microsoft SQL server in old version.

MSSQL_Stuff Some scripts for microsoft SQL server which is in old version. Table of content Overview Usage References Overview These script works when

小离 5 Dec 29, 2022
Making it easy to query APIs via SQL

Shillelagh Shillelagh (ʃɪˈleɪlɪ) is an implementation of the Python DB API 2.0 based on SQLite (using the APSW library): from shillelagh.backends.apsw

Beto Dealmeida 207 Dec 30, 2022
Estoult - a Python toolkit for data mapping with an integrated query builder for SQL databases

Estoult Estoult is a Python toolkit for data mapping with an integrated query builder for SQL databases. It currently supports MySQL, PostgreSQL, and

halcyon[nouveau] 15 Dec 29, 2022
Simplest SQL mapper in Python, probably

SQL MAPPER Basically what it does is: it executes some SQL thru a database connector you fed it, maps it to some model and gives to u. Also it can cre

null 2 Nov 7, 2022
Import entity definition document into SQLie3. Manage the entity. Also, create a "Create Table SQL file".

EntityDocumentMaker Version 1.00 After importing the entity definition (Excel file), store the data in sqlite3. エンティティ定義(Excelファイル)をインポートした後、データをsqlit

G-jon FujiYama 1 Jan 9, 2022
Generate database table diagram from SQL data definition.

sql2diagram Generate database table diagram from SQL data definition. e.g. "CREATE TABLE ..." See Example below How does it works? Analyze the SQL to

django-cas-ng 1 Feb 8, 2022