Skip to content

Cannot pass in parameters for insertMany mutations in Data Connect #8970

@mickeywu

Description

@mickeywu

[REQUIRED] Environment info

firebase-tools: 14.12.0

Platform: Ubuntu

[REQUIRED] Test case

Firebase Data Connect supports batch operations such as _insertMany and _upsertMany.

However, it doesn't appear to be possible to utilize them in a mutation.

Given the following simple schema with one table:

type Actor @table {
  name: String!
}

If I want to dynamically batch create Actors by passing in an array of Actor data, the following fails:

mutation CreateActors($actors: [Actor_Data!]!) @auth(level: PUBLIC) {
  actor_upsertMany(data: $actors)
}

The Data Connect extension throws and error and manually running firebase dataconnect:sdk:generate will also not generated the appropriate SDKs:

On $actors: cannot use Actor_Data as a variable (please use one variable for each field instead, ex: `{foo: $foo}`)Firebase Data Connect: Compiler
Image

[REQUIRED] Steps to reproduce

Create the test schema outlined above and observe the errors.

[REQUIRED] Expected behavior

Mutations allow passing in data objects as parameters and using them in _insertMany / _upsertMany operations.

Firebase documentation has examples of bulk seeding data, but it is with static data only.

[REQUIRED] Actual behavior

Developer defined mutations cannot dynamically batch insert or upsert using parameters passed into the mutation.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions