title: How do I use get_or_insert in GAE?
body: <p>According to the <a href="https://developers.google.com/appengine/docs/python/datastore/modelclass#Model_get_or_insert" rel="nofollow">documentation</a> I have to pass in first the key, and then I shall pass in all the properties that I would like to initialise, so that the model is saved. All of that is done in form of a **kwargs.</p>
  
  <p>The definition seems to be like this:</p>
  
  <pre><code>def _get_or_insert(*args, **kwds):
  </code></pre>
  
  <p>This is the way I intended to use it, but yet it throws an exception:</p>
  
  <pre><code>record1, is_created = Record.get_or_insert(record_key, {'record_date' : event1.date_time, 'user' : user.key})
  </code></pre>
  
  <p>The model is defined as:</p>
  
  <pre><code>class Record(ndb.Model):
      user = ndb.KeyProperty(kind=User)
      record_date = ndb.DateProperty(required=True)
  </code></pre>
  
  <p>Exception:</p>
  
  <blockquote>
    <p>File
    "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/ndb/model.py",
    line 3396, in _get_or_insert_async
        cls, name = args  # These must always be positional. ValueError: too many values to unpack</p>
  </blockquote>
  
  <p>Any advice?</p>