Comments (2)
Thanks for reporting! This seems to be related to #692
Could you provide a (preferably minimal) example of a complete procedure statement and the changes you've made to _change_splitlevel
?
from sqlparse.
The entire procedure started with the following
\r\n\r\nCREATE PROCEDURE [dbo].[PopulateDimension] \r\nAS\r\nBEGIN\r\n\t-
The statement that was returned included tokens where the final token in that statement was a WHERE token. That WHERE token captured several downstream UPDATE procedures but also left a few other downstream UPDATE procedures out of that token. I troubleshooted by feeding in only the several section of sql that were bundled as one token and sql.parse worked as expected. I then walked back through the sql.parse function and realized the lexer was parsing as expected. I then continued to walk the process back to the _change_splitlevel where I noticed the comments regarding CREATE. Since my use case only requires starting from begin, I simply parsed out all text prior to BEGIN and sql.parse worked as expected. I realize this may not be helpful for updating the code base but I wanted to create a record so someone else who may be searching for a solution to why the parsing in bundling several functions and a possible method to work around. BTW...thanks for this package.
INSERT INTO Cartoon_Dimension(CARTOON_ID,
CARTOON_CODE,
CARTOON_NAME,
CARTOON_TITLE,
CARTOON_STATUS,
CARTOON_NUMBER,
CARTOON_DEPARTMENT,
CARTOON_SOURCE_SYSTEM,
CARTOON_CREATED_BY,
CARTOON_CREATED_DATE,
CARTOON_LAST_UPDATED_BY,
CARTOON_LAST_UPDATED_DATE)
SELECT
-1,--cast(PrOid as int) AS CARTOON_ID,
CartoonNum AS CARTOON_CODE,
CartoonNum AS CARTOON_NAME,
CartoonTitle AS CARTOON_TITLE,
'Not Available' AS CARTOON_STATUS,
CartoonNum AS CARTOON_NUMBER,
'Not Available' AS CARTOON_DEPARTMENT,
'Cartoon A' AS CARTOON_SOURCE_SYSTEM,
CARTOON_CREATED_BY,
GETDATE() AS CARTOON_CREATED_DATE,
CARTOON_CREATED_BY AS CARTOON_LAST_UPDated_BY,
GETDATE() AS CARTOON_LAST_UPDATED_DATE
FROM
[Cartoon_STAGING].dbo.STG_Catoon_Form
WHERE CartoonNum NOT IN (SELECT CARTOON_NUMBER FROM Cartoon_Dimension WHERE CARTOON_NUMBER IS NOT NULL);
-- COMMENT
UPDATE Cartoon_Dimension
SET CARTOON_RECORD = CARTOON.Record,
CARTOON_SUBMISSION_TYPE = CARTOON.ReviewCategory,
CARTOON_APPROVAL_EXPIRATION_DATE = CARTOON.DateExpiration,
CARTOON_APPROVAL_STATUS = CARTOON.Approved,
CARTOON_DESC = CARTOON.DescH,
CARTOON_GOALS = CARTOON.DescA,
CARTOON_DESIGN = CARTOON.Design
FROM Cartoon_Dimension, Cartoon_STAGING.dbo.STG_Cartoon_Form CARTOON
WHERE Cartoon_Dimension.CARTOON_NUMBER = CARTOON.NUM;
from sqlparse.
Related Issues (20)
- The group_order() function fails to identify an ordered identifier in the context when nested
- Token matching generates an exception when index is None
- WHERE clause eats custom Keyword but not others
- Column Extract Doesn't Work with Column Name of 'Range' and 'Section'
- In `CREATE MATERIALIZED VIEW` statements `MATERIALIZED` is not recognized as a keyword
- SQL Split Failure
- Linux Pandas.date_range doesn't include 02 AM even for utc tz
- Type annotations
- Can't access column from aggregates
- Expressions are being changed automatcally while parsing group by clause HOT 1
- UNKNOWN type in an INSERT HOT 1
- Dollar quoted strings (PostgreSQL) cannot follow an operator (e.g. `=$$Hello$$`)
- WHERE语句中出现uid列时解析语法树有问题
- Passing a heavily nested list to sqlparse.parse() leads to a Denial of Service due to RecursionError. HOT 1
- Stipping inline comments breaks the SQL. HOT 1
- Unable to parse ALTER statement with ROW_FORMAT into correct tokens
- Select not recognized if followed by a parenthesis HOT 1
- [Feature request] Generalize query
- Feature request: Add line breaks in long expressions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlparse.