import re

with open('PASTELERIAS-struct.sql', 'r', encoding='utf-8', errors='ignore') as f:
    text = f.read()

for tbl in ['ge_presupuestos', 'ge_pedidos', 'ge_albaranes', 'ge_facturas', 'ge_envios_recogidas']:
    m = re.search(r'CREATE TABLE `' + tbl + r'` \((.*?)\) ENGINE', text, re.DOTALL)
    if m:
        cols = []
        for line in m.group(1).split('\n'):
            line = line.strip()
            if line.startswith('`'):
                col_name = line.split('`')[1]
                cols.append(col_name)
        print(f"=== {tbl} ===")
        print(", ".join(cols))
