Skip to content

Commit

Permalink
feat(scrapers.admin): add refresh_scrapers_status_view command
Browse files Browse the repository at this point in the history
Also, delete customer's SQL
  • Loading branch information
grossir committed Dec 2, 2024
1 parent 74f58bb commit 610f9ff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 49 deletions.
16 changes: 16 additions & 0 deletions cl/scrapers/management/commands/refresh_scrapers_status_view.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from cl.lib.command_utils import VerboseCommand,logger
from django.db import connection

class Command(VerboseCommand):
help = """Refreshes the `scrapers_mv_latest_opinion` materialized view.
Check the cl.scrapers.admin.py file for more info about the view
"""

def handle(self, *args, **options):
query = "REFRESH MATERIALIZED VIEW scrapers_mv_latest_opinion;"
with connection.cursor() as cursor:
cursor.execute(query)

logger.info("View refresh completed successfully")

49 changes: 0 additions & 49 deletions cl/scrapers/migrations/0004_create_mv_latest_opinion_customers.sql

This file was deleted.

0 comments on commit 610f9ff

Please sign in to comment.