def _disableable_indexes(cls): to_locate = [ 'hive_posts_ix3', # (author, depth, id) 'hive_posts_ix4', # (parent_id, id, is_deleted=0) 'hive_follows_ix5a', # (following, state, created_at, follower) 'hive_follows_ix5b', # (follower, state, created_at, following) 'hive_reblogs_ix1', # (post_id, account, created_at) 'hive_posts_cache_ix6a', # (sc_trend, post_id, paidout=0) 'hive_posts_cache_ix6b', # (post_id, sc_trend, paidout=0) 'hive_posts_cache_ix7a', # (sc_hot, post_id, paidout=0) 'hive_posts_cache_ix7b', # (post_id, sc_hot, paidout=0) 'hive_posts_cache_ix8', # (category, payout, depth, paidout=0) 'hive_posts_cache_ix9a', # (depth, payout, post_id, paidout=0) 'hive_posts_cache_ix9b', # (category, depth, payout, post_id, paidout=0) 'hive_accounts_ix3', # (vote_weight, name VPO) 'hive_accounts_ix4', # (id, name) 'hive_accounts_ix5', # (cached_at, name) ] to_return = [] md = build_metadata() for table in md.tables.values(): for index in table.indexes: if index.name not in to_locate: continue to_locate.remove(index.name) to_return.append(index) # ensure we found all the items we expected assert not to_locate, "indexes not located: {}".format(to_locate) return to_return
def _disableable_indexes(cls): to_locate = [ 'hive_posts_ix1', # (parent_id) 'hive_posts_ix2', # (is_deleted, depth) 'hive_follows_ix2', # (following, follower, state=1) 'hive_follows_ix3', # (follower, following, state=1) 'hive_reblogs_ix1', # (post_id, account, created_at) 'hive_posts_cache_ix6', # (sc_trend, post_id) 'hive_posts_cache_ix7', # (sc_hot, post_id) ] to_return = [] md = build_metadata() for table in md.tables.values(): for index in table.indexes: if index.name not in to_locate: continue to_locate.remove(index.name) to_return.append(index) # ensure we found all the items we expected assert not to_locate, "indexes not located: {}".format(to_locate) return to_return
def _all_foreign_keys(cls): md = build_metadata() out = [] for table in md.tables.values(): out.extend(table.foreign_keys) return out
def _disableable_indexes(cls): to_locate = [ 'hive_blocks_created_at_idx', 'hive_feed_cache_block_num_idx', 'hive_feed_cache_created_at_idx', 'hive_feed_cache_post_id_idx', 'hive_follows_ix5a', # (following, state, created_at, follower) 'hive_follows_ix5b', # (follower, state, created_at, following) 'hive_follows_block_num_idx', 'hive_follows_created_at_idx', 'hive_posts_parent_id_id_idx', 'hive_posts_depth_idx', 'hive_posts_root_id_id_idx', 'hive_posts_community_id_id_idx', 'hive_posts_payout_at_idx', 'hive_posts_payout_idx', 'hive_posts_promoted_id_idx', 'hive_posts_sc_trend_id_idx', 'hive_posts_sc_hot_id_idx', 'hive_posts_block_num_idx', 'hive_posts_block_num_created_idx', 'hive_posts_cashout_time_id_idx', 'hive_posts_updated_at_idx', 'hive_posts_payout_plus_pending_payout_id_idx', 'hive_posts_category_id_payout_plus_pending_payout_depth_idx', 'hive_posts_tags_ids_idx', 'hive_posts_author_id_created_at_id_idx', 'hive_posts_author_id_id_idx', 'hive_posts_api_helper_author_s_permlink_idx', 'hive_votes_voter_id_last_update_idx', 'hive_votes_block_num_idx', 'hive_subscriptions_block_num_idx', 'hive_subscriptions_community_idx', 'hive_communities_block_num_idx', 'hive_reblogs_created_at_idx', 'hive_votes_voter_id_post_id_idx', 'hive_votes_post_id_voter_id_idx', 'hive_reputation_data_block_num_idx', 'hive_notification_cache_block_num_idx', 'hive_notification_cache_dst_score_idx' ] to_return = {} md = build_metadata() for table in md.tables.values(): for index in table.indexes: if index.name not in to_locate: continue to_locate.remove(index.name) if table not in to_return: to_return[ table ] = [] to_return[ table ].append(index) # ensure we found all the items we expected assert not to_locate, "indexes not located: {}".format(to_locate) return to_return