"""Quick script to list all columns in the product table."""
import asyncio
import sys

sys.stdout.reconfigure(encoding='utf-8')

from common.starrocks_connection import get_db_connection


async def main():
    db = get_db_connection()
    
    # Get column names from INFORMATION_SCHEMA
    rows = await db.execute_query_async(
        "SELECT COLUMN_NAME, DATA_TYPE, COLUMN_COMMENT "
        "FROM INFORMATION_SCHEMA.COLUMNS "
        "WHERE TABLE_SCHEMA = 'shared_source' "
        "AND TABLE_NAME = 'magento_product_dimension_with_text_embedding' "
        "ORDER BY ORDINAL_POSITION"
    )
    
    print(f"\n=== {len(rows)} columns ===\n")
    for r in rows:
        name = r.get('COLUMN_NAME', r.get('column_name', ''))
        dtype = r.get('DATA_TYPE', r.get('data_type', ''))
        comment = r.get('COLUMN_COMMENT', r.get('column_comment', ''))
        print(f"  - {name} ({dtype}) — {comment}")

asyncio.run(main())
