Handle when column name wildcard is prefixed by table name
Query to reproduce:
parsed = Parser("""
with cte_one as (
select table_one.*
from table_one
)
select cte_one.column_one
from cte_one
""")
Above code will fail when getting parsed.columns. But if the query of cte_one is select * from table_one it is succeeded.
This PR add handler for if f"{table}.*" in subparser.columns to make above query success to parse.
@sumartoyo, thanks for your PR. Please add a test case(s) that cover your changes.
Then we'll review your pull request.
FAIL Required test coverage of 100.0% not reached. Total coverage: 99.65%
@macbre I have added the test and now it's 100% coverage. Please let me know if the test is wrong.
@sumartoyo, black formatting tool is complaining. And linting does fail. Please fix these and we'll review your changes. Thanks!
I have re-format the test, but I think I will need to rewrite the implementation.
flake8 says "C901 'Parser._resolve_nested_query' is too complex (10)". I tried to write it to be less complex (less if-else) but I don't think it's possible unless I move some logic into a new function. Is it okay to introduce a new function? Are there any conventions I can follow for creating a function?