def handle(self, *args, **kwargs): """ Takes a relation name and a cycle and deletes its partition. (Usually with the assumption that it will be recreated for a fresh data load.) """ all_tables = kwargs.get('all_tables') base_table = kwargs.get('table') cycle = kwargs['cycle'] if cycle is None: raise CommandError("You must specify a cycle") if all_tables: for table in INDEX_COLS_BY_TABLE_FEC.keys(): self.delete_partition(cycle, table) elif base_table: self.delete_partition(cycle, base_table) else: raise CommandError("You must specify a table (-t) or all tables (-T).")
def handle(self, *args, **kwargs): """ Takes a relation name and a cycle and deletes its partition. (Usually with the assumption that it will be recreated for a fresh data load.) """ all_tables = kwargs.get('all_tables') base_table = kwargs.get('table') cycle = kwargs['cycle'] if cycle is None: raise CommandError("You must specify a cycle") if all_tables: for table in INDEX_COLS_BY_TABLE_FEC.keys(): self.delete_partition(cycle, table) elif base_table: self.delete_partition(cycle, base_table) else: raise CommandError( "You must specify a table (-t) or all tables (-T).")
def handle(self, *args, **kwargs): """ Takes a relation name and a cycle and creates a partition for it. Current relation names for FEC data are: fec_indiv* fec_pac2cand* fec_pac2pac* fec_committees fec_candidates* fec_candidate_summaries fec_committee_summaries """ cycle = kwargs['cycle'] if kwargs['all_tables']: for table in INDEX_COLS_BY_TABLE_FEC.keys(): self.create_partition(cycle, table) elif kwargs['table']: self.create_partition(cycle, kwargs['table']) else: if kwargs['table'] is None: raise CommandError("You must specify a table")