Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table name being parsed as a Function #217

Open
JalalMiftah opened this issue Dec 18, 2015 · 4 comments
Open

Table name being parsed as a Function #217

JalalMiftah opened this issue Dec 18, 2015 · 4 comments

Comments

@JalalMiftah
Copy link

Hi,

There is an issue when I try to parse this SQL statement:

INSERT INTO XYZ (ID, TYPE, DATA, TRANSACTION_ID, ENQUEUING_TIME, AVAILABILITY_TIME, LAST_RETRY_TIME, ATTEMPTS_COUNT, DEPENDENCY_INDICATOR, REJECT_QUEUE_INDICATOR, PEAK_TOKEN, LOGICAL_TRANSACTION_TIME)
VALUES (?,
?,
?,
?,
SYSDATE,
SYSDATE + ? / 86400,
NULL,
?,
?,
?,
?,
?)

When I parse it, I have this tag:

DML 'INSERT' at 0x06dc050>,
Whitespace ' ' at 0x06dc0a8>,
Keyword 'INTO' at 0x06dc100>,
Whitespace ' ' at 0x06dc158>,
Function 'XYZ ...' at 0x05f8f30>,
Whitespace ' ' at 0x077ed08>,
Keyword 'VALUES' at 0x077e9f0>,
Whitespace ' ' at 0x077eb50>,
Parenthesis '( ?, ?...' at 0x05f8ea8>

So the table name XYZ is being tagged as a Function.

Thank you for looking into it.

@jiffyclub
Copy link

I see this also in situations where a table name is followed by parentheses:

>>> sqlparse.parse('create table asdf.pants (id serial);')[0].tokens[4].tokens
[<Name 'asdf' at 0x1066ad9a8>,
 <Punctuation '.' at 0x1066ad9f8>,
 <Function 'pants ...' at 0x10669de48>]

@xueyumusic
Copy link

The column_defs_lowlevel.py in examples runs error due to the same problem...

@lichray
Copy link

lichray commented Feb 8, 2017

Caused by create table not in uppercase. Workaround is to format first. Please fix.

@LY1806620741
Copy link

any one solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants