Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expanded CrateDB keyword list #176

Merged
merged 1 commit into from
Feb 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Changes for crash
Unreleased
==========

- Expanded the list of keywords used by autocompletion and
autocapitlization.

- Automatically capitalize keywords while typing,
e.g. ``select`` -> ``SELECT``

Expand Down
97 changes: 73 additions & 24 deletions src/crate/crash/repl.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,30 +101,79 @@ def append(self, string):

class SQLCompleter(Completer):
keywords = [
"select", "from", "to", "as", "all", "any", "some",
"directory", "distinct", "where", "group", "by", "order", "having",
"limit", "offset", "or", "and", "in", "not", "exists", "between",
"like", "is", "null", "true", "false", "nulls", "first", "last",
"escape", "asc", "desc", "substring", "for", "date", "time",
"year", "month", "day", "hour", "minute", "second", "current_date",
"current_time", "current_timestamp", "extract", "case", "when",
"join", "cross", "outer", "inner", "left", "right", "full",
"natural", "using", "on", "over", "partition", "range", "rows",
"unbounded", "preceding", "row", "with", "create",
"blob", "table", "repository", "snapshot", "alter", "kill",
"add", "column", "boolean", "byte", "short", "integer", "int",
"long", "float", "double", "timestamp", "ip", "object", "string",
"geo_point", "geo_shape", "global", "constraint", "describe", "explain",
"format", "type", "text", "distributed", "cast", "try_cast", "show",
"tables", "schemas", "catalogs", "columns", "partitions", "functions",
"view", "refresh", "restore", "drop", "alias", "union",
"except", "intersect", "system", "insert", "into", "values",
"delete", "update", "key", "duplicate", "set", "reset", "copy",
"clustered", "shards", "primary key", "off", "fulltext", "plain",
"index", "dynamic", "strict", "ignored", "array", "analyzer", "extends",
"tokenizer", "token_filters", "char_filters", "partitioned", "transient",
"persistent", "match", "generated", "always"
]
"abs", "absolute", "action", "add", "after", "alias", "all", "allocate",
"alter", "always", "analyzer", "and", "any", "are", "array", "array_agg",
"array_max_cardinality", "as", "asc", "asensitive", "assertion",
"asymmetric", "at", "atomic", "authorization", "avg", "before", "begin",
"begin_frame", "begin_partition", "between", "bigint", "binary", "bit",
"bit_length", "blob", "boolean", "both", "breadth", "by", "byte", "call",
"called", "cardinality", "cascade", "cascaded", "case", "cast",
"catalog", "catalogs", "ceil", "ceiling", "char", "char_filters",
"char_length", "character", "character_length", "check", "clob", "close",
"clustered", "coalesce", "collate", "collation", "collect", "column",
"columns", "commit", "condition", "connect", "connection", "constraint",
"constraints", "constructor", "contains", "continue", "convert", "copy",
"corr", "corresponding", "count", "covar_pop", "covar_samp", "create",
"cross", "cube", "cume_dist", "current", "current_catalog",
"current_date", "current_path", "current_role", "current_row",
"current_schema", "current_time", "current_timestamp", "current_user",
"cursor", "cycle", "data", "date", "day", "deallocate", "dec", "decimal",
"declare", "default", "deferrable", "deferred", "delete", "dense_rank",
"depth", "deref", "desc", "describe", "descriptor", "deterministic",
"diagnostics", "directory", "disconnect", "distinct", "distributed",
"do", "domain", "double", "drop", "duplicate", "dynamic", "each",
"element", "else", "elseif", "end", "end_exec", "end_frame",
"end_partition", "equals", "escape", "every", "except", "exception",
"exec", "execute", "exists", "exit", "explain", "extends", "external",
"extract", "false", "fetch", "filter", "first", "first_value", "float",
"for", "foreign", "format", "found", "frame_row", "free", "from", "full",
"fulltext", "function", "functions", "fusion", "general", "generated",
"geo_point", "geo_shape", "get", "global", "go", "goto", "grant",
"group", "grouping", "groups", "handler", "having", "hold", "hour",
"identity", "if", "ignored", "immediate", "in", "index", "indicator",
"initially", "inner", "inout", "input", "insensitive", "insert", "int",
"integer", "intersect", "intersection", "interval", "into", "ip", "is",
"isolation", "iterate", "join", "key", "kill", "language", "large",
"last", "last_value", "lateral", "lead", "leading", "leave", "left",
"level", "like", "like_regex", "limit", "ln", "local", "localtime",
"localtimestamp", "locator", "long", "loop", "lower", "map", "match",
"max", "member", "merge", "method", "min", "minute", "mod", "modifies",
"module", "month", "multiset", "names", "national", "natural", "nchar",
"nclob", "new", "next", "no", "none", "normalize", "not", "nth_value",
"ntile", "null", "nullif", "nulls", "numeric", "object", "octet_length",
"of", "off", "offset", "old", "on", "only", "open", "optimize", "option",
"or", "order", "ordinality", "out", "outer", "output", "over",
"overlaps", "overlay", "pad", "parameter", "partial", "partition",
"partitioned", "partitions", "path", "percent", "percent_rank",
"percentile_cont", "percentile_disc", "period", "persistent", "plain",
"portion", "position", "position_regex", "power", "precedes",
"preceding", "precision", "prepare", "preserve", "primary",
"primary key", "prior", "privileges", "procedure", "public", "range",
"rank", "read", "reads", "real", "recursive", "ref", "references",
"referencing", "refresh", "regr_avgx", "regr_avgy", "regr_count",
"regr_intercept", "regr_r2", "regr_slope", "regr_sxx",
"regr_sxyregr_syy", "relative", "release", "repeat", "repository",
"reset", "resignal", "restore", "restrict", "result", "return",
"returns", "revoke", "right", "role", "rollback", "rollup", "routine",
"row", "row_number", "rows", "savepoint", "schema", "schemas", "scope",
"scroll", "search", "second", "section", "select", "sensitive",
"session", "session_user", "set", "sets", "shards", "short", "show",
"signal", "similar", "size", "smallint", "snapshot", "some", "space",
"specific", "specifictype", "sql", "sqlcode", "sqlerror", "sqlexception",
"sqlstate", "sqlwarning", "sqrt", "start", "state", "static",
"stddev_pop", "stddev_samp", "stratify", "stratify", "strict", "string",
"submultiset", "substring", "substring_regex", "succeedsblob", "sum",
"symmetric", "system", "system_time", "system_user", "table", "tables",
"tablesample", "temporary", "text", "then", "time", "timestamp",
"timezone_hour", "timezone_minute", "to", "token_filters", "tokenizer",
"trailing", "transaction", "transient", "translate", "translate_regex",
"translation", "treat", "trigger", "trim", "trim_array", "true",
"truncate", "try_cast", "type", "uescape", "unbounded", "under", "undo",
"union", "unique", "unknown", "unnest", "until", "update", "upper",
"usage", "user", "using", "value", "value_of", "values", "var_pop",
"var_samp", "varbinary", "varchar", "varying", "versioning", "view",
"when", "whenever", "where", "while", "width_bucket", "window", "with",
"within", "without", "work", "write", "year", "zone"]

def __init__(self, cmd):
self.cmd = cmd
Expand Down