title: How am I supposed to eagerly load an association using graphql-sequelize without `include`?
body: <p>I'm using graphql-sequelize to implement a GraphQL endpoint. I've just created a new secondary entity and associated it with one of my primary entities, and am now trying to include the related secondary when the primary is fetched. I get the following error when I try to implement that fetch:</p>
  
  <pre><code>AssertionError ERR_ASSERTION Include support has been removed in favor of dataloader batching
  </code></pre>
  
  <p>My old resolver-based gql endpoint looked like this:</p>
  
  <pre><code>driver: {
      type: MyGQLTypes.Driver,
      resolve: resolver(Driver)
  }
  </code></pre>
  
  <p>I know from experimentation elsewhere in the codebase that this normally works:</p>
  
  <pre><code>const driver = Driver.getById(`${uuid}`, {
      include: { model: Helmet }
  })
  // yields:
  // {
  //     id: '&lt;uuid&gt;',
  //     name: 'Tom',
  //     helmetNumber: '470',
  //     Helmet: {
  //         number: '470',
  //         type: 'cool',
  //         color: 'red'
  //     }
  // }
  </code></pre>
  
  <p>So, after checking the <a href="https://github.com/mickhansen/graphql-sequelize/blob/master/src/resolver.js#L82" rel="nofollow noreferrer">source code of graphql-sequelize's <code>resolver</code></a>, and determining that the second argument is passed through to the sqlz accessor, I added the same <code>include</code> to my GQL resolver, like so:</p>
  
  <pre><code>driver: {
      type: MyGQLTypes.Driver,
      resolve: resolver(Driver, {
          include: { model: Helmet }
      })
  }
  </code></pre>
  
  <p>And that's when I get the fatal error. Research indicates the graphql-sequelize folks now disallow <code>include</code> for <a href="https://github.com/mickhansen/graphql-sequelize/issues/424#issuecomment-277680592" rel="nofollow noreferrer">performance reasons</a>, in favor of sequelize's dataloader, which I am not currently using and have no plans to use.</p>
  
  <p>But even if I were, it leaves unanswered the question of how they expect us to fetch associated rows within <code>resolver</code>. I found <a href="https://github.com/mickhansen/graphql-sequelize/issues/433#issuecomment-280947893" rel="nofollow noreferrer">a cryptic comment</a> that suggests there is an alternative called <code>join</code>, but I haven't been able to find documentation for it, and shooting from the hip has failed:</p>
  
  <pre><code>driver: {
      type: MyGQLTypes.Driver,
      resolve: resolver(Driver, {
  
          include: { model: Helmet } // fatal error: disallowed
  
          join: { model: Helmet } // no effect, no error
  
          join: Helmet // no effect, no error
  
      })
  }
  </code></pre>
  
  <p>All I can think to do is to add an <code>after</code> routine to manually fetch the associated model, and then attach that result to the primary model in the same place it would appear if it had been fetched the standard way (i.e. using <code>include</code>), like so:</p>
  
  <pre><code>driver: {
      type: MyGQLTypes.Driver,
      resolve: resolver(Driver, {
  
          // can't do this:
          include: { model: Helmet }
  
          // so I try to emulate it this way:
          after: async (driver) =&gt; {
  
              driver.Helmet = await driver.getHelmet()
  
              return driver
          }
  
      })
  }
  </code></pre>
  
  <p>While that code executes, and finds the model I expect, it fails to attach the found model in the same place.</p>
  
  <p>Sqlz instances are not plain hashes: they have a <code>dataValues</code> property that contains the raw column values from the database, and when you reference <code>myModel.colName</code>, a hidden getter fetches the value from <code>myModel.dataValues[ colName ]</code>. Experimentation reveals that eager loading via <code>include</code> causes the associated model to appear within the <code>dataValues</code> structure, presumably along with any hidden accessors that are needed, like so:</p>
  
  <pre><code>{
      dataValues: {
          id: '&lt;uuid&gt;',
          name: 'Tom',
          helmetNumber: '470',
          Helmet: {
              dataValues: {
                  number: '470,
                  type: 'cool',
                  color: 'red'
              }
          }
      }
  }
  </code></pre>
  
  <p>I am pretty sure I can just attach the fetched model there instead:</p>
  
  <pre><code>driver.dataValues.Helmet = await driver.getHelmet()
  </code></pre>
  
  <p>But I think we are supposed  avoid fiddling with <code>dataValues</code>, and this seems ham-handed.</p>
  
  <p>I'm using <code>apollo-server-express</code>, which (rightly) validates resolver return values against the GQL schema, and as a consequence, my GQL type definition for <code>Driver</code> is technically <em>downstream</em> of this resolve function. I've started to build a bunch of sugar for composing GQL types (particularly when it comes to embedding secondary entities within primaries), and that perspective encourages me to think that <code>resolver</code>-based endpoints ought to have uniformly-shaped returns. I.e. it would be bad if resolvers for some entities emitted broken sqlz model instances, and others returned healthy ones.</p>
  
  <p>How are we supposed to implement eager loading within graphql-sequelize's <code>resolver</code> without <code>include</code>?</p>
  
  <p>Package versions:</p>
  
  <pre><code>apollo-server-express@1.3.2
  graphql-sequelize@5.6.1
  sequelize@4.35.1
  dataloader-sequelize@1.6.3
  </code></pre>