Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for querying multiple databases available to the Integration #3

Open
orlowdev opened this issue May 18, 2021 · 4 comments · Fixed by jessrezac/gatsby-source-notion-api#1
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@orlowdev
Copy link
Owner

Currently, a databaseId option is required. gatsby-source-notion-api only allows fetching data from the database provided via that option. Technically, it is possible for a Notion integration to have access to multiple databases. In this case, you could choose which pages to pull from which database.

@jessrezac
Copy link

I'm playing around with a fix on this issue for my own purposes but went ahead and tagged the issue in my PR on my fork (figured I'd spend the time writing out a future PR now). I'll comment back when I'm finished tinkering with it if you're interested in taking a look.

@orlowdev
Copy link
Owner Author

Thank you, I'm excited to see it! If you have any questions, don't hesitate to reach out.

@LandonSchropp
Copy link
Contributor

LandonSchropp commented Jan 3, 2022

Instead of modifying the plugin to take in multiple database IDs, another approach might be to use multiple plugins in gatsby-config.js. I believe gatsby-source-graphql uses this approach (unless I've misunderstood their example).

module.exports = {
  plugins: [
    {
      resolve: "gatsby-source-graphql",
      options: {
        typeName: "SWAPI",
        ...
      },
    },
    {
      resolve: "gatsby-source-graphql",
      options: {
        typeName: "GitHub",
        ...
      },
    }
  ],
}

I tried this approach with this plugin and it seems to be fetching both results. In order to make this work, I think you'd only need a parameter that lets you specify the query node name for the result. Currently, it's set to allNotion, but if you could specify it for each configuration, that might solve the problem.

@viteinfinite
Copy link

Thanks @LandonSchropp. That was indeed the simplest solution 👍.
Here's the PR related to this: #24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
4 participants