Fix SQL syntax error in generate_series date cast (SQLAlchemy text() parsing)
SQLAlchemy's text() parser treated the ':' in '::date' (PostgreSQL cast syntax) as a second unbound parameter after :start/:end, producing malformed SQL and crashing the scheduled Booking.com scrape silently with no history entry written. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
38b0c36923
commit
4b5b8b30ed
1 changed files with 1 additions and 1 deletions
|
|
@ -69,7 +69,7 @@ def _get_oldest_scraped_dates(db: Session, start: date, end: date, limit: int) -
|
||||||
text("""
|
text("""
|
||||||
SELECT s.rate_date::date AS rate_date,
|
SELECT s.rate_date::date AS rate_date,
|
||||||
MAX(r.scraped_at) AS last_scraped
|
MAX(r.scraped_at) AS last_scraped
|
||||||
FROM generate_series(:start::date, :end::date, '1 day'::interval) AS s(rate_date)
|
FROM generate_series(CAST(:start AS date), CAST(:end AS date), INTERVAL '1 day') AS s(rate_date)
|
||||||
LEFT JOIN booking_com_rates r ON r.rate_date = s.rate_date::date
|
LEFT JOIN booking_com_rates r ON r.rate_date = s.rate_date::date
|
||||||
GROUP BY s.rate_date
|
GROUP BY s.rate_date
|
||||||
ORDER BY last_scraped ASC NULLS FIRST
|
ORDER BY last_scraped ASC NULLS FIRST
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue