title: How to divide Days Duration into further smaller sections in Python
body: <pre><code>'''
  
  import pandas as pd
  
  import pymysql as sql
  
  import pygsheets
  
  import datetime
  
  #%%
  
  today =datetime.date.today()
  month=today.month
  year =today.year
  d =today.day
  
  #%%
  
  date =datetime.datetime.now().date() - pd.to_timedelta(&quot;90day&quot;)
  
  date_filter =datetime.datetime.strftime(date,'%Y-%m-%d')
  
  #%%
  
  db = sql.connect(host = 'ffff', 
                   user = 'aadsd', 
                   password ='#######',
                   database = 'ewewewe')
  
  cursor=db.cursor()
  cursor.execute(f&quot;&quot;&quot;select * from table1 t1
  left join table2  t2 on t1.id=t2.id
  where t2.name ='xct' and date(addtime(t1.created_on,&quot;05:30:00&quot;))&gt;{date}; &quot;&quot;&quot;)
  '''
  </code></pre>
  <p>I am new to Python , I have defined <strong>{date}</strong> which in the last cell as</p>
  <p><strong>date</strong> = datetime.datetime.now().date() - pd.to_timedelta(&quot;<strong>90day</strong>&quot;) ,</p>
  <p>I want to split 90 Day part into first 45 day and Next 45 day concept in another cell as currently I am facing issues with error  of &quot;maximum statement execution time exceeded&quot; due to large number of DB records</p>