title: Best database practices for a global single element?
body: <p>I've been recently developing a Django app (using MySQL) that globally depends on a single constantly-changing list of values. I save them on a JSON Field that's something like</p>
  
  <pre><code>{'value1':0.123, 'value2':2.33214, ...}
  </code></pre>
  
  <p>I use a cron job that runs 24/7 that retrieves this object once at the start and then updates it every second. To do this, i do something like</p>
  
  <pre><code>L = ValuesList.objects.all().first()
  if L is None:
      L = ValuesList.objects.create(my_json=some_default)
  </code></pre>
  
  <p>And this code is pretty much present whenever i want to get the values. If that looks bad, i even used to do</p>
  
  <pre><code>try:
      L = ValuesList.objects.get(id=1)
  catch:
      L = ValuesList.objects.create(my_json=some_default)
  </code></pre>
  
  <p>My question comes from that situation, it looks messy because i know beforehand that it's a SINGLE object, so i figured there could be something more appropriate to use for THE object (which, by the way, is guaranteed to exist, the whole business logic depends on this), instead of doing a model, creating tables and then searching for the first element if it exists. </p>
  
  <p>Is there a better way that i do not know of to store and retrieve a single object? Thanks!</p>