summaryrefslogtreecommitdiff
path: root/sqlparse/keywords.py
Commit message (Collapse)AuthorAgeFilesLines
* Avoid formatting of psql commands (fixes #469).Andi Albrecht2019-03-111-0/+2
|
* [tokenizer] Grouping GROUP/ORDER BYJohn Bodley2019-03-101-0/+2
|
* [keywords] Adding Calcite temporal keywordsJohn Bodley2019-03-101-0/+4
|
* Add in slash comment functionalityIan Robertson2019-03-101-2/+2
|
* Code cleanup.Andreas Albrecht2019-03-101-4/+4
|
* Fix from( parsing issue (fixes #446)Fredy Wijaya2018-12-031-1/+1
|
* Fix reindent issue for parenthesis (fixes issue 427)Fredy Wijaya2018-12-031-1/+1
|
* Update copyright header (fixes #372).Andi Albrecht2018-07-311-1/+2
|
* Add UPSERT keyword (fixes #408).Andi Albrecht2018-07-311-0/+1
|
* Add missing EXPLAIN keyword (fixes #421).Andi Albrecht2018-07-281-0/+1
|
* Fix incorrect splitting with double quotes and a new lineFredy Wijaya2018-03-091-0/+1
|
* Add more Postgres types. [1]Jesse Claven2017-12-181-0/+27
| | | | [1] https://www.postgresql.org/docs/9.5/static/datatype.html#DATATYPE-TABLE
* Fix typostypoVictor Uriarte2017-11-291-2/+2
|
* Merge branch 'master' into masterAndi Albrecht2017-09-211-10/+27
|\
| * Code cleanup.Andi Albrecht2017-09-141-11/+11
| |
| * Merge pull request #357 from Demetrio92/masterAndi Albrecht2017-09-141-0/+16
| |\ | | | | | | add PL/pgSQL syntax
| | * add PL/pgSQL syntaxDemetrio922017-08-071-0/+16
| | | | | | | | | tested with mxtr/SQLTools
| * | Extend alphas with accented charactersmvbentes2017-08-251-7/+7
| |/
| * Don't treat sysdate as a builtin (fixes #344).Andi Albrecht2017-07-291-1/+1
| | | | | | | | | | | | According to Oracle's developer documentation sysdate is a function that doesn't require any parameters. Hence it's different from other builtins like int or varchar.
| * Recognize MySQL table names starting with digits (fixes #337).Andi Albrecht2017-05-251-2/+2
| |
| * Add MySQL keywords: ENGINE, AUTO_INCREMENT, CHARSETOleg Broytman2017-05-111-0/+3
| | | | | | | | | | | | | | | | | | These are keywords from table options: CREATE TABLE name ( column definitions, ... ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
* | adds '1.' option support for float numbers regexatronah2017-04-301-2/+3
|/
* Add UNLOCK keywordOleg Broytman2017-04-141-0/+1
|
* CONCURRENTLY should be handled as a keywordRowan Seymour2017-02-091-0/+1
|
* Don't treat GROUPS as a keyword, it's too common for table names.Andi Albrecht2017-01-241-1/+2
|
* Don't treat STATE as a keyword, it causes too much troubles (fixes #296).Andi Albrecht2017-01-231-1/+1
|
* Fix parsing of UNION ALL (fixes #294).Andi Albrecht2016-09-261-0/+1
|
* Correct license link (fixes #288).Andi Albrecht2016-09-141-1/+1
|
* Fix parsing of names containing special chars (fixes 291).Andi Albrecht2016-09-141-2/+2
|
* Alternate solution for #277Victor Uriarte2016-08-131-1/+1
|
* Revert "Parse double dollars (PostgreSQL) as literal strings (fixes #277)."Victor Uriarte2016-08-131-11/+2
| | | | This reverts commit 2893bd1857d685cf892beac3a7429d03cf1a09f1.
* Parse double dollars (PostgreSQL) as literal strings (fixes #277).Andi Albrecht2016-08-131-2/+11
|
* Format keywords.pyVictor Uriarte2016-06-281-2/+4
|
* Merge pull request #269 from dlenski/oracle-11g-keywordsVik2016-06-281-1/+134
|\ | | | | add all Oracle 11g reserved words that aren't already in sqlparse.keywords
| * add all Oracle 11g NON-RESERVED keywords (in a separate dict, as @vmuriart ↵Dan Lenski2016-06-281-1/+106
| | | | | | | | suggested)
| * I think ROWID, ROWLABEL, ROWNUM, and SYSDATE should be classified as ↵Dan Lenski2016-06-261-4/+4
| | | | | | | | Name.Builtin rather than Keyword, since they are identifier-like
| * add all Oracle 11g reserved words that aren't already in sqlparse.keywordsDan Lenski2016-06-261-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Oracle has at least three categories of keywords: 1. reserved words (can't be used in unquoted identifiers) 2. "non-reserved" keywords (which have a specific syntactic meaning, but which *can* be used in unquoted identifiers… which is insane) 3. reserved words which are specific to PL/SQL (so probably shouldn't be considered special by sqlparse) This PR adds everything from #1 which sqlparse didn't already include. Some of these are used in other SQL databases as well (e.g. SYNONYM, ENABLE, DISABLE) while most are Oracle-specific. I referred to the Oracle 11g docs for these lists: http://docs.oracle.com/cd/B28359_01/appdev.111/b31231/appb.htm#BABGHAFH And I used the following script to find the ones that were missing from sqlparse: import sqlparse import textwrap # Oracle 11g reserved words: http://docs.oracle.com/cd/B28359_01/appdev.111/b31231/appb.htm#BABGHAFH reserved = { 'ACCESS', 'ELSE', 'MODIFY', 'START', 'ADD', 'EXCLUSIVE', 'NOAUDIT', 'SELECT', 'ALL', 'EXISTS', 'NOCOMPRESS', 'SESSION', 'ALTER', 'FILE', 'NOT', 'SET', 'AND', 'FLOAT', 'NOTFOUND', 'SHARE', 'ANY', 'FOR', 'NOWAIT', 'SIZE', 'ARRAYLEN', 'FROM', 'NULL', 'SMALLINT', 'AS', 'GRANT', 'NUMBER', 'SQLBUF', 'ASC', 'GROUP', 'OF', 'SUCCESSFUL', 'AUDIT', 'HAVING', 'OFFLINE', 'SYNONYM', 'BETWEEN', 'IDENTIFIED', 'ON', 'SYSDATE', 'BY', 'IMMEDIATE', 'ONLINE', 'TABLE', 'CHAR', 'IN', 'OPTION', 'THEN', 'CHECK', 'INCREMENT', 'OR', 'TO', 'CLUSTER', 'INDEX', 'ORDER', 'TRIGGER', 'COLUMN', 'INITIAL', 'PCTFREE', 'UID', 'COMMENT', 'INSERT', 'PRIOR', 'UNION', 'COMPRESS', 'INTEGER', 'PRIVILEGES', 'UNIQUE', 'CONNECT', 'INTERSECT', 'PUBLIC', 'UPDATE', 'CREATE', 'INTO', 'RAW', 'USER', 'CURRENT', 'IS', 'RENAME', 'VALIDATE', 'DATE', 'LEVEL', 'RESOURCE', 'VALUES', 'DECIMAL', 'LIKE', 'REVOKE', 'VARCHAR', 'DEFAULT', 'LOCK', 'ROW', 'VARCHAR2', 'DELETE', 'LONG', 'ROWID', 'VIEW', 'DESC', 'MAXEXTENTS', 'ROWLABEL', 'WHENEVER', 'DISTINCT', 'MINUS', 'ROWNUM', 'WHERE', 'DROP', 'MODE', 'ROWS', 'WITH', } # Oracle 11g "non-reserved" keywords (don't blame me, I didn't come up with this insane concept): # http://docs.oracle.com/cd/B28359_01/appdev.111/b31231/appb.htm#BABHJHFE keywords = { 'ADMIN', 'CURSOR', 'FOUND', 'MOUNT', 'AFTER', 'CYCLE', 'FUNCTION', 'NEXT', 'ALLOCATE', 'DATABASE', 'GO', 'NEW', 'ANALYZE', 'DATAFILE', 'GOTO', 'NOARCHIVELOG', 'ARCHIVE', 'DBA', 'GROUPS', 'NOCACHE', 'ARCHIVELOG', 'DEC', 'INCLUDING', 'NOCYCLE', 'AUTHORIZATION', 'DECLARE', 'INDICATOR', 'NOMAXVALUE', 'AVG', 'DISABLE', 'INITRANS', 'NOMINVALUE', 'BACKUP', 'DISMOUNT', 'INSTANCE', 'NONE', 'BEGIN', 'DOUBLE', 'INT', 'NOORDER', 'BECOME', 'DUMP', 'KEY', 'NORESETLOGS', 'BEFORE', 'EACH', 'LANGUAGE', 'NORMAL', 'BLOCK', 'ENABLE', 'LAYER', 'NOSORT', 'BODY', 'END', 'LINK', 'NUMERIC', 'CACHE', 'ESCAPE', 'LISTS', 'OFF', 'CANCEL', 'EVENTS', 'LOGFILE', 'OLD', 'CASCADE', 'EXCEPT', 'MANAGE', 'ONLY', 'CHANGE', 'EXCEPTIONS', 'MANUAL', 'OPEN', 'CHARACTER', 'EXEC', 'MAX', 'OPTIMAL', 'CHECKPOINT', 'EXPLAIN', 'MAXDATAFILES', 'OWN', 'CLOSE', 'EXECUTE', 'MAXINSTANCES', 'PACKAGE', 'COBOL', 'EXTENT', 'MAXLOGFILES', 'PARALLEL', 'COMMIT', 'EXTERNALLY', 'MAXLOGHISTORY', 'PCTINCREASE', 'COMPILE', 'FETCH', 'MAXLOGMEMBERS', 'PCTUSED', 'CONSTRAINT', 'FLUSH', 'MAXTRANS', 'PLAN', 'CONSTRAINTS', 'FREELIST', 'MAXVALUE', 'PLI', 'CONTENTS', 'FREELISTS', 'MIN', 'PRECISION', 'CONTINUE', 'FORCE', 'MINEXTENTS', 'PRIMARY', 'CONTROLFILE', 'FOREIGN', 'MINVALUE', 'PRIVATE', 'COUNT', 'FORTRAN', 'MODULE', 'PROCEDURE', 'PROFILE', 'SAVEPOINT', 'SQLSTATE', 'TRACING', 'QUOTA', 'SCHEMA', 'STATEMENT_ID', 'TRANSACTION', 'READ', 'SCN', 'STATISTICS', 'TRIGGERS', 'REAL', 'SECTION', 'STOP', 'TRUNCATE', 'RECOVER', 'SEGMENT', 'STORAGE', 'UNDER', 'REFERENCES', 'SEQUENCE', 'SUM', 'UNLIMITED', 'REFERENCING', 'SHARED', 'SWITCH', 'UNTIL', 'RESETLOGS', 'SNAPSHOT', 'SYSTEM', 'USE', 'RESTRICTED', 'SOME', 'TABLES', 'USING', 'REUSE', 'SORT', 'TABLESPACE', 'WHEN', 'ROLE', 'SQL', 'TEMPORARY', 'WRITE', 'ROLES', 'SQLCODE', 'THREAD', 'WORK', 'ROLLBACK', 'SQLERROR', 'TIME' } # Oracle 11g reserved words for PL/SQL only: # http://docs.oracle.com/cd/B28359_01/appdev.111/b31231/appb.htm#BABDFFBA plsql_reserved = { 'ABORT', 'BETWEEN', 'CRASH', 'DIGITS', 'ACCEPT', 'BINARY_INTEGER', 'CREATE', 'DISPOSE', 'ACCESS', 'BODY', 'CURRENT', 'DISTINCT', 'ADD', 'BOOLEAN', 'CURRVAL', 'DO', 'ALL', 'BY', 'CURSOR', 'DROP', 'ALTER', 'CASE', 'DATABASE', 'ELSE', 'AND', 'CHAR', 'DATA_BASE', 'ELSIF', 'ANY', 'CHAR_BASE', 'DATE', 'END', 'ARRAY', 'CHECK', 'DBA', 'ENTRY', 'ARRAYLEN', 'CLOSE', 'DEBUGOFF', 'EXCEPTION', 'AS', 'CLUSTER', 'DEBUGON', 'EXCEPTION_INIT', 'ASC', 'CLUSTERS', 'DECLARE', 'EXISTS', 'ASSERT', 'COLAUTH', 'DECIMAL', 'EXIT', 'ASSIGN', 'COLUMNS', 'DEFAULT', 'FALSE', 'AT', 'COMMIT', 'DEFINITION', 'FETCH', 'AUTHORIZATION', 'COMPRESS', 'DELAY', 'FLOAT', 'AVG', 'CONNECT', 'DELETE', 'FOR', 'BASE_TABLE', 'CONSTANT', 'DELTA', 'FORM', 'BEGIN', 'COUNT', 'DESC', 'FROM', 'FUNCTION', 'NEW', 'RELEASE', 'SUM', 'GENERIC', 'NEXTVAL', 'REMR', 'TABAUTH', 'GOTO', 'NOCOMPRESS', 'RENAME', 'TABLE', 'GRANT', 'NOT', 'RESOURCE', 'TABLES', 'GROUP', 'NULL', 'RETURN', 'TASK', 'HAVING', 'NUMBER', 'REVERSE', 'TERMINATE', 'IDENTIFIED', 'NUMBER_BASE', 'REVOKE', 'THEN', 'IF', 'OF', 'ROLLBACK', 'TO', 'IN', 'ON', 'ROWID', 'TRUE', 'INDEX', 'OPEN', 'ROWLABEL', 'TYPE', 'INDEXES', 'OPTION', 'ROWNUM', 'UNION', 'INDICATOR', 'OR', 'ROWTYPE', 'UNIQUE', 'INSERT', 'ORDER', 'RUN', 'UPDATE', 'INTEGER', 'OTHERS', 'SAVEPOINT', 'USE', 'INTERSECT', 'OUT', 'SCHEMA', 'VALUES', 'INTO', 'PACKAGE', 'SELECT', 'VARCHAR', 'IS', 'PARTITION', 'SEPARATE', 'VARCHAR2', 'LEVEL', 'PCTFREE', 'SET', 'VARIANCE', 'LIKE', 'POSITIVE', 'SIZE', 'VIEW', 'LIMITED', 'PRAGMA', 'SMALLINT', 'VIEWS', 'LOOP', 'PRIOR', 'SPACE', 'WHEN', 'MAX', 'PRIVATE', 'SQL', 'WHERE', 'MIN', 'PROCEDURE', 'SQLCODE', 'WHILE', 'MINUS', 'PUBLIC', 'SQLERRM', 'WITH', 'MLSLABEL', 'RAISE', 'START', 'WORK', 'MOD', 'RANGE', 'STATEMENT', 'XOR', 'MODE', 'REAL', 'STDDEV', 'NATURAL', 'RECORD', 'SUBTYPE' } - reserved for batch, name in ((reserved, 'Oracle 11g reserved words'), (keywords, 'Oracle 11g "non-reserved" keywords'), (plsql_reserved, 'Oracle 11g reserved words for PL/SQL only'),): missing = batch - set(sqlparse.keywords.KEYWORDS) - set(sqlparse.keywords.KEYWORDS_COMMON) if missing: print("{} out of {} {} are missing from sqlparse.keywords.KEYWORDS (v{}):".format(len(missing), len(batch), name, sqlparse.__version__)) print(textwrap.fill(repr(missing), initial_indent=' ', subsequent_indent=' ')) else: print("All {} {} are in from sqlparse.keywords.KEYWORDS (v{}).".format(len(batch), name, sqlparse.__version__))
* | Add RETURNING keywordDarik Gamble2016-06-241-0/+1
|/
* Rewrite regex to allow spaces between `name` and `.`Victor Uriarte2016-06-041-1/+5
|
* Clean regex for Number tokensVictor Uriarte2016-06-041-4/+6
|
* Simplify regex [^\W\d_]Victor Uriarte2016-06-041-6/+10
| | | | | | | | | | [^\W\d_] = [a-z] (when ignoring case) not( not (a-z, numbers, or _) or number or _ ) [(a-z or number or _) and not number and not _] [A-Z] Correct not null spacing
* Refactor regex Func/keyword exceptions togetherVictor Uriarte2016-06-041-5/+3
|
* Rewrite wildcard and placeholder regexVictor Uriarte2016-06-041-4/+7
|
* Improve Comment Regex and add Comment.Hint for OracleVictor Uriarte2016-06-041-4/+4
|
* Allow re to compile onceVictor Uriarte2016-06-041-0/+5
| | | | | Otherwise re will need to recompile everytime a call to tokenize is made.
* Simplify multi-line commentsVictor Uriarte2016-06-041-8/+3
|
* Add or Update copyright year to filesVictor Uriarte2016-06-041-0/+5
|
* Refactor var Lexer.tokens & func is_keywordVictor Uriarte2016-05-291-0/+67
|
* Token keyword correctionCauê Beloni2016-03-291-1/+1
|
* Ensure get_type() works for queries that use WITH.Andrew Tipton2016-03-021-1/+1
|