In many perinatal pharmacoepidemiologic studies, exposure to a medication is classified as "ever exposed" versus "never exposed" within each trimester or even over the entire pregnancy. This approach is often far from real-world exposure patterns, may lead to exposure misclassification, and does not to incorporate important aspects such as dosage, timing of exposure, and treatment duration. Alternative exposure modeling methods can better summarize complex, individual-level medication use trajectories or time-varying exposures from information on medication dosage, gestational timing of use, and frequency of use. We provide an overview of commonly used methods for more refined definitions of real-world exposure to medication use during pregnancy, focusing on the major strengths and limitations of the techniques, including the potential for method-specific biases. Unsupervised clustering methods, including k-means clustering, group-based trajectory models, and hierarchical cluster analysis, are of interest because they enable visual examination of medication use trajectories over time in pregnancy and complex individual-level exposures, as well as providing insight into comedication and drug-switching patterns. Analytical techniques for time-varying exposure methods, such as extended Cox models and Robins' generalized methods, are useful tools when medication exposure is not static during pregnancy. We propose that where appropriate, combining unsupervised clustering techniques with causal modeling approaches may be a powerful approach to understanding medication safety in pregnancy, and this framework can also be applied in other areas of epidemiology.