示例#1
0
def dialect_shell_complete(ctx, param, incomplete):
    """Shell completion for possible dialect names.

    We use this over click.Choice as we want to internally
    handle error messages and codes for incorrect/outdated dialects.
    """
    dialect_names = [e.label for e in list_dialects()]
    return [
        completion.CompletionItem(name) for name in dialect_names
        if name.startswith(incomplete)
    ]
示例#2
0
def test__api__info_dialects():
    """Basic linting of dialects."""
    dialects = sqlfluff.list_dialects()
    assert isinstance(dialects, list)
    assert ("ansi", "ansi", "nothing") in dialects
示例#3
0
"""Export global config variables."""
import sqlfluff

SQLFLUFF_VERSION = sqlfluff.__version__

VALID_DIALECTS = tuple(d.name for d in sqlfluff.list_dialects())

# dict mapping string rule names to descriptions
VALID_RULES = {r.code: r.description for r in sqlfluff.list_rules()}
示例#4
0
"""This is an example of how get basic options from sqlfluff."""

import sqlfluff

#  -------- DIALECTS ----------

dialects = sqlfluff.list_dialects()
# dialects = [DialectTuple(label='ansi', name='ansi', inherits_from='nothing'), ...]
dialect_names = [dialect.label for dialect in dialects]
# dialect_names = ["ansi", "snowflake", ...]

#  -------- RULES ----------

rules = sqlfluff.list_rules()
# rules = [
#     RuleTuple(
#         code='Example_L001',
#         description='ORDER BY on these columns is forbidden!'
#     ),
#     ...
# ]
rule_codes = [rule.code for rule in rules]
# rule_codes = ["L001", "L002", ...]