@@ -0,0 +1,1299 @@
+# -*- coding: utf-8 -*-%0A%0A#%0A# CDR-Stats License%0A# http://www.cdr-stats.org%0A#%0A# This Source Code Form is subject to the terms of the Mozilla Public%0A# License, v. 2.0. If a copy of the MPL was not distributed with this file,%0A# You can obtain one at http://mozilla.org/MPL/2.0/.%0A#%0A# Copyright (C) 2011-2015 Star2Billing S.L.%0A#%0A# The Initial Developer of the Original Code is%0A# Arezqui Belaid %3Cinfo@star2billing.com%3E%0A#%0Afrom django.core.management.base import BaseCommand%0Afrom django.db import connection%0A%0A%0Aclass Command(BaseCommand):%0A%0A    %22%22%22%0A    Command line to import CDR with CDR data store%0A    %22%22%22%0A    help = %22Refresh Materialized View%5Cn%22%5C%0A           %22-------------------------%5Cn%22%5C%0A           %22USAGE : python manage.py refresh_mat_view%5Cn%22%0A%0A    option_list = BaseCommand.option_list%0A%0A    def handle(self, *args, **options):%0A%0A        # Refresh matv_voip_cdr_aggr_hour%0A        with connection.cursor() as cursor:%0A            print(%22REFRESH MATERIALIZED VIEW matv_voip_cdr_aggr_hour;%22)%0A            cursor.execute(%22REFRESH MATERIALIZED VIEW matv_voip_cdr_aggr_hour;%22)%0A%0A        # Refresh matv_voip_cdr_aggr_min%0A        with connection.cursor() as cursor:%0A            print(%22REFRESH MATERIALIZED VIEW matv_voip_cdr_aggr_min;%22)%0A            cursor.execute(%22REFRESH MATERIALIZED VIEW matv_voip_cdr_aggr_min;%22)%0A

add command to refresh manually materialized views