DataConnect class

The FirebaseDataConnect service interface.

Signature:

exportdeclareclassDataConnect

Properties

PropertyModifiersTypeDescription
appApp
connectorConfigConnectorConfig

Methods

MethodModifiersDescription
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

ParameterTypeDescription
querystringThe GraphQL query or mutation.
optionsGraphqlOptions<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

ParameterTypeDescription
querystringThe GraphQL read-only query.
optionsGraphqlOptions<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

ParameterTypeDescription
namestringThe name of the defined mutation to execute.
optionsOperationOptionsThe 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

ParameterTypeDescription
namestringThe name of the defined mutation to execute.
variablesVariablesThe variables for the mutation. May be optional if the mutation's variables are optional.
optionsOperationOptionsThe 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

ParameterTypeDescription
namestringThe name of the defined query to execute.
optionsOperationOptionsThe 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

ParameterTypeDescription
namestringThe name of the defined query to execute.
variablesVariablesThe variables for the query. May be optional if the query's variables are optional.
optionsOperationOptionsThe 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

ParameterTypeDescription
tableNamestringThe name of the table to insert data into.
variablesVariablesThe 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

ParameterTypeDescription
tableNamestringThe name of the table to insert data into.
variablesVariablesAn 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

ParameterTypeDescription
tableNamestringThe name of the table to upsert data into.
variablesVariablesThe 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

ParameterTypeDescription
tableNamestringThe name of the table to upsert data into.
variablesVariablesAn 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.