SGLT2 inhibitors were associated with lower odds of pneumonia compared with DPP-4 inhibitors and placebo. Here, SLC5A2 is linked to susceptibility to pneumonia measurement.