<h4>Background</h4>This study aimed to compare the safety and effectiveness of glucagon-like peptide-1 receptor agonists (GLP-1 RA) versus dipeptidyl peptidase-4 inhibitors (DPP-4i) in patients with type 2 diabetes following gastrostomy.<h4>Methods</h4>We conducted a target trial emulation using real-world data. The gene discussed is DPP4; the disease is type 2 diabetes mellitus.