codecov-io: # [Codecov](https://codecov.io/gh/reata/sqllineage/pull/19?src=pr&el=h1) Report
> Merging [#19](https://codecov.io/gh/reata/sqllineage/pull/19?src=pr&el=desc) into [master](https://codecov.io/gh/reata/sqllineage/commit/2901dd193c45e4ae0aab792ac0aaa11a04a2de1b?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/reata/sqllineage/pull/19/graphs/tree.svg?width=650&token=latkaw2Lx6&height=150&src=pr)](https://codecov.io/gh/reata/sqllineage/pull/19?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master      #19   +/-   ##
=======================================
  Coverage   79.38%   79.38%           
=======================================
  Files           1        1           
  Lines          97       97           
=======================================
  Hits           77       77           
  Misses         20       20
```


| [Impacted Files](https://codecov.io/gh/reata/sqllineage/pull/19?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [sqllineage/core.py](https://codecov.io/gh/reata/sqllineage/pull/19/diff?src=pr&el=tree#diff-c3FsbGluZWFnZS9jb3JlLnB5) | `79.38% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/reata/sqllineage/pull/19?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/reata/sqllineage/pull/19?src=pr&el=footer). Last update [2901dd1...9c8b269](https://codecov.io/gh/reata/sqllineage/pull/19?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

diff --git a/sqllineage/core.py b/sqllineage/core.py
index 2f5e0b6..fbf17f2 100644
--- a/sqllineage/core.py
+++ b/sqllineage/core.py
@@ -4,7 +4,7 @@ from typing import List, Set
 
 import sqlparse
 from sqlparse.sql import Function, Identifier, Parenthesis, Statement, TokenList
-from sqlparse.tokens import Keyword, Token, Whitespace
+from sqlparse.tokens import Keyword, Token
 
 SOURCE_TABLE_TOKENS = ('FROM', 'JOIN', 'INNER JOIN', 'LEFT JOIN', 'RIGHT JOIN', 'LEFT OUTER JOIN', 'RIGHT OUTER JOIN',
                        'FULL OUTER JOIN', 'CROSS JOIN')
@@ -69,7 +69,7 @@ Target Tables:
                 self._target_tables.add(sub_token.get_alias())
                 continue
             if source_table_token_flag:
-                if sub_token.ttype == Whitespace:
+                if sub_token.is_whitespace:
                     continue
                 else:
                     assert isinstance(sub_token, Identifier)
@@ -82,7 +82,7 @@ Target Tables:
                         self._source_tables.add(sub_token.get_real_name())
                     source_table_token_flag = False
             elif target_table_token_flag:
-                if sub_token.ttype == Whitespace:
+                if sub_token.is_whitespace:
                     continue
                 elif isinstance(sub_token, Function):
                     # insert into tab (col1, col2), tab (col1, col2) will be parsed as Function
@@ -95,7 +95,7 @@ Target Tables:
                     self._target_tables.add(sub_token.get_real_name())
                     target_table_token_flag = False
             elif temp_table_token_flag:
-                if sub_token.ttype == Whitespace:
+                if sub_token.is_whitespace:
                     continue
                 else:
                     assert isinstance(sub_token, Identifier)

multi-line sql causes AssertionError
```sql
SELECT * FROM
tab1
```
causes following exception

Traceback (most recent call last):
  File "/home/admin/.pyenv/versions/3.6.8/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/admin/.pyenv/versions/3.6.8/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/admin/repos/sqllineage/sqllineage/core.py", line 131, in <module>
    main()
  File "/home/admin/repos/sqllineage/sqllineage/core.py", line 119, in main
    print(LineageParser(sql))
  File "/home/admin/repos/sqllineage/sqllineage/core.py", line 23, in __init__
    self._extract_from_token(stmt)
  File "/home/admin/repos/sqllineage/sqllineage/core.py", line 75, in _extract_from_token
    assert isinstance(sub_token, Identifier)
AssertionError
diff --git a/tests/test_select.py b/tests/test_select.py
index 49fe323..8837091 100644
--- a/tests/test_select.py
+++ b/tests/test_select.py
@@ -5,6 +5,11 @@ def test_select():
     helper("SELECT col1 FROM tab1", {"tab1"})
 
 
+def test_select_multi_line():
+    helper("""SELECT col1 FROM
+tab1""", {"tab1"})
+
+
 def test_select_asterisk():
     helper("SELECT * FROM tab1", {"tab1"})
 

pip install -e .
parse_log_pytest
pytest
pytest flake8
3.7
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///croot/attrs_1668696182826/work
certifi @ file:///croot/certifi_1671487769961/work/certifi
flake8==5.0.4
flit_core @ file:///opt/conda/conda-bld/flit-core_1644941570762/work/source/flit_core
importlib-metadata==4.2.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
mccabe==0.7.0
packaging @ file:///croot/packaging_1671697413597/work
pluggy @ file:///tmp/build/80754af9/pluggy_1648042572264/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pycodestyle==2.9.1
pyflakes==2.5.0
pytest==7.1.2
-e git+https://github.com/reata/sqllineage.git@2901dd193c45e4ae0aab792ac0aaa11a04a2de1b#egg=sqllineage
sqlparse==0.3.1
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
typing_extensions @ file:///croot/typing_extensions_1669924550328/work
zipp @ file:///croot/zipp_1672387121353/work

name: sqllineage
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=22.1.0=py37h06a4308_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - flit-core=3.6.0=pyhd3eb1b0_0
  - importlib_metadata=4.11.3=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=22.0=py37h06a4308_0
  - pip=22.3.1=py37h06a4308_0
  - pluggy=1.0.0=py37h06a4308_1
  - py=1.11.0=pyhd3eb1b0_0
  - pytest=7.1.2=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tomli=2.0.1=py37h06a4308_0
  - typing_extensions=4.4.0=py37h06a4308_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.11.0=py37h06a4308_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - flake8==5.0.4
      - importlib-metadata==4.2.0
      - mccabe==0.7.0
      - pycodestyle==2.9.1
      - pyflakes==2.5.0
      - sqlparse==0.3.1
prefix: /opt/conda/envs/sqllineage

tests/test_select.py::test_select_multi_line
tests/test_select.py::test_select tests/test_select.py::test_select_asterisk tests/test_select.py::test_select_value tests/test_select.py::test_select_function tests/test_select.py::test_select_with_where tests/test_select.py::test_select_with_comment tests/test_select.py::test_select_keyword_as_column_alias tests/test_select.py::test_select_with_table_alias tests/test_select.py::test_select_count tests/test_select.py::test_select_subquery tests/test_select.py::test_select_inner_join tests/test_select.py::test_select_join tests/test_select.py::test_select_left_join tests/test_select.py::test_select_left_semi_join tests/test_select.py::test_select_left_semi_join_with_on tests/test_select.py::test_select_right_join tests/test_select.py::test_select_full_outer_join tests/test_select.py::test_select_full_outer_join_with_full_as_alias tests/test_select.py::test_select_cross_join tests/test_select.py::test_select_cross_join_with_on tests/test_select.py::test_select_join_with_subquery tests/test_select.py::test_with_select
sqllineage/core.py
sqllineage/core.py