The invention related to pyrrole sulfonamide derivatives, the preparation method and medical use thereof. Specifically, this invention related to new pyrrole sulfonamide derivatives showed in general formula (I), and process for preparing and pharmaceutical compositions which contain the derivatives, and their use as therapeutic agents, especially their use as inhibitors of gastric acid secretion and potassium competitive acid blocker(P-CABs), wherein every definition of the substituent are same as those in the instructions.本發明涉及吡咯磺醯類衍生物、其製備方法及其在醫藥上的應用。具體而言,本發明涉及一種通式(I)所示的新的吡咯磺醯類衍生物、其製備方法及含有該衍生物的醫藥組成物以及其作為治療劑,特別是作為胃酸分泌抑制劑和鉀離子競爭性酸阻滯劑(P-CABs)的用途,其中通式(I)的各取代基與說明書中的定義相同。