(self, node_type, node_db, provider_db)
Callback from CascadeAdmin init.
Callback from CascadeAdmin init.
Callback from CascadeAdmin init .
def extra_init(self, node_type, node_db, provider_db):
        """Callback from CascadeAdmin init."""
        if not provider_db:
            return
        pcurs = provider_db.cursor()
        ncurs = node_db.cursor()

        # sync tables
        q = "select table_name from londiste.get_table_list(%s)"
        pcurs.execute(q, [self.set_name])
        for row in pcurs.fetchall():
            tbl = row['table_name']
            q = "select * from londiste.global_add_table(%s, %s)"
            ncurs.execute(q, [self.set_name, tbl])

        # sync seqs
        q = "select seq_name, last_value from londiste.get_seq_list(%s)"
        pcurs.execute(q, [self.set_name])
        for row in pcurs.fetchall():
            seq = row['seq_name']
            val = row['last_value']
            q = "select * from londiste.global_update_seq(%s, %s, %s)"
            ncurs.execute(q, [self.set_name, seq, val])

        # done
        node_db.commit()
        provider_db.commit()
def extra_init ( self , node_type , node_db , provider_db ) : if not provider_db : return pcurs = provider_db . cursor ( ) ncurs = node_db . cursor ( ) # sync tables q = "select table_name from londiste.get_table_list(%s)" pcurs . execute ( q , [ self . set_name ] ) for row in pcurs . fetchall ( ) : tbl = row [ 'table_name' ] q = "select * from londiste.global_add_table(%s, %s)" ncurs . execute ( q , [ self . set_name , tbl ] ) # sync seqs q = "select seq_name, last_value from londiste.get_seq_list(%s)" pcurs . execute ( q , [ self . set_name ] ) for row in pcurs . fetchall ( ) : seq = row [ 'seq_name' ] val = row [ 'last_value' ] q = "select * from londiste.global_update_seq(%s, %s, %s)" ncurs . execute ( q , [ self . set_name , seq , val ] ) # done node_db . commit ( ) provider_db . commit ( )