Fix uuid type mismatch in stale batch cleanup subqueries
scrape_batch_id in booking_com_rates is a uuid column, not text. Casting bsl.batch_id::text made the comparison uuid = text which Postgres rejects. Drop the cast — both sides are uuid. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
6503018b99
commit
8a80c66a3b
1 changed files with 4 additions and 4 deletions
|
|
@ -76,13 +76,13 @@ def force_reset_scraper(db: Session) -> dict:
|
|||
hotels_found = (
|
||||
SELECT COUNT(DISTINCT hotel_id)
|
||||
FROM booking_com_rates
|
||||
WHERE scrape_batch_id = bsl.batch_id::text
|
||||
WHERE scrape_batch_id = bsl.batch_id
|
||||
AND rate_gross IS NOT NULL
|
||||
),
|
||||
rates_scraped = (
|
||||
SELECT COUNT(*)
|
||||
FROM booking_com_rates
|
||||
WHERE scrape_batch_id = bsl.batch_id::text
|
||||
WHERE scrape_batch_id = bsl.batch_id
|
||||
AND rate_gross IS NOT NULL
|
||||
)
|
||||
WHERE status = 'running'
|
||||
|
|
@ -304,13 +304,13 @@ def cleanup_stale_batches(db: Session, max_age_minutes: int = 60):
|
|||
hotels_found = (
|
||||
SELECT COUNT(DISTINCT hotel_id)
|
||||
FROM booking_com_rates
|
||||
WHERE scrape_batch_id = bsl.batch_id::text
|
||||
WHERE scrape_batch_id = bsl.batch_id
|
||||
AND rate_gross IS NOT NULL
|
||||
),
|
||||
rates_scraped = (
|
||||
SELECT COUNT(*)
|
||||
FROM booking_com_rates
|
||||
WHERE scrape_batch_id = bsl.batch_id::text
|
||||
WHERE scrape_batch_id = bsl.batch_id
|
||||
AND rate_gross IS NOT NULL
|
||||
)
|
||||
WHERE bsl.status = 'running'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue