Query assistant for public_contributions
Schema that will be passed to the model
CREATE TABLE public_contributions ( "canon_id" INTEGER, -- donor id; one id per donor across name variants "donor_name" TEXT, -- the DONOR (who gave) "employer" TEXT, -- the donor's employer "occupation" TEXT, -- the donor's occupation "is_organization" INTEGER, "entity_type" TEXT, "entity_subtype" TEXT, "city" TEXT, -- the DONOR's city, not the candidate's "state" TEXT, -- the DONOR's state, not the candidate's "zip" TEXT, -- the DONOR's ZIP, not the candidate's "amount" REAL, -- dollars "date" TEXT, "is_inkind" INTEGER, "designated_election_phase" TEXT, "campaign_id" INTEGER, -- the RECIPIENT campaign "reporting_period" TEXT, "party" TEXT, -- the recipient candidate's party "election_cycle_year" INTEGER, -- election year of the recipient campaign "candidate_name" TEXT, -- the RECIPIENT candidate "office_name" TEXT -- the office the recipient ran for, e.g. 'Memphis Mayor', 'Shelby County Mayor', 'District Attorney General', 'Sheriff'; names include the district, so match a whole chamber with LIKE 'Circuit Court Judge%', never = ); CREATE INDEX idx_pc_pair ON public_contributions(canon_id, campaign_id); CREATE INDEX idx_pc_campaign ON public_contributions(campaign_id)