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

Example column_defs_lowlevel.py fails #129

Closed
john-g-g opened this issue Feb 15, 2014 · 1 comment · Fixed by #255
Closed

Example column_defs_lowlevel.py fails #129

john-g-g opened this issue Feb 15, 2014 · 1 comment · Fixed by #255

Comments

@john-g-g
Copy link

$ python ./column_defs_lowlevel.py
Traceback (most recent call last):
  File "./column_defs_lowlevel.py", line 44, in <module>
    columns = extract_definitions(par)
  File "./column_defs_lowlevel.py", line 25, in extract_definitions
    token = token_list.token_next(0)
AttributeError: 'NoneType' object has no attribute 'token_next'
@darKoram
Copy link

darKoram commented Dec 8, 2014

I see the same thing. I tried first with python3 using 2to3 to convert it on my macosx from git pull of trunk.
Then I tried the regular pip-installed version.

Stepping through with the debugger, it seems the problem is that the token_by_next_index

    for token in self.tokens[idx:]:
        if isinstance(token, clss):
            return token

self.tokens[idx:] is a list with six tokens. Neglecting whitespace, they are
[CREATE, TABLE,
token = {Function} foo (
id integer primary key,
title varchar(200) not null,
description text
)
]

Is the token group getting recognized as a function instead of a parens group?

ovr pushed a commit to cube-js/sqlparse that referenced this issue Dec 26, 2020
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

Successfully merging a pull request may close this issue.

2 participants