The present invention relates to a pyrrole sulfonamide derivative, a preparation method for same, and a medical application thereof. Specifically, the present invention relates to a novel pyrrole sulfonamide derivative as represented by formula (I), a preparation method for the derivative, a pharmaceutical composition comprising the derivative, and uses of same as therapeutic agents, and particularly as a gastric acid secretion inhibitor and potassium-competitive acid blockers (P-CABs), wherein each substituent of formula (I) is as defined in the description.