20 lines
718 B
Python
20 lines
718 B
Python
"""Run FULL citation refresh (no limit = all 148k records)"""
|
|||
|
|
import asyncio
|
||
|
|
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
|
||
|
|
from sqlalchemy.orm import sessionmaker
|
||
|
|
from app.services.pubmed_api import update_citation_counts
|
||
|
|
|
||
|
|
DATABASE_URL = 'postgresql+asyncpg://scilit:scilit_prod_2026@postgres:5432/scilit'
|
||
|
|
|
||
|
|
async def main():
|
||
|
|
engine = create_async_engine(DATABASE_URL, pool_size=4)
|
||
|
|
async_session = sessionmaker(engine, class_=AsyncSession)
|
||
|
|
|
||
|
|
async with async_session() as db:
|
||
|
|
result = await update_citation_counts(db, limit=0)
|
||
|
|
print(f"Updated: {result['updated']}, Total: {result['total']}, Errors: {result['errors']}")
|
||
|
|
|
||
|
|
await engine.dispose()
|
||
|
|
|
||
|
|
asyncio.run(main())
|