-
Notifications
You must be signed in to change notification settings - Fork 699
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
"Create Table table_name Like existing_table_name" DDL Support #543
Comments
This is introduced by #525 and released in 0.3.1 version As in v0.3.0 >>> sqlparse.parse("CREATE TABLE tab1 LIKE tab2;")[0].tokens
[<DDL 'CREATE' at 0x7F37552F1468>,
<Whitespace ' ' at 0x7F37552FC048>,
<Keyword 'TABLE' at 0x7F37552FC0A8>,
<Whitespace ' ' at 0x7F37552FC108>,
<Identifier 'tab1' at 0x7F37552F90C0>,
<Whitespace ' ' at 0x7F37552FC1C8>,
<Keyword 'LIKE' at 0x7F37552FC228>,
<Whitespace ' ' at 0x7F37552FC288>,
<Identifier 'tab2' at 0x7F37552F9138>,
<Punctuation ';' at 0x7F37552FC348>] As in v0.3.1 >>> sqlparse.parse("CREATE TABLE tab1 LIKE tab2;")[0].tokens
[<DDL 'CREATE' at 0x7F2CE8DD89A8>,
<Whitespace ' ' at 0x7F2CE8DD8A68>,
<Keyword 'TABLE' at 0x7F2CE8DD8AC8>,
<Whitespace ' ' at 0x7F2CE8DD8B28>,
<Comparison 'tab1 L...' at 0x7F2CE8DAF840>,
<Punctuation ';' at 0x7F2CE8DD88E8>] For our case when LIKE appear in a DDL, to be parsed as KEYWORD in 0.3.0 is correct, however in 0.3.1, to address LIKE appear in WHERE clause, LIKE is parsed as COMPARISON even in DDL, which is wrong. |
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When parsing Create Table Like DDL:
"tab1 like tab2" as a whole will be parsed as Comparison. I think this is different situation from Comparison used in where clause. Any comments on this one?
The text was updated successfully, but these errors were encountered: