auto-claude: 8.2 - Fix SQL ANY() to IN() for SQLite compatibility

- Changed PostgreSQL-specific ANY(:ids) to use IN clause with
  dynamic placeholders for SQLite/PostgreSQL compatibility
- Verified SEO audit dry-run extracts all metrics correctly:
  - HTTP status, load time, final URL
  - Meta title, H1 count, image analysis
  - Structured data detection
  - robots.txt, sitemap.xml, indexability
  - Overall SEO score calculation (95 for pixlab.pl)

Note: Company ID 26 has no website configured, tested with ID 1 instead.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-01-08 09:21:12 +01:00
parent 92055bbe60
commit feaf5d5a49

View File

@ -130,13 +130,16 @@ class SEOAuditor:
"""
with self.Session() as session:
if company_ids:
query = text("""
# Use IN clause for SQLite/PostgreSQL compatibility
placeholders = ', '.join([f':id_{i}' for i in range(len(company_ids))])
query = text(f"""
SELECT id, name, slug, website, address_city
FROM companies
WHERE id = ANY(:ids)
WHERE id IN ({placeholders})
ORDER BY id
""")
result = session.execute(query, {'ids': company_ids})
params = {f'id_{i}': cid for i, cid in enumerate(company_ids)}
result = session.execute(query, params)
elif batch_start is not None and batch_end is not None:
query = text("""
SELECT id, name, slug, website, address_city