src/dirbs/listgen/generator.py
def _create_intermediate_delta_tables_structure(self, conn):
        """Create table structure for delta tables used to update stored lists."""
        table_names = []
        with conn.cursor() as cursor, CodeProfiler() as cp:
            tblname = self._blacklist_delta_tblname
            cursor.execute(sql.SQL("""CREATE UNLOGGED TABLE {0} (
                                          LIKE {blacklist_delta_tbl} INCLUDING DEFAULTS
                                                                     INCLUDING IDENTITY
                                                                     INCLUDING CONSTRAINTS
                                                                     INCLUDING STORAGE
                                                                     INCLUDING COMMENTS
                                      ) PARTITION BY RANGE (virt_imei_shard)
                                   """).format(sql.Identifier(tblname),
                                               blacklist_delta_tbl=sql.Identifier(self._blacklist_tblname)))
            partition_utils.create_imei_shard_partitions(conn, tbl_name=tblname, unlogged=True)
            table_names.append(tblname)

            tblname = self._notifications_lists_delta_tblname
            notifications_delta_tbl = sql.Identifier(self._notifications_lists_tblname)
            cursor.execute(sql.SQL("""CREATE UNLOGGED TABLE {0} (
                                          LIKE {notifications_delta_tbl} INCLUDING DEFAULTS
                                                                         INCLUDING IDENTITY
                                                                         INCLUDING CONSTRAINTS
                                                                         INCLUDING STORAGE
                                                                         INCLUDING COMMENTS
                                      ) PARTITION BY LIST (operator_id)
                                   """).format(sql.Identifier(tblname),
                                               notifications_delta_tbl=notifications_delta_tbl))
            table_names.append(tblname)
            self._create_operator_partitions(conn,
                                             parent_tbl_name=tblname,
                                             child_name_fn=self._notifications_lists_delta_part_tblname,
                                             is_unlogged=True)

            tblname = self._exceptions_lists_delta_tblname
            cursor.execute(sql.SQL("""CREATE UNLOGGED TABLE {0} (
                                          LIKE {exceptions_delta_tbl} INCLUDING DEFAULTS
                                                                      INCLUDING IDENTITY
                                                                      INCLUDING CONSTRAINTS
                                                                      INCLUDING STORAGE
                                                                      INCLUDING COMMENTS
                                      ) PARTITION BY LIST (operator_id)
                                   """).format(sql.Identifier(tblname),
                                               exceptions_delta_tbl=sql.Identifier(self._exceptions_lists_tblname)))
            table_names.append(tblname)
            self._create_operator_partitions(conn,
                                             parent_tbl_name=tblname,
                                             child_name_fn=self._exceptions_lists_delta_part_tblname,
                                             is_unlogged=True)

        self._intermediate_table_names.extend(table_names)
        return -1, cp.duration
Create table structure for delta tables used to update stored lists.
Create table structure for delta tables used to update stored lists.
Create table structure for delta tables used to update stored lists .
def _create_intermediate_delta_tables_structure(self, conn):
        table_names = []
        with conn.cursor() as cursor, CodeProfiler() as cp:
            tblname = self._blacklist_delta_tblname
            cursor.execute(sql.SQL("""CREATE UNLOGGED TABLE {0} (
                                          LIKE {blacklist_delta_tbl} INCLUDING DEFAULTS
                                                                     INCLUDING IDENTITY
                                                                     INCLUDING CONSTRAINTS
                                                                     INCLUDING STORAGE
                                                                     INCLUDING COMMENTS
                                      ) PARTITION BY RANGE (virt_imei_shard)
                                   """).format(sql.Identifier(tblname),
                                               blacklist_delta_tbl=sql.Identifier(self._blacklist_tblname)))
            partition_utils.create_imei_shard_partitions(conn, tbl_name=tblname, unlogged=True)
            table_names.append(tblname)
            tblname = self._notifications_lists_delta_tblname
            notifications_delta_tbl = sql.Identifier(self._notifications_lists_tblname)
            cursor.execute(sql.SQL("""CREATE UNLOGGED TABLE {0} (
                                          LIKE {notifications_delta_tbl} INCLUDING DEFAULTS
                                                                         INCLUDING IDENTITY
                                                                         INCLUDING CONSTRAINTS
                                                                         INCLUDING STORAGE
                                                                         INCLUDING COMMENTS
                                      ) PARTITION BY LIST (operator_id)
                                   """).format(sql.Identifier(tblname),
                                               notifications_delta_tbl=notifications_delta_tbl))
            table_names.append(tblname)
            self._create_operator_partitions(conn,
                                             parent_tbl_name=tblname,
                                             child_name_fn=self._notifications_lists_delta_part_tblname,
                                             is_unlogged=True)
            tblname = self._exceptions_lists_delta_tblname
            cursor.execute(sql.SQL("""CREATE UNLOGGED TABLE {0} (
                                          LIKE {exceptions_delta_tbl} INCLUDING DEFAULTS
                                                                      INCLUDING IDENTITY
                                                                      INCLUDING CONSTRAINTS
                                                                      INCLUDING STORAGE
                                                                      INCLUDING COMMENTS
                                      ) PARTITION BY LIST (operator_id)
                                   """).format(sql.Identifier(tblname),
                                               exceptions_delta_tbl=sql.Identifier(self._exceptions_lists_tblname)))
            table_names.append(tblname)
            self._create_operator_partitions(conn,
                                             parent_tbl_name=tblname,
                                             child_name_fn=self._exceptions_lists_delta_part_tblname,
                                             is_unlogged=True)
        self._intermediate_table_names.extend(table_names)
        return -1, cp.duration
def _create_intermediate_delta_tables_structure ( self , conn ) : table_names = [ ] with conn . cursor ( ) as cursor , CodeProfiler ( ) as cp : tblname = self . _blacklist_delta_tblname cursor . execute ( sql . SQL ( """CREATE UNLOGGED TABLE {0} (
                                          LIKE {blacklist_delta_tbl} INCLUDING DEFAULTS
                                                                     INCLUDING IDENTITY
                                                                     INCLUDING CONSTRAINTS
                                                                     INCLUDING STORAGE
                                                                     INCLUDING COMMENTS
                                      ) PARTITION BY RANGE (virt_imei_shard)
                                   """ ) . format ( sql . Identifier ( tblname ) , blacklist_delta_tbl = sql . Identifier ( self . _blacklist_tblname ) ) ) partition_utils . create_imei_shard_partitions ( conn , tbl_name = tblname , unlogged = True ) table_names . append ( tblname ) tblname = self . _notifications_lists_delta_tblname notifications_delta_tbl = sql . Identifier ( self . _notifications_lists_tblname ) cursor . execute ( sql . SQL ( """CREATE UNLOGGED TABLE {0} (
                                          LIKE {notifications_delta_tbl} INCLUDING DEFAULTS
                                                                         INCLUDING IDENTITY
                                                                         INCLUDING CONSTRAINTS
                                                                         INCLUDING STORAGE
                                                                         INCLUDING COMMENTS
                                      ) PARTITION BY LIST (operator_id)
                                   """ ) . format ( sql . Identifier ( tblname ) , notifications_delta_tbl = notifications_delta_tbl ) ) table_names . append ( tblname ) self . _create_operator_partitions ( conn , parent_tbl_name = tblname , child_name_fn = self . _notifications_lists_delta_part_tblname , is_unlogged = True ) tblname = self . _exceptions_lists_delta_tblname cursor . execute ( sql . SQL ( """CREATE UNLOGGED TABLE {0} (
                                          LIKE {exceptions_delta_tbl} INCLUDING DEFAULTS
                                                                      INCLUDING IDENTITY
                                                                      INCLUDING CONSTRAINTS
                                                                      INCLUDING STORAGE
                                                                      INCLUDING COMMENTS
                                      ) PARTITION BY LIST (operator_id)
                                   """ ) . format ( sql . Identifier ( tblname ) , exceptions_delta_tbl = sql . Identifier ( self . _exceptions_lists_tblname ) ) ) table_names . append ( tblname ) self . _create_operator_partitions ( conn , parent_tbl_name = tblname , child_name_fn = self . _exceptions_lists_delta_part_tblname , is_unlogged = True ) self . _intermediate_table_names . extend ( table_names ) return - 1 , cp . duration
Create table structure for delta tables used to update stored lists.
Create table structure for delta tables used to update stored lists .
"""Create table structure for delta tables used to update stored lists."""
self
conn