Files
AutonetSellCar/backend/check_banner_cars.py
AutonetSellCar Deploy 1f0dcb1ddb Initial commit: AutonetSellCar platform with deployment system
- Frontend: Next.js 14 with TypeScript
- Backend: FastAPI with SQLAlchemy
- Agent: Carmodoo sync agent
- Deployment: Docker Compose based staging/production setup
- Scripts: Automated deployment with rollback support

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 13:24:39 +09:00

43 lines
1.2 KiB
Python

"""Check banner cars and their source_id for fetching performance checks"""
import sqlite3
import os
os.chdir(r'D:\Workspace\claudeCode\AutonetSellCar.com\backend')
conn = sqlite3.connect('autonet.db')
cursor = conn.cursor()
# 먼저 cars 테이블 구조 확인
cursor.execute('PRAGMA table_info(cars)')
columns = cursor.fetchall()
print('=== cars Table Columns ===')
col_names = [col[1] for col in columns]
print(col_names)
print()
# 배너 차량들의 source_id 확인
cursor.execute('''
SELECT h.car_id, c.source_id,
(SELECT COUNT(*) FROM car_performance_checks WHERE car_id = h.car_id) as has_perf
FROM hero_banners h
JOIN cars c ON h.car_id = c.id
WHERE h.is_active = 1
''')
banner_cars = cursor.fetchall()
print('=== Banner Cars Status ===')
print()
cars_without_perf = []
for car in banner_cars:
car_id, source_id, has_perf = car
status = 'O' if has_perf > 0 else 'X'
print(f'Car ID: {car_id}, Source ID: {source_id}, Perf Check: {status}')
if has_perf == 0 and source_id:
cars_without_perf.append((car_id, source_id))
print()
print('=== Cars that need performance check fetch ===')
for car_id, source_id in cars_without_perf:
print(f' Car ID: {car_id}, Source ID: {source_id}')
conn.close()