From e00bbefee749e590f0a905ee317d9c97b5e059c0 Mon Sep 17 00:00:00 2001 From: Autophagy Date: Thu, 23 Feb 2017 15:30:07 +0100 Subject: [PATCH] Expanded CrateDB keyword list --- CHANGES.txt | 3 ++ src/crate/crash/repl.py | 97 +++++++++++++++++++++++++++++++---------- 2 files changed, 76 insertions(+), 24 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 58761474..be6577b0 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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`` diff --git a/src/crate/crash/repl.py b/src/crate/crash/repl.py index 8838ab02..2f0fd181 100644 --- a/src/crate/crash/repl.py +++ b/src/crate/crash/repl.py @@ -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