You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sql_query = """select o_year, sum(case when nation = 'KENYA' then volume else 0 end) / sum(volume) as mkt_share from
( select extract(year from o_orderdate) as o_year, l_extendedprice * (1 - l_discount) as volume, n2.n_name as nation
from part, supplier, lineitem, orders, customer, nation n1, nation n2, region where p_partkey = l_partkey
and s_suppkey = l_suppkey and l_orderkey = o_orderkey and o_custkey = c_custkey and c_nationkey = n1.n_nationkey
and n1.n_regionkey = r_regionkey and r_name = 'AFRICA' and s_nationkey = n2.n_nationkey and o_orderdate
between date '1995-01-01' and date '1996-12-31' and p_type = 'PROMO POLISHED NICKEL' ) as all_nations group by o_year order by o_year;
"""
parser = Parser(sql_query)
print(parser.columns_dict)`
Traceback (most recent call last):
File "G:\my\index_selection\online\test.py", line 18, in
print(parser.columns_dict)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\liu\AppData\Local\Programs\Python\Python312\Lib\site-packages\sql_metadata\parser.py", line 241, in columns_dict
_ = self.columns
^^^^^^^^^^^^
File "C:\Users\liu\AppData\Local\Programs\Python\Python312\Lib\site-packages\sql_metadata\parser.py", line 205, in columns
columns_aliases_names=self.columns_aliases_names,
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\liu\AppData\Local\Programs\Python\Python312\Lib\site-packages\sql_metadata\parser.py", line 329, in columns_aliases_names
self._handle_column_alias_subquery_level_update(token=token)
File "C:\Users\liu\AppData\Local\Programs\Python\Python312\Lib\site-packages\sql_metadata\parser.py", line 681, in _handle_column_alias_subquery_level_update
self._add_to_columns_aliases_subsection(token=token)
File "C:\Users\liu\AppData\Local\Programs\Python\Python312\Lib\site-packages\sql_metadata\parser.py", line 747, in _add_to_columns_aliases_subsection
section = COLUMNS_SECTIONS[keyword]
~~~~~~~~~~~~~~~~^^^^^^^^^
KeyError: 'FROM'
using sql_metadata 2.10.0
The text was updated successfully, but these errors were encountered:
`from sql_metadata import Parser
sql_query = """select o_year, sum(case when nation = 'KENYA' then volume else 0 end) / sum(volume) as mkt_share from
( select extract(year from o_orderdate) as o_year, l_extendedprice * (1 - l_discount) as volume, n2.n_name as nation
from part, supplier, lineitem, orders, customer, nation n1, nation n2, region where p_partkey = l_partkey
and s_suppkey = l_suppkey and l_orderkey = o_orderkey and o_custkey = c_custkey and c_nationkey = n1.n_nationkey
and n1.n_regionkey = r_regionkey and r_name = 'AFRICA' and s_nationkey = n2.n_nationkey and o_orderdate
between date '1995-01-01' and date '1996-12-31' and p_type = 'PROMO POLISHED NICKEL' ) as all_nations group by o_year order by o_year;
"""
parser = Parser(sql_query)
print(parser.columns_dict)`
Traceback (most recent call last):
File "G:\my\index_selection\online\test.py", line 18, in
print(parser.columns_dict)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\liu\AppData\Local\Programs\Python\Python312\Lib\site-packages\sql_metadata\parser.py", line 241, in columns_dict
_ = self.columns
^^^^^^^^^^^^
File "C:\Users\liu\AppData\Local\Programs\Python\Python312\Lib\site-packages\sql_metadata\parser.py", line 205, in columns
columns_aliases_names=self.columns_aliases_names,
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\liu\AppData\Local\Programs\Python\Python312\Lib\site-packages\sql_metadata\parser.py", line 329, in columns_aliases_names
self._handle_column_alias_subquery_level_update(token=token)
File "C:\Users\liu\AppData\Local\Programs\Python\Python312\Lib\site-packages\sql_metadata\parser.py", line 681, in _handle_column_alias_subquery_level_update
self._add_to_columns_aliases_subsection(token=token)
File "C:\Users\liu\AppData\Local\Programs\Python\Python312\Lib\site-packages\sql_metadata\parser.py", line 747, in _add_to_columns_aliases_subsection
section = COLUMNS_SECTIONS[keyword]
~~~~~~~~~~~~~~~~^^^^^^^^^
KeyError: 'FROM'
using sql_metadata 2.10.0
The text was updated successfully, but these errors were encountered: