Spaces:
Running
Running
Download backend/apply_linkedin_schema.py from axeronis/microfunnel-api: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/spaces/axeronis/microfunnel-api/resolve/main/backend/apply_linkedin_schema.py
- Command line
-
hf download hf://spaces/axeronis/microfunnel-api/backend/apply_linkedin_schema.py
-
curl -L -o apply_linkedin_schema.py https://huggingface.co/spaces/axeronis/microfunnel-api/resolve/main/backend/apply_linkedin_schema.py
1.03 kB
| import asyncio | |
| import os | |
| from dotenv import load_dotenv | |
| # Load env vars from .env file explicitly | |
| load_dotenv() | |
| from app.core.database import async_session_maker | |
| from sqlalchemy import text | |
| from app.core.logging import get_logger | |
| logger = get_logger(__name__) | |
| async def fix_schema(): | |
| async with async_session_maker() as session: | |
| logger.info("Applying LinkedIn schema changes...") | |
| try: | |
| await session.execute(text("ALTER TABLE leads ADD COLUMN linkedin_profile VARCHAR")) | |
| logger.info("Added linkedin_profile") | |
| except Exception as e: | |
| logger.warning(f"Skipped linkedin_profile: {e}") | |
| try: | |
| await session.execute(text("ALTER TABLE leads ADD COLUMN linkedin_urn VARCHAR")) | |
| logger.info("Added linkedin_urn") | |
| except Exception as e: | |
| logger.warning(f"Skipped linkedin_urn: {e}") | |
| await session.commit() | |
| logger.info("Done!") | |
| if __name__ == "__main__": | |
| asyncio.run(fix_schema()) | |