src/dirbs/importer/operator_data_importer.py
def _create_monthly_network_triplets_partitions(self, conn, month, year):
        """Helper function to create the actual monthly_network_triplets_partitions partitions."""
        with conn.cursor() as cursor:
            imei_shard_name = partition_utils.monthly_network_triplets_country_partition(month=month, year=year)
            cursor.execute(table_exists_sql(), [imei_shard_name])
            partition_exists = cursor.fetchone()[0]
            if not partition_exists:
                partition_utils.create_monthly_network_triplets_country_partition(conn, month=month, year=year)
                indices = partition_utils.monthly_network_triplets_country_indices()
                partition_utils.add_indices(conn, tbl_name=imei_shard_name, idx_metadata=indices)

            imei_shard_name = partition_utils.monthly_network_triplets_per_mno_partition(operator_id=self._operator_id,
                                                                                         month=month, year=year)
            cursor.execute(table_exists_sql(), [imei_shard_name])
            partition_exists = cursor.fetchone()[0]
            if not partition_exists:
                op_id = self._operator_id
                partition_utils.create_monthly_network_triplets_per_mno_partition(conn, operator_id=op_id,
                                                                                  month=month, year=year)
                indices = partition_utils.monthly_network_triplets_per_mno_indices()
                partition_utils.add_indices(conn, tbl_name=imei_shard_name, idx_metadata=indices)
Helper function to create the actual monthly_network_triplets_partitions partitions.
Helper function to create the actual monthly_network_triplets_partitions partitions.
Helper function to create the actual monthly_network_triplets_partitions partitions .
def _create_monthly_network_triplets_partitions(self, conn, month, year):
        with conn.cursor() as cursor:
            imei_shard_name = partition_utils.monthly_network_triplets_country_partition(month=month, year=year)
            cursor.execute(table_exists_sql(), [imei_shard_name])
            partition_exists = cursor.fetchone()[0]
            if not partition_exists:
                partition_utils.create_monthly_network_triplets_country_partition(conn, month=month, year=year)
                indices = partition_utils.monthly_network_triplets_country_indices()
                partition_utils.add_indices(conn, tbl_name=imei_shard_name, idx_metadata=indices)
            imei_shard_name = partition_utils.monthly_network_triplets_per_mno_partition(operator_id=self._operator_id,
                                                                                         month=month, year=year)
            cursor.execute(table_exists_sql(), [imei_shard_name])
            partition_exists = cursor.fetchone()[0]
            if not partition_exists:
                op_id = self._operator_id
                partition_utils.create_monthly_network_triplets_per_mno_partition(conn, operator_id=op_id,
                                                                                  month=month, year=year)
                indices = partition_utils.monthly_network_triplets_per_mno_indices()
                partition_utils.add_indices(conn, tbl_name=imei_shard_name, idx_metadata=indices)
def _create_monthly_network_triplets_partitions ( self , conn , month , year ) : with conn . cursor ( ) as cursor : imei_shard_name = partition_utils . monthly_network_triplets_country_partition ( month = month , year = year ) cursor . execute ( table_exists_sql ( ) , [ imei_shard_name ] ) partition_exists = cursor . fetchone ( ) [ 0 ] if not partition_exists : partition_utils . create_monthly_network_triplets_country_partition ( conn , month = month , year = year ) indices = partition_utils . monthly_network_triplets_country_indices ( ) partition_utils . add_indices ( conn , tbl_name = imei_shard_name , idx_metadata = indices ) imei_shard_name = partition_utils . monthly_network_triplets_per_mno_partition ( operator_id = self . _operator_id , month = month , year = year ) cursor . execute ( table_exists_sql ( ) , [ imei_shard_name ] ) partition_exists = cursor . fetchone ( ) [ 0 ] if not partition_exists : op_id = self . _operator_id partition_utils . create_monthly_network_triplets_per_mno_partition ( conn , operator_id = op_id , month = month , year = year ) indices = partition_utils . monthly_network_triplets_per_mno_indices ( ) partition_utils . add_indices ( conn , tbl_name = imei_shard_name , idx_metadata = indices )
Helper function to create the actual monthly_network_triplets_partitions partitions.
Helper function to create the actual monthly_network_triplets_partitions partitions .
"""Helper function to create the actual monthly_network_triplets_partitions partitions."""
self
conn
month
year