title: duplicate records in my results
body: <p>my model defines like this</p>
  
  <pre><code>class UserAppWeekStatistics(db.Model):
  __tablename__ = 'user_app_week_statistics'
  id = db.Column(db.Integer, primary_key=True)
  imei = db.Column(db.String(15), primary_key=True, index=True)
  year = db.Column(db.Integer, primary_key=True,
                   default=int(datetime.now().strftime('%Y')), index=True)
  week = db.Column(db.Integer, primary_key=True,
                   default=int(datetime.now().strftime('%W')), index=True)
  count = db.Column(db.Integer, default=0)
  
  def __repr__(self):
      return '&lt;UserAppWeekStatistics %r-%r-%r&gt;' % (self.imei, self.year, self.week)
  </code></pre>
  
  <p>and in my views</p>
  
  <pre><code>user_app_week_statistics = UserAppWeekStatistics.query.filter_by(imei=json_req['imei'],
                                                                   year=int(datetime.now().strftime('%Y')),
                                                                   week=int(datetime.now().strftime('%W'))).first()
  if user_app_week_statistics is None:
      user_app_week_statistics = UserAppWeekStatistics()
      user_app_week_statistics.imei = json_req['imei']
      user_app_week_statistics.count = 1
  else:
      user_app_week_statistics.count += 1
  db.session.add(user_app_week_statistics)
  db.session.commit()
  </code></pre>
  
  <p>and bellow is capture my results in my database.
  <a href="https://i.stack.imgur.com/3IzyE.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3IzyE.jpg" alt="enter image description here"></a></p>
  
  <p>In my opinion, there would be just one record with same imei, year and week, but in my project there may be many duplicate records with same imei ,year and week. I am really confused.My database is mysql 5.6. </p>