import os
import sys

# Add the company-explorer directory to the Python path
sys.path.append(os.path.abspath(os.path.join(os.getcwd(), 'company-explorer')))

from backend.database import SessionLocal, MarketingMatrix, Industry, Persona
import json

db = SessionLocal()
try:
    count = db.query(MarketingMatrix).count()
    print(f"MarketingMatrix count: {count}")
    
    if count > 0:
        first = db.query(MarketingMatrix).first()
        print(f"First entry: ID={first.id}, Industry={first.industry_id}, Persona={first.persona_id}")
    else:
        print("MarketingMatrix is empty.")
        # Check if we have industries and personas
        ind_count = db.query(Industry).count()
        pers_count = db.query(Persona).count()
        print(f"Industries: {ind_count}, Personas: {pers_count}")
finally:
    db.close()