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

exception for subquery expression without source tables #401

Closed
reata opened this issue Jul 2, 2023 · 0 comments · Fixed by #397
Closed

exception for subquery expression without source tables #401

reata opened this issue Jul 2, 2023 · 0 comments · Fixed by #397
Labels
bug Something isn't working

Comments

@reata
Copy link
Owner

reata commented Jul 2, 2023

SELECT (SELECT col1 + col2 AS result) AS sum_result
FROM bar
$ sqllineage -f test.sql 
Traceback (most recent call last):
  File "/home/hujunwei/.pyenv/versions/3.8.6/bin/sqllineage", line 8, in <module>
    sys.exit(main())
  File "/home/hujunwei/.pyenv/versions/3.8.6/lib/python3.8/site-packages/sqllineage/cli.py", line 101, in main
    runner.print_table_lineage()
  File "/home/hujunwei/.pyenv/versions/3.8.6/lib/python3.8/site-packages/sqllineage/runner.py", line 168, in print_table_lineage
    print(str(self))
  File "/home/hujunwei/.pyenv/versions/3.8.6/lib/python3.8/site-packages/sqllineage/runner.py", line 22, in wrapper
    self._eval()
  File "/home/hujunwei/.pyenv/versions/3.8.6/lib/python3.8/site-packages/sqllineage/runner.py", line 177, in _eval
    self._stmt_holders = [analyzer.analyze(stmt) for stmt in self._stmt]
  File "/home/hujunwei/.pyenv/versions/3.8.6/lib/python3.8/site-packages/sqllineage/runner.py", line 177, in <listcomp>
    self._stmt_holders = [analyzer.analyze(stmt) for stmt in self._stmt]
  File "/home/hujunwei/.pyenv/versions/3.8.6/lib/python3.8/site-packages/sqllineage/core/parser/sqlparse/analyzer.py", line 62, in analyze
    self._extract_from_dml(stmt, AnalyzerContext())
  File "/home/hujunwei/.pyenv/versions/3.8.6/lib/python3.8/site-packages/sqllineage/core/parser/sqlparse/analyzer.py", line 221, in _extract_from_dml
    next_handler.handle(sub_token, holder)
  File "/home/hujunwei/.pyenv/versions/3.8.6/lib/python3.8/site-packages/sqllineage/core/parser/sqlparse/handlers/base.py", line 37, in handle
    self._handle(token, holder)
  File "/home/hujunwei/.pyenv/versions/3.8.6/lib/python3.8/site-packages/sqllineage/core/parser/sqlparse/handlers/source.py", line 65, in _handle
    self._handle_column(token)
  File "/home/hujunwei/.pyenv/versions/3.8.6/lib/python3.8/site-packages/sqllineage/core/parser/sqlparse/handlers/source.py", line 112, in _handle_column
    self.columns.append(SqlParseColumn.of(token))
  File "/home/hujunwei/.pyenv/versions/3.8.6/lib/python3.8/site-packages/sqllineage/core/parser/sqlparse/models.py", line 76, in of
    source_columns = SqlParseColumn._extract_source_columns(expr)
  File "/home/hujunwei/.pyenv/versions/3.8.6/lib/python3.8/site-packages/sqllineage/core/parser/sqlparse/models.py", line 118, in _extract_source_columns
    source_columns = [
  File "/home/hujunwei/.pyenv/versions/3.8.6/lib/python3.8/site-packages/sqllineage/core/parser/sqlparse/models.py", line 119, in <listcomp>
    ColumnQualifierTuple(src_col.raw_name, src_col.parent.raw_name)
AttributeError: 'NoneType' object has no attribute 'raw_name'
@reata reata added the bug Something isn't working label Jul 2, 2023
@reata reata closed this as completed in #397 Jul 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant