OK, so I'm not sure this is even truly a bug, more just an annoying corner case. The problem is: when pivoting on multiple columns, the new column names are made from joining the pivot values with '_' ...
from sqlglot import parse_one from lineage import lineage from sqlglot.optimizer import build_scope from sqlglot.optimizer.qualify import qualify query = """ WITH cte AS (SELECT * FROM (SELECT product ...
Read this SQL tutorial to learn when to use SELECT, JOIN, subselects and UNION to access multiple tables with a single statement. It’s sometimes difficult to know which SQL syntax to use when ...