DataConnect class Stay organized with collections Save and categorize content based on your preferences.
The FirebaseDataConnect service interface.
Signature:
exportdeclareclassDataConnectProperties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| app | App | ||
| connectorConfig | ConnectorConfig |
Methods
| Method | Modifiers | Description |
|---|---|---|
| executeGraphql(query, options) | Execute an arbitrary GraphQL query or mutation | |
| executeGraphqlRead(query, options) | Execute an arbitrary read-only GraphQL query | |
| executeMutation(name, options) | Executes a GraphQL mutation. The mutation must be defined in your Data Connect GraphQL files. Optionally, you can provide auth impersonation details. If you don't specify a value for this option, the query will run with admin privileges and will ignore all auth directives. | |
| executeMutation(name, variables, options) | Executes a GraphQL mutation. The mutation must be defined in your Data Connect GraphQL files. Optionally, you can provide auth impersonation details. If you don't specify a value for this option, the query will run with admin privileges and will ignore all auth directives. | |
| executeQuery(name, options) | Executes a GraphQL query. The query must be defined in your Data Connect GraphQL files. Optionally, you can provide auth impersonation details. If you don't specify a value for this option, the query will run with admin privileges and will ignore all auth directives. | |
| executeQuery(name, variables, options) | Executes a GraphQL query. The query must be defined in your Data Connect GraphQL files. Optionally, you can provide auth impersonation details. If you don't specify a value for this option, the query will run with admin privileges and will ignore all auth directives. | |
| insert(tableName, variables) | Insert a single row into the specified table. | |
| insertMany(tableName, variables) | Insert multiple rows into the specified table. | |
| upsert(tableName, variables) | Insert a single row into the specified table, or update it if it already exists. | |
| upsertMany(tableName, variables) | Insert multiple rows into the specified table, or update them if they already exist. |
DataConnect.app
Signature:
readonlyapp:App;DataConnect.connectorConfig
Signature:
readonlyconnectorConfig:ConnectorConfig;DataConnect.executeGraphql()
Execute an arbitrary GraphQL query or mutation
Signature:
executeGraphql<GraphqlResponse,Variables>(query:string,options?:GraphqlOptions<Variables>):Promise<ExecuteGraphqlResponse<GraphqlResponse>>;Parameters
| Parameter | Type | Description |
|---|---|---|
| query | string | The GraphQL query or mutation. |
| options | GraphqlOptions<Variables> | OptionalGraphqlOptions when executing a GraphQL query or mutation. |
Returns:
Promise<ExecuteGraphqlResponse<GraphqlResponse>>
A promise that fulfills with aExecuteGraphqlResponse.
DataConnect.executeGraphqlRead()
Execute an arbitrary read-only GraphQL query
Signature:
executeGraphqlRead<GraphqlResponse,Variables>(query:string,options?:GraphqlOptions<Variables>):Promise<ExecuteGraphqlResponse<GraphqlResponse>>;Parameters
| Parameter | Type | Description |
|---|---|---|
| query | string | The GraphQL read-only query. |
| options | GraphqlOptions<Variables> | OptionalGraphqlOptions when executing a read-only GraphQL query. |
Returns:
Promise<ExecuteGraphqlResponse<GraphqlResponse>>
A promise that fulfills with aExecuteGraphqlResponse.
DataConnect.executeMutation()
Executes a GraphQL mutation. The mutation must be defined in your Data Connect GraphQL files. Optionally, you can provide auth impersonation details. If you don't specify a value for this option, the query will run with admin privileges and will ignore all auth directives.
Signature:
executeMutation<Data>(name:string,options?:OperationOptions):Promise<ExecuteOperationResponse<Data>>;Parameters
| Parameter | Type | Description |
|---|---|---|
| name | string | The name of the defined mutation to execute. |
| options | OperationOptions | The GraphQL options, must include operationName and impersonation details. |
Returns:
Promise<ExecuteOperationResponse<Data>>
A promise that fulfills with the GraphQL response.
DataConnect.executeMutation()
Executes a GraphQL mutation. The mutation must be defined in your Data Connect GraphQL files. Optionally, you can provide auth impersonation details. If you don't specify a value for this option, the query will run with admin privileges and will ignore all auth directives.
Signature:
executeMutation<Data,Variables>(name:string,variables:Variables,options?:OperationOptions):Promise<ExecuteOperationResponse<Data>>;Parameters
| Parameter | Type | Description |
|---|---|---|
| name | string | The name of the defined mutation to execute. |
| variables | Variables | The variables for the mutation. May be optional if the mutation's variables are optional. |
| options | OperationOptions | The GraphQL options, must include operationName and impersonation details. |
Returns:
Promise<ExecuteOperationResponse<Data>>
A promise that fulfills with the GraphQL response.
DataConnect.executeQuery()
Executes a GraphQL query. The query must be defined in your Data Connect GraphQL files. Optionally, you can provide auth impersonation details. If you don't specify a value for this option, the query will run with admin privileges and will ignore all auth directives.
Signature:
executeQuery<Data>(name:string,options?:OperationOptions):Promise<ExecuteOperationResponse<Data>>;Parameters
| Parameter | Type | Description |
|---|---|---|
| name | string | The name of the defined query to execute. |
| options | OperationOptions | The GraphQL options, must include operationName and impersonation details. |
Returns:
Promise<ExecuteOperationResponse<Data>>
A promise that fulfills with the GraphQL response.
DataConnect.executeQuery()
Executes a GraphQL query. The query must be defined in your Data Connect GraphQL files. Optionally, you can provide auth impersonation details. If you don't specify a value for this option, the query will run with admin privileges and will ignore all auth directives.
Signature:
executeQuery<Data,Variables>(name:string,variables:Variables,options?:OperationOptions):Promise<ExecuteOperationResponse<Data>>;Parameters
| Parameter | Type | Description |
|---|---|---|
| name | string | The name of the defined query to execute. |
| variables | Variables | The variables for the query. May be optional if the query's variables are optional. |
| options | OperationOptions | The GraphQL options, must include operationName and impersonation details. |
Returns:
Promise<ExecuteOperationResponse<Data>>
A promise that fulfills with the GraphQL response.
DataConnect.insert()
Insert a single row into the specified table.
Signature:
insert<GraphQlResponse,Variablesextendsobject>(tableName:string,variables:Variables):Promise<ExecuteGraphqlResponse<GraphQlResponse>>;Parameters
| Parameter | Type | Description |
|---|---|---|
| tableName | string | The name of the table to insert data into. |
| variables | Variables | The data object to insert. The keys should correspond to the column names. |
Returns:
Promise<ExecuteGraphqlResponse<GraphQlResponse>>
A promise that fulfills with aExecuteGraphqlResponse.
DataConnect.insertMany()
Insert multiple rows into the specified table.
Signature:
insertMany<GraphQlResponse,VariablesextendsArray<unknown>>(tableName:string,variables:Variables):Promise<ExecuteGraphqlResponse<GraphQlResponse>>;Parameters
| Parameter | Type | Description |
|---|---|---|
| tableName | string | The name of the table to insert data into. |
| variables | Variables | An array of data objects to insert. Each object's keys should correspond to the column names. |
Returns:
Promise<ExecuteGraphqlResponse<GraphQlResponse>>
A promise that fulfills with aExecuteGraphqlResponse.
DataConnect.upsert()
Insert a single row into the specified table, or update it if it already exists.
Signature:
upsert<GraphQlResponse,Variablesextendsobject>(tableName:string,variables:Variables):Promise<ExecuteGraphqlResponse<GraphQlResponse>>;Parameters
| Parameter | Type | Description |
|---|---|---|
| tableName | string | The name of the table to upsert data into. |
| variables | Variables | The data object to upsert. The keys should correspond to the column names. |
Returns:
Promise<ExecuteGraphqlResponse<GraphQlResponse>>
A promise that fulfills with aExecuteGraphqlResponse.
DataConnect.upsertMany()
Insert multiple rows into the specified table, or update them if they already exist.
Signature:
upsertMany<GraphQlResponse,VariablesextendsArray<unknown>>(tableName:string,variables:Variables):Promise<ExecuteGraphqlResponse<GraphQlResponse>>;Parameters
| Parameter | Type | Description |
|---|---|---|
| tableName | string | The name of the table to upsert data into. |
| variables | Variables | An array of data objects to upsert. Each object's keys should correspond to the column names. |
Returns:
Promise<ExecuteGraphqlResponse<GraphQlResponse>>
A promise that fulfills with aExecuteGraphqlResponse.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-11-05 UTC.