sqlparse icon indicating copy to clipboard operation
sqlparse copied to clipboard

A non-validating SQL parser module for Python

Results 194 sqlparse issues
Sort by recently updated
recently updated
newest added

The following two sql commands should be equivalent, but the missing space in the second case causes it not to recognize the select. I am starting now to use `sqlparse`,...

**Describe the bug** It appears that sqlparse is unable to parse an alter statement that aims to edit the row_format of a particular table. When looking at the tokens, it...

Resolves #543. By skipping over setting `LIKE` statements as Comparisons during lexing phase. We then more thoroughly check its usage during grouping. If we are creating a TABLE (identified based...

WHERE语句中出现uid列时解析语法树,导致判断语句解析失败。 **To Reproduce** 测试代码 ``` sql_1 = 'SELECT * FROM users WHERE uid = 1 ' sql_2 = 'SELECT * FROM users WHERE id = 1 ' statement_1 = sqlparse.parse(sql_1)[0]...

par level should decrease when ')' # Thanks for contributing! Before submitting your pull request please have a look at the following checklist: - [x] ran the tests (`pytest`) -...

**Describe the bug** A SQL containing aliased function calls is parsed (and formatted) wrong when the `AS` keyword is mussing. **To Reproduce** ```python good_sql_no_alias = "select extract(year from foo), extract(month...

Parser

**Describe the bug** The following query gets split into two, when it shouldn't be: ``` SELECT (')\'');a'); ``` **To Reproduce** https://sqlformat.org/ ``` SELECT (')\'');a'); ``` Yields: ``` SELECT (')\''); a');...

**Describe the bug** When parsing the `RENAME TABLE` sql statement by `sqlparse.parse` with this content: ```sql rename table `db`.`test1` to test2, `db`.`test3` to test4 ``` the result of ret[0].tokens: ```python...

This PR adds tracking of token source positions, accessible with new `pos` and `length` attributes on the `Token` class and its subclasses. As mentioned in the corresponding issue (#793), we've...

Hello 👋 We're big fans of sqlparse, particularly its leniency in the face of weird or just plain invalid syntax, and use it to power some aspects of a SQL...