summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmjith Ramanujam <amjith.r@gmail.com>2022-08-13 15:20:42 -0700
committerAmjith Ramanujam <amjith.r@gmail.com>2022-08-13 15:20:42 -0700
commitca3c76e8840fa19d5ff0ea6b7396455116af9a8e (patch)
treeea1f022f82dea870b1d824084f31fd303950ccf0
parent755de1ebd80d744b0542aafc139dd672ed1fef85 (diff)
Reorder the list to suggest good completions.
-rw-r--r--mycli/sqlcompleter.py330
1 files changed, 164 insertions, 166 deletions
diff --git a/mycli/sqlcompleter.py b/mycli/sqlcompleter.py
index 73ece2d..3b92c23 100644
--- a/mycli/sqlcompleter.py
+++ b/mycli/sqlcompleter.py
@@ -13,172 +13,170 @@ _logger = logging.getLogger(__name__)
class SQLCompleter(Completer):
- keywords = ['ACCESS', 'ADD', 'ALL', 'ALTER TABLE', 'AND', 'ANY', 'AS',
- 'ASC', 'AUTO_INCREMENT', 'BEFORE', 'BEGIN', 'BETWEEN',
- 'BIGINT', 'BINARY', 'BY', 'CASE', 'CHANGE MASTER TO', 'CHAR',
- 'CHARACTER SET', 'CHECK', 'COLLATE', 'COLUMN', 'COMMENT',
- 'COMMIT', 'CONSTRAINT', 'CREATE', 'CURRENT',
- 'CURRENT_TIMESTAMP', 'DATABASE', 'DATE', 'DECIMAL', 'DEFAULT',
- 'DELETE FROM', 'DESC', 'DESCRIBE', 'DROP',
- 'ELSE', 'END', 'ENGINE', 'ESCAPE', 'EXISTS', 'FILE', 'FLOAT',
- 'FOR', 'FOREIGN KEY', 'FORMAT', 'FROM', 'FULL', 'FUNCTION',
- 'GRANT', 'GROUP BY', 'HAVING', 'HOST', 'IDENTIFIED', 'IN',
- 'INCREMENT', 'INDEX', 'INSERT INTO', 'INT', 'INTEGER',
- 'INTERVAL', 'INTO', 'IS', 'JOIN', 'KEY', 'LEFT', 'LEVEL',
- 'LIKE', 'LIMIT', 'LOCK', 'LOGS', 'LONG', 'MASTER',
- 'MEDIUMINT', 'MODE', 'MODIFY', 'NOT', 'NULL', 'NUMBER',
- 'OFFSET', 'ON', 'OPTION', 'OR', 'ORDER BY', 'OUTER', 'OWNER',
- 'PASSWORD', 'PORT', 'PRIMARY', 'PRIVILEGES', 'PROCESSLIST',
- 'PURGE', 'REFERENCES', 'REGEXP', 'RENAME', 'REPAIR', 'RESET',
- 'REVOKE', 'RIGHT', 'ROLLBACK', 'ROW', 'ROWS', 'ROW_FORMAT',
- 'SAVEPOINT', 'SELECT', 'SESSION', 'SET', 'SHARE', 'SHOW',
- 'SLAVE', 'SMALLINT', 'SMALLINT', 'START', 'STOP', 'TABLE',
- 'THEN', 'TINYINT', 'TO', 'TRANSACTION', 'TRIGGER', 'TRUNCATE',
- 'UNION', 'UNIQUE', 'UNSIGNED', 'UPDATE', 'USE', 'USER',
- 'USING', 'VALUES', 'VARCHAR', 'VIEW', 'WHEN', 'WHERE', 'WITH']
-
- tidb_keywords = ["ACCOUNT", "ACTION", "ADD", "ADDDATE", "ADMIN", "ADVISE",
- "AFTER", "AGAINST", "AGO", "ALGORITHM", "ALL", "ALTER",
- "ALWAYS", "ANALYZE", "AND", "ANY",
- "APPROX_COUNT_DISTINCT", "APPROX_PERCENTILE", "AS", "ASC",
- "ASCII", "ATTRIBUTES", "AUTO_ID_CACHE", "AUTO_INCREMENT",
- "AUTO_RANDOM", "AUTO_RANDOM_BASE", "AVG",
- "AVG_ROW_LENGTH", "BACKEND", "BACKUP", "BACKUPS", "BATCH",
- "BEGIN", "BERNOULLI", "BETWEEN", "BIGINT", "BINARY",
- "BINDING", "BINDINGS", "BINDING_CACHE", "BINLOG", "BIT",
- "BIT_AND", "BIT_OR", "BIT_XOR", "BLOB", "BLOCK", "BOOL",
- "BOOLEAN", "BOTH", "BOUND", "BRIEF", "BTREE", "BUCKETS",
- "BUILTINS", "BY", "BYTE", "CACHE", "CALL", "CANCEL",
- "CAPTURE", "CARDINALITY", "CASCADE", "CASCADED", "CASE",
- "CAST", "CAUSAL", "CHAIN", "CHANGE", "CHAR", "CHARACTER",
- "CHARSET", "CHECK", "CHECKPOINT", "CHECKSUM", "CIPHER",
- "CLEANUP", "CLIENT", "CLIENT_ERRORS_SUMMARY", "CLUSTERED",
- "CMSKETCH", "COALESCE", "COLLATE", "COLLATION", "COLUMN",
- "COLUMNS", "COLUMN_FORMAT", "COLUMN_STATS_USAGE",
- "COMMENT", "COMMIT", "COMMITTED", "COMPACT", "COMPRESSED",
- "COMPRESSION", "CONCURRENCY", "CONFIG", "CONNECTION",
- "CONSISTENCY", "CONSISTENT", "CONSTRAINT", "CONSTRAINTS",
- "CONTEXT", "CONVERT", "COPY", "CORRELATION", "CPU",
- "CREATE", "CROSS", "CSV_BACKSLASH_ESCAPE",
- "CSV_DELIMITER", "CSV_HEADER", "CSV_NOT_NULL", "CSV_NULL",
- "CSV_SEPARATOR", "CSV_TRIM_LAST_SEPARATORS", "CUME_DIST",
- "CURRENT", "CURRENT_DATE", "CURRENT_ROLE", "CURRENT_TIME",
- "CURRENT_TIMESTAMP", "CURRENT_USER", "CURTIME", "CYCLE",
- "DATA", "DATABASE", "DATABASES", "DATE", "DATETIME",
- "DATE_ADD", "DATE_SUB", "DAY", "DAY_HOUR",
- "DAY_MICROSECOND", "DAY_MINUTE", "DAY_SECOND", "DDL",
- "DEALLOCATE", "DECIMAL", "DEFAULT", "DEFINER", "DELAYED",
- "DELAY_KEY_WRITE", "DELETE", "DENSE_RANK", "DEPENDENCY",
- "DEPTH", "DESC", "DESCRIBE", "DIRECTORY", "DISABLE",
- "DISABLED", "DISCARD", "DISK", "DISTINCT", "DISTINCTROW",
- "DIV", "DO", "DOT", "DOUBLE", "DRAINER", "DROP", "DRY",
- "DUAL", "DUMP", "DUPLICATE", "DYNAMIC", "ELSE", "ENABLE",
- "ENABLED", "ENCLOSED", "ENCRYPTION", "END", "ENFORCED",
- "ENGINE", "ENGINES", "ENUM", "ERROR", "ERRORS", "ESCAPE",
- "ESCAPED", "EVENT", "EVENTS", "EVOLVE", "EXACT", "EXCEPT",
- "EXCHANGE", "EXCLUSIVE", "EXECUTE", "EXISTS", "EXPANSION",
- "EXPIRE", "EXPLAIN", "EXPR_PUSHDOWN_BLACKLIST",
- "EXTENDED", "EXTRACT", "FALSE", "FAST", "FAULTS", "FETCH",
- "FIELDS", "FILE", "FIRST", "FIRST_VALUE", "FIXED",
- "FLASHBACK", "FLOAT", "FLUSH", "FOLLOWER", "FOLLOWERS",
- "FOLLOWER_CONSTRAINTS", "FOLLOWING", "FOR", "FORCE",
- "FOREIGN", "FORMAT", "FROM", "FULL", "FULLTEXT",
- "FUNCTION", "GENERAL", "GENERATED", "GET_FORMAT",
- "GLOBAL", "GRANT", "GRANTS", "GROUP BY", "GROUPS",
- "GROUP_CONCAT", "HASH", "HAVING", "HELP", "HIGH_PRIORITY",
- "HISTOGRAM", "HISTOGRAMS_IN_FLIGHT", "HISTORY", "HOSTS",
- "HOUR", "HOUR_MICROSECOND", "HOUR_MINUTE", "HOUR_SECOND",
- "IDENTIFIED", "IF", "IGNORE", "IMPORT", "IMPORTS", "IN",
- "INCREMENT", "INCREMENTAL", "INDEX", "INDEXES", "INFILE",
- "INNER", "INPLACE", "INSERT", "INSERT_METHOD", "INSTANCE",
- "INSTANT", "INT", "INT1", "INT2", "INT3", "INT4", "INT8",
- "INTEGER", "INTERNAL", "INTERSECT", "INTERVAL", "INTO",
- "INVISIBLE", "INVOKER", "IO", "IPC", "IS", "ISOLATION",
- "ISSUER", "JOB", "JOBS", "JOIN", "JSON", "JSON_ARRAYAGG",
- "JSON_OBJECTAGG", "KEY", "KEYS", "KEY_BLOCK_SIZE", "KILL",
- "LABELS", "LAG", "LANGUAGE", "LAST", "LASTVAL",
- "LAST_BACKUP", "LAST_VALUE", "LEAD", "LEADER",
- "LEADER_CONSTRAINTS", "LEADING", "LEARNER", "LEARNERS",
- "LEARNER_CONSTRAINTS", "LEFT", "LESS", "LEVEL", "LIKE",
- "LIMIT", "LINEAR", "LINES", "LIST", "LOAD", "LOCAL",
- "LOCALTIME", "LOCALTIMESTAMP", "LOCATION", "LOCK",
- "LOCKED", "LOGS", "LONG", "LONGBLOB", "LONGTEXT",
- "LOW_PRIORITY", "MASTER", "MATCH", "MAX", "MAXVALUE",
- "MAX_CONNECTIONS_PER_HOUR", "MAX_IDXNUM", "MAX_MINUTES",
- "MAX_QUERIES_PER_HOUR", "MAX_ROWS",
- "MAX_UPDATES_PER_HOUR", "MAX_USER_CONNECTIONS", "MB",
- "MEDIUMBLOB", "MEDIUMINT", "MEDIUMTEXT", "MEMORY",
- "MERGE", "MICROSECOND", "MIN", "MINUTE",
- "MINUTE_MICROSECOND", "MINUTE_SECOND", "MINVALUE",
- "MIN_ROWS", "MOD", "MODE", "MODIFY", "MONTH", "NAMES",
- "NATIONAL", "NATURAL", "NCHAR", "NEVER", "NEXT",
- "NEXTVAL", "NEXT_ROW_ID", "NO", "NOCACHE", "NOCYCLE",
- "NODEGROUP", "NODE_ID", "NODE_STATE", "NOMAXVALUE",
- "NOMINVALUE", "NONCLUSTERED", "NONE", "NORMAL", "NOT",
- "NOW", "NOWAIT", "NO_WRITE_TO_BINLOG", "NTH_VALUE",
- "NTILE", "NULL", "NULLS", "NUMERIC", "NVARCHAR", "OF",
- "OFF", "OFFSET", "ON", "ONLINE", "ONLY", "ON_DUPLICATE",
- "OPEN", "OPTIMISTIC", "OPTIMIZE", "OPTION", "OPTIONAL",
- "OPTIONALLY", "OPT_RULE_BLACKLIST", "OR", "ORDER",
- "OUTER", "OUTFILE", "OVER", "PACK_KEYS", "PAGE", "PARSER",
- "PARTIAL", "PARTITION", "PARTITIONING", "PARTITIONS",
- "PASSWORD", "PERCENT", "PERCENT_RANK", "PER_DB",
- "PER_TABLE", "PESSIMISTIC", "PLACEMENT", "PLAN",
- "PLAN_CACHE", "PLUGINS", "POLICY", "POSITION",
- "PRECEDING", "PRECISION", "PREDICATE", "PREPARE",
- "PRESERVE", "PRE_SPLIT_REGIONS", "PRIMARY",
- "PRIMARY_REGION", "PRIVILEGES", "PROCEDURE", "PROCESS",
- "PROCESSLIST", "PROFILE", "PROFILES", "PROXY", "PUMP",
- "PURGE", "QUARTER", "QUERIES", "QUERY", "QUICK", "RANGE",
- "RANK", "RATE_LIMIT", "READ", "REAL", "REBUILD", "RECENT",
- "RECOVER", "RECURSIVE", "REDUNDANT", "REFERENCES",
- "REGEXP", "REGION", "REGIONS", "RELEASE", "RELOAD",
- "REMOVE", "RENAME", "REORGANIZE", "REPAIR", "REPEAT",
- "REPEATABLE", "REPLACE", "REPLAYER", "REPLICA",
- "REPLICAS", "REPLICATION", "REQUIRE", "REQUIRED", "RESET",
- "RESPECT", "RESTART", "RESTORE", "RESTORES", "RESTRICT",
- "RESUME", "REVERSE", "REVOKE", "RIGHT", "RLIKE", "ROLE",
- "ROLLBACK", "ROUTINE", "ROW", "ROWS", "ROW_COUNT", "ROW_FORMAT",
- "ROW_NUMBER", "RTREE", "RUN", "RUNNING", "S3", "SAMPLERATE", "SAMPLES",
- "SAN", "SAVEPOINT", "SCHEDULE", "SECOND", "SECONDARY_ENGINE",
- "SECONDARY_LOAD", "SECONDARY_UNLOAD", "SECOND_MICROSECOND", "SECURITY",
- "SELECT", "SEND_CREDENTIALS_TO_TIKV", "SEPARATOR", "SEQUENCE", "SERIAL",
- "SERIALIZABLE", "SESSION", "SESSION_STATES", "SET", "SETVAL",
- "SHARD_ROW_ID_BITS", "SHARE", "SHARED", "SHOW", "SHUTDOWN", "SIGNED",
- "SIMPLE", "SKIP", "SKIP_SCHEMA_FILES", "SLAVE", "SLOW", "SMALLINT",
- "SNAPSHOT", "SOME", "SOURCE", "SPATIAL", "SPLIT", "SQL", "SQL_BIG_RESULT",
- "SQL_BUFFER_RESULT", "SQL_CACHE", "SQL_CALC_FOUND_ROWS", "SQL_NO_CACHE",
- "SQL_SMALL_RESULT", "SQL_TSI_DAY", "SQL_TSI_HOUR", "SQL_TSI_MINUTE",
- "SQL_TSI_MONTH", "SQL_TSI_QUARTER", "SQL_TSI_SECOND", "SQL_TSI_WEEK",
- "SQL_TSI_YEAR", "SSL", "STALENESS", "START", "STARTING", "STATISTICS",
- "STATS", "STATS_AUTO_RECALC", "STATS_BUCKETS", "STATS_COL_CHOICE",
- "STATS_COL_LIST", "STATS_EXTENDED", "STATS_HEALTHY", "STATS_HISTOGRAMS",
- "STATS_META", "STATS_OPTIONS", "STATS_PERSISTENT", "STATS_SAMPLE_PAGES",
- "STATS_SAMPLE_RATE", "STATS_TOPN", "STATUS", "STD", "STDDEV", "STDDEV_POP",
- "STDDEV_SAMP", "STOP", "STORAGE", "STORED", "STRAIGHT_JOIN", "STRICT",
- "STRICT_FORMAT", "STRONG", "SUBDATE", "SUBJECT", "SUBPARTITION",
- "SUBPARTITIONS", "SUBSTRING", "SUM", "SUPER", "SWAPS", "SWITCHES",
- "SYSTEM", "SYSTEM_TIME", "TABLE", "TABLES", "TABLESAMPLE", "TABLESPACE",
- "TABLE_CHECKSUM", "TARGET", "TELEMETRY", "TELEMETRY_ID", "TEMPORARY",
- "TEMPTABLE", "TERMINATED", "TEXT", "THAN", "THEN", "TIDB", "TIFLASH",
- "TIKV_IMPORTER", "TIME", "TIMESTAMP", "TIMESTAMPADD", "TIMESTAMPDIFF",
- "TINYBLOB", "TINYINT", "TINYTEXT", "TLS", "TO", "TOKUDB_DEFAULT",
- "TOKUDB_FAST", "TOKUDB_LZMA", "TOKUDB_QUICKLZ", "TOKUDB_SMALL",
- "TOKUDB_SNAPPY", "TOKUDB_UNCOMPRESSED", "TOKUDB_ZLIB", "TOP", "TOPN",
- "TRACE", "TRADITIONAL", "TRAILING", "TRANSACTION", "TRIGGER", "TRIGGERS",
- "TRIM", "TRUE", "TRUE_CARD_COST", "TRUNCATE", "TYPE", "UNBOUNDED",
- "UNCOMMITTED", "UNDEFINED", "UNICODE", "UNION", "UNIQUE", "UNKNOWN",
- "UNLOCK", "UNSIGNED", "UPDATE", "USAGE", "USE", "USER", "USING",
- "UTC_DATE", "UTC_TIME", "UTC_TIMESTAMP", "VALIDATION", "VALUE", "VALUES",
- "VARBINARY", "VARCHAR", "VARCHARACTER", "VARIABLES", "VARIANCE", "VARYING",
- "VAR_POP", "VAR_SAMP", "VERBOSE", "VIEW", "VIRTUAL", "VISIBLE", "VOTER",
- "VOTERS", "VOTER_CONSTRAINTS", "WAIT", "WARNINGS", "WEEK", "WEIGHT_STRING",
- "WHEN", "WHERE", "WIDTH", "WINDOW", "WITH", "WITHOUT", "WRITE", "X509",
- "XOR", "YEAR", "YEAR_MONTH", "ZEROFILL"]
+ keywords = [
+ 'SELECT', 'FROM', 'WHERE', 'UPDATE', 'DELETE FROM', 'GROUP BY',
+ 'JOIN', 'INSERT INTO', 'LIKE', 'LIMIT', 'ACCESS', 'ADD', 'ALL',
+ 'ALTER TABLE', 'AND', 'ANY', 'AS', 'ASC', 'AUTO_INCREMENT',
+ 'BEFORE', 'BEGIN', 'BETWEEN', 'BIGINT', 'BINARY', 'BY', 'CASE',
+ 'CHANGE MASTER TO', 'CHAR', 'CHARACTER SET', 'CHECK', 'COLLATE',
+ 'COLUMN', 'COMMENT', 'COMMIT', 'CONSTRAINT', 'CREATE', 'CURRENT',
+ 'CURRENT_TIMESTAMP', 'DATABASE', 'DATE', 'DECIMAL', 'DEFAULT',
+ 'DESC', 'DESCRIBE', 'DROP', 'ELSE', 'END', 'ENGINE', 'ESCAPE',
+ 'EXISTS', 'FILE', 'FLOAT', 'FOR', 'FOREIGN KEY', 'FORMAT', 'FULL',
+ 'FUNCTION', 'GRANT', 'HAVING', 'HOST', 'IDENTIFIED', 'IN',
+ 'INCREMENT', 'INDEX', 'INT', 'INTEGER', 'INTERVAL', 'INTO', 'IS',
+ 'KEY', 'LEFT', 'LEVEL', 'LOCK', 'LOGS', 'LONG', 'MASTER',
+ 'MEDIUMINT', 'MODE', 'MODIFY', 'NOT', 'NULL', 'NUMBER', 'OFFSET',
+ 'ON', 'OPTION', 'OR', 'ORDER BY', 'OUTER', 'OWNER', 'PASSWORD',
+ 'PORT', 'PRIMARY', 'PRIVILEGES', 'PROCESSLIST', 'PURGE',
+ 'REFERENCES', 'REGEXP', 'RENAME', 'REPAIR', 'RESET', 'REVOKE',
+ 'RIGHT', 'ROLLBACK', 'ROW', 'ROWS', 'ROW_FORMAT', 'SAVEPOINT',
+ 'SESSION', 'SET', 'SHARE', 'SHOW', 'SLAVE', 'SMALLINT', 'SMALLINT',
+ 'START', 'STOP', 'TABLE', 'THEN', 'TINYINT', 'TO', 'TRANSACTION',
+ 'TRIGGER', 'TRUNCATE', 'UNION', 'UNIQUE', 'UNSIGNED', 'USE',
+ 'USER', 'USING', 'VALUES', 'VARCHAR', 'VIEW', 'WHEN', 'WITH'
+ ]
+
+ tidb_keywords = [
+ "SELECT", "FROM", "WHERE", "DELETE FROM", "UPDATE", "GROUP BY",
+ "JOIN", "INSERT INTO", "LIKE", "LIMIT", "ACCOUNT", "ACTION", "ADD",
+ "ADDDATE", "ADMIN", "ADVISE", "AFTER", "AGAINST", "AGO",
+ "ALGORITHM", "ALL", "ALTER", "ALWAYS", "ANALYZE", "AND", "ANY",
+ "APPROX_COUNT_DISTINCT", "APPROX_PERCENTILE", "AS", "ASC", "ASCII",
+ "ATTRIBUTES", "AUTO_ID_CACHE", "AUTO_INCREMENT", "AUTO_RANDOM",
+ "AUTO_RANDOM_BASE", "AVG", "AVG_ROW_LENGTH", "BACKEND", "BACKUP",
+ "BACKUPS", "BATCH", "BEGIN", "BERNOULLI", "BETWEEN", "BIGINT",
+ "BINARY", "BINDING", "BINDINGS", "BINDING_CACHE", "BINLOG", "BIT",
+ "BIT_AND", "BIT_OR", "BIT_XOR", "BLOB", "BLOCK", "BOOL", "BOOLEAN",
+ "BOTH", "BOUND", "BRIEF", "BTREE", "BUCKETS", "BUILTINS", "BY",
+ "BYTE", "CACHE", "CALL", "CANCEL", "CAPTURE", "CARDINALITY",
+ "CASCADE", "CASCADED", "CASE", "CAST", "CAUSAL", "CHAIN", "CHANGE",
+ "CHAR", "CHARACTER", "CHARSET", "CHECK", "CHECKPOINT", "CHECKSUM",
+ "CIPHER", "CLEANUP", "CLIENT", "CLIENT_ERRORS_SUMMARY",
+ "CLUSTERED", "CMSKETCH", "COALESCE", "COLLATE", "COLLATION",
+ "COLUMN", "COLUMNS", "COLUMN_FORMAT", "COLUMN_STATS_USAGE",
+ "COMMENT", "COMMIT", "COMMITTED", "COMPACT", "COMPRESSED",
+ "COMPRESSION", "CONCURRENCY", "CONFIG", "CONNECTION",
+ "CONSISTENCY", "CONSISTENT", "CONSTRAINT", "CONSTRAINTS",
+ "CONTEXT", "CONVERT", "COPY", "CORRELATION", "CPU", "CREATE",
+ "CROSS", "CSV_BACKSLASH_ESCAPE", "CSV_DELIMITER", "CSV_HEADER",
+ "CSV_NOT_NULL", "CSV_NULL", "CSV_SEPARATOR",
+ "CSV_TRIM_LAST_SEPARATORS", "CUME_DIST", "CURRENT", "CURRENT_DATE",
+ "CURRENT_ROLE", "CURRENT_TIME", "CURRENT_TIMESTAMP",
+ "CURRENT_USER", "CURTIME", "CYCLE", "DATA", "DATABASE",
+ "DATABASES", "DATE", "DATETIME", "DATE_ADD", "DATE_SUB", "DAY",
+ "DAY_HOUR", "DAY_MICROSECOND", "DAY_MINUTE", "DAY_SECOND", "DDL",
+ "DEALLOCATE", "DECIMAL", "DEFAULT", "DEFINER", "DELAYED",
+ "DELAY_KEY_WRITE", "DENSE_RANK", "DEPENDENCY", "DEPTH", "DESC",
+ "DESCRIBE", "DIRECTORY", "DISABLE", "DISABLED", "DISCARD", "DISK",
+ "DISTINCT", "DISTINCTROW", "DIV", "DO", "DOT", "DOUBLE", "DRAINER",
+ "DROP", "DRY", "DUAL", "DUMP", "DUPLICATE", "DYNAMIC", "ELSE",
+ "ENABLE", "ENABLED", "ENCLOSED", "ENCRYPTION", "END", "ENFORCED",
+ "ENGINE", "ENGINES", "ENUM", "ERROR", "ERRORS", "ESCAPE",
+ "ESCAPED", "EVENT", "EVENTS", "EVOLVE", "EXACT", "EXCEPT",
+ "EXCHANGE", "EXCLUSIVE", "EXECUTE", "EXISTS", "EXPANSION",
+ "EXPIRE", "EXPLAIN", "EXPR_PUSHDOWN_BLACKLIST", "EXTENDED",
+ "EXTRACT", "FALSE", "FAST", "FAULTS", "FETCH", "FIELDS", "FILE",
+ "FIRST", "FIRST_VALUE", "FIXED", "FLASHBACK", "FLOAT", "FLUSH",
+ "FOLLOWER", "FOLLOWERS", "FOLLOWER_CONSTRAINTS", "FOLLOWING",
+ "FOR", "FORCE", "FOREIGN", "FORMAT", "FULL", "FULLTEXT",
+ "FUNCTION", "GENERAL", "GENERATED", "GET_FORMAT", "GLOBAL",
+ "GRANT", "GRANTS", "GROUPS", "GROUP_CONCAT", "HASH", "HAVING",
+ "HELP", "HIGH_PRIORITY", "HISTOGRAM", "HISTOGRAMS_IN_FLIGHT",
+ "HISTORY", "HOSTS", "HOUR", "HOUR_MICROSECOND", "HOUR_MINUTE",
+ "HOUR_SECOND", "IDENTIFIED", "IF", "IGNORE", "IMPORT", "IMPORTS",
+ "IN", "INCREMENT", "INCREMENTAL", "INDEX", "INDEXES", "INFILE",
+ "INNER", "INPLACE", "INSERT_METHOD", "INSTANCE",
+ "INSTANT", "INT", "INT1", "INT2", "INT3", "INT4", "INT8",
+ "INTEGER", "INTERNAL", "INTERSECT", "INTERVAL", "INTO",
+ "INVISIBLE", "INVOKER", "IO", "IPC", "IS", "ISOLATION", "ISSUER",
+ "JOB", "JOBS", "JSON", "JSON_ARRAYAGG", "JSON_OBJECTAGG", "KEY",
+ "KEYS", "KEY_BLOCK_SIZE", "KILL", "LABELS", "LAG", "LANGUAGE",
+ "LAST", "LASTVAL", "LAST_BACKUP", "LAST_VALUE", "LEAD", "LEADER",
+ "LEADER_CONSTRAINTS", "LEADING", "LEARNER", "LEARNERS",
+ "LEARNER_CONSTRAINTS", "LEFT", "LESS", "LEVEL", "LINEAR", "LINES",
+ "LIST", "LOAD", "LOCAL", "LOCALTIME", "LOCALTIMESTAMP", "LOCATION",
+ "LOCK", "LOCKED", "LOGS", "LONG", "LONGBLOB", "LONGTEXT",
+ "LOW_PRIORITY", "MASTER", "MATCH", "MAX", "MAXVALUE",
+ "MAX_CONNECTIONS_PER_HOUR", "MAX_IDXNUM", "MAX_MINUTES",
+ "MAX_QUERIES_PER_HOUR", "MAX_ROWS", "MAX_UPDATES_PER_HOUR",
+ "MAX_USER_CONNECTIONS", "MB", "MEDIUMBLOB", "MEDIUMINT",
+ "MEDIUMTEXT", "MEMORY", "MERGE", "MICROSECOND", "MIN", "MINUTE",
+ "MINUTE_MICROSECOND", "MINUTE_SECOND", "MINVALUE", "MIN_ROWS",
+ "MOD", "MODE", "MODIFY", "MONTH", "NAMES", "NATIONAL", "NATURAL",
+ "NCHAR", "NEVER", "NEXT", "NEXTVAL", "NEXT_ROW_ID", "NO",
+ "NOCACHE", "NOCYCLE", "NODEGROUP", "NODE_ID", "NODE_STATE",
+ "NOMAXVALUE", "NOMINVALUE", "NONCLUSTERED", "NONE", "NORMAL",
+ "NOT", "NOW", "NOWAIT", "NO_WRITE_TO_BINLOG", "NTH_VALUE", "NTILE",
+ "NULL", "NULLS", "NUMERIC", "NVARCHAR", "OF", "OFF", "OFFSET",
+ "ON", "ONLINE", "ONLY", "ON_DUPLICATE", "OPEN", "OPTIMISTIC",
+ "OPTIMIZE", "OPTION", "OPTIONAL", "OPTIONALLY",
+ "OPT_RULE_BLACKLIST", "OR", "ORDER", "OUTER", "OUTFILE", "OVER",
+ "PACK_KEYS", "PAGE", "PARSER", "PARTIAL", "PARTITION",
+ "PARTITIONING", "PARTITIONS", "PASSWORD", "PERCENT",
+ "PERCENT_RANK", "PER_DB", "PER_TABLE", "PESSIMISTIC", "PLACEMENT",
+ "PLAN", "PLAN_CACHE", "PLUGINS", "POLICY", "POSITION", "PRECEDING",
+ "PRECISION", "PREDICATE", "PREPARE", "PRESERVE",
+ "PRE_SPLIT_REGIONS", "PRIMARY", "PRIMARY_REGION", "PRIVILEGES",
+ "PROCEDURE", "PROCESS", "PROCESSLIST", "PROFILE", "PROFILES",
+ "PROXY", "PUMP", "PURGE", "QUARTER", "QUERIES", "QUERY", "QUICK",
+ "RANGE", "RANK", "RATE_LIMIT", "READ", "REAL", "REBUILD", "RECENT",
+ "RECOVER", "RECURSIVE", "REDUNDANT", "REFERENCES", "REGEXP",
+ "REGION", "REGIONS", "RELEASE", "RELOAD", "REMOVE", "RENAME",
+ "REORGANIZE", "REPAIR", "REPEAT", "REPEATABLE", "REPLACE",
+ "REPLAYER", "REPLICA", "REPLICAS", "REPLICATION", "REQUIRE",
+ "REQUIRED", "RESET", "RESPECT", "RESTART", "RESTORE", "RESTORES",
+ "RESTRICT", "RESUME", "REVERSE", "REVOKE", "RIGHT", "RLIKE",
+ "ROLE", "ROLLBACK", "ROUTINE", "ROW", "ROWS", "ROW_COUNT",
+ "ROW_FORMAT", "ROW_NUMBER", "RTREE", "RUN", "RUNNING", "S3",
+ "SAMPLERATE", "SAMPLES", "SAN", "SAVEPOINT", "SCHEDULE", "SECOND",
+ "SECONDARY_ENGINE", "SECONDARY_LOAD", "SECONDARY_UNLOAD",
+ "SECOND_MICROSECOND", "SECURITY", "SEND_CREDENTIALS_TO_TIKV",
+ "SEPARATOR", "SEQUENCE", "SERIAL", "SERIALIZABLE", "SESSION",
+ "SESSION_STATES", "SET", "SETVAL", "SHARD_ROW_ID_BITS", "SHARE",
+ "SHARED", "SHOW", "SHUTDOWN", "SIGNED", "SIMPLE", "SKIP",
+ "SKIP_SCHEMA_FILES", "SLAVE", "SLOW", "SMALLINT", "SNAPSHOT",
+ "SOME", "SOURCE", "SPATIAL", "SPLIT", "SQL", "SQL_BIG_RESULT",
+ "SQL_BUFFER_RESULT", "SQL_CACHE", "SQL_CALC_FOUND_ROWS",
+ "SQL_NO_CACHE", "SQL_SMALL_RESULT", "SQL_TSI_DAY", "SQL_TSI_HOUR",
+ "SQL_TSI_MINUTE", "SQL_TSI_MONTH", "SQL_TSI_QUARTER",
+ "SQL_TSI_SECOND", "SQL_TSI_WEEK", "SQL_TSI_YEAR", "SSL",
+ "STALENESS", "START", "STARTING", "STATISTICS", "STATS",
+ "STATS_AUTO_RECALC", "STATS_BUCKETS", "STATS_COL_CHOICE",
+ "STATS_COL_LIST", "STATS_EXTENDED", "STATS_HEALTHY",
+ "STATS_HISTOGRAMS", "STATS_META", "STATS_OPTIONS",
+ "STATS_PERSISTENT", "STATS_SAMPLE_PAGES", "STATS_SAMPLE_RATE",
+ "STATS_TOPN", "STATUS", "STD", "STDDEV", "STDDEV_POP",
+ "STDDEV_SAMP", "STOP", "STORAGE", "STORED", "STRAIGHT_JOIN",
+ "STRICT", "STRICT_FORMAT", "STRONG", "SUBDATE", "SUBJECT",
+ "SUBPARTITION", "SUBPARTITIONS", "SUBSTRING", "SUM", "SUPER",
+ "SWAPS", "SWITCHES", "SYSTEM", "SYSTEM_TIME", "TABLE", "TABLES",
+ "TABLESAMPLE", "TABLESPACE", "TABLE_CHECKSUM", "TARGET",
+ "TELEMETRY", "TELEMETRY_ID", "TEMPORARY", "TEMPTABLE",
+ "TERMINATED", "TEXT", "THAN", "THEN", "TIDB", "TIFLASH",
+ "TIKV_IMPORTER", "TIME", "TIMESTAMP", "TIMESTAMPADD",
+ "TIMESTAMPDIFF", "TINYBLOB", "TINYINT", "TINYTEXT", "TLS", "TO",
+ "TOKUDB_DEFAULT", "TOKUDB_FAST", "TOKUDB_LZMA", "TOKUDB_QUICKLZ",
+ "TOKUDB_SMALL", "TOKUDB_SNAPPY", "TOKUDB_UNCOMPRESSED",
+ "TOKUDB_ZLIB", "TOP", "TOPN", "TRACE", "TRADITIONAL", "TRAILING",
+ "TRANSACTION", "TRIGGER", "TRIGGERS", "TRIM", "TRUE",
+ "TRUE_CARD_COST", "TRUNCATE", "TYPE", "UNBOUNDED", "UNCOMMITTED",
+ "UNDEFINED", "UNICODE", "UNION", "UNIQUE", "UNKNOWN", "UNLOCK",
+ "UNSIGNED", "USAGE", "USE", "USER", "USING", "UTC_DATE",
+ "UTC_TIME", "UTC_TIMESTAMP", "VALIDATION", "VALUE", "VALUES",
+ "VARBINARY", "VARCHAR", "VARCHARACTER", "VARIABLES", "VARIANCE",
+ "VARYING", "VAR_POP", "VAR_SAMP", "VERBOSE", "VIEW", "VIRTUAL",
+ "VISIBLE", "VOTER", "VOTERS", "VOTER_CONSTRAINTS", "WAIT",
+ "WARNINGS", "WEEK", "WEIGHT_STRING", "WHEN", "WIDTH", "WINDOW",
+ "WITH", "WITHOUT", "WRITE", "X509", "XOR", "YEAR", "YEAR_MONTH",
+ "ZEROFILL"
+ ]
functions = ['AVG', 'CONCAT', 'COUNT', 'DISTINCT', 'FIRST', 'FORMAT',
'FROM_UNIXTIME', 'LAST', 'LCASE', 'LEN', 'MAX', 'MID',
- 'MIN', 'NOW', 'ROUND', 'SUM', 'TOP', 'UCASE', 'UNIX_TIMESTAMP']
+ 'MIN', 'NOW', 'ROUND', 'SUM', 'TOP', 'UCASE',
+ 'UNIX_TIMESTAMP'
+ ]
show_items = []
@@ -366,13 +364,13 @@ class SQLCompleter(Completer):
if fuzzy:
regex = '.*?'.join(map(escape, text))
pat = compile('(%s)' % regex)
- for item in sorted(collection):
+ for item in collection:
r = pat.search(item.lower())
if r:
completions.append((len(r.group()), r.start(), item))
else:
match_end_limit = len(text) if start_only else None
- for item in sorted(collection):
+ for item in collection:
match_point = item.lower().find(text, 0, match_end_limit)
if match_point >= 0:
completions.append((len(text), match_point, item))
@@ -386,7 +384,7 @@ class SQLCompleter(Completer):
return kw.lower()
return (Completion(z if casing is None else apply_case(z), -len(text))
- for x, y, z in sorted(completions))
+ for x, y, z in completions)
def get_completions(self, document, complete_event, smart_completion=None):
word_before_cursor = document.get_word_before_cursor(WORD=True)