Convertible Senior Notes - Interest Expense Recognized (Details) - USD ($)
$ in Thousands
3 Months Ended 6 Months Ended
Jan. 31, 2022
Jan. 31, 2021
Jan. 31, 2022
Jan. 31, 2021
Debt Instrument [Line Items]        
Non-cash interest expense     $ 9,575 $ 6,615
Convertible Debt | 2023 Convertible Senior Notes        
Debt Instrument [Line Items]        
Interest expense related to amortization of debt discount $ 0 $ 7,854 0 15,579
Interest expense related to amortization of debt issuance costs 148 438 548 869
Total interest expense 148 8,292 548 16,448
Convertible Debt | 2026 Convertible Senior Notes        
Debt Instrument [Line Items]        
Interest expense related to amortization of debt discount 8,469 7,894 16,789 11,081
Interest expense related to amortization of debt issuance costs 968 902 1,919 1,267
Non-cash interest expense 4,802 4,663 9,575 6,615
Total interest expense 14,239 $ 13,459 28,283 $ 18,963
Convertible Debt | 2027 Convertible Senior Notes        
Debt Instrument [Line Items]        
Contractual interest expense 359   540  
Interest expense related to amortization of debt issuance costs 380   511  
Total interest expense $ 739   $ 1,051