# firebase_functions.dataconnect_fn module

Module for Cloud Functions that are triggered by Firebase Data Connect.

## Classes

| ### Event *class* firebase_functions.dataconnect_fn.Event(*specversion: str* , *id: str* , *source: str* , *type: str* , *time: datetime* , *data: T* , *subject: str \| None* , *location: str* , *project: str* , *params: dict\[str, str\]* , *auth_type: Literal\['app_user', 'admin', 'unknown'\]* , *auth_id: str* ) |
|---|
| Bases: [`CloudEvent`](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.core#firebase_functions.core.CloudEvent "firebase_functions.core.CloudEvent")\[`T`\] A CloudEvent that contains MutationEventData. auth_id*: str* :   The unique identifier for the principal. auth_type*: Literal\['app_user', 'admin', 'unknown'\]* :   The type of principal that triggered the event. location*: str* :   The location of the database. params*: dict\[str, str\]* :   A dict containing the values of the path patterns. Only named capture groups are populated - {key}, {key=\*}, {key=\*\*} project*: str* :   The project identifier. |

| ### GraphQLError *class* firebase_functions.dataconnect_fn.GraphQLError(*message: str* , *locations: list\[dict\[str, int\]\] \| None = None* , *path: list\[str \| int\] \| None = None* , *extensions: [GraphqlErrorExtensions](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.dataconnect_fn#firebase_functions.dataconnect_fn.GraphqlErrorExtensions "firebase_functions.dataconnect_fn.GraphqlErrorExtensions") \| None = None* ) |
|---|
| Bases: `object` An error that occurred during the execution of a GraphQL request. extensions*: [GraphqlErrorExtensions](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.dataconnect_fn#firebase_functions.dataconnect_fn.GraphqlErrorExtensions "firebase_functions.dataconnect_fn.GraphqlErrorExtensions") \| None* *= None* : locations*: list\[dict\[str, int\]\] \| None* *= None* :   The source locations where the error occurred. Locations should help developers and toolings identify the source of error quickly. Included in admin endpoints (ExecuteGraphql, ExecuteGraphqlRead, UpdateSchema and UpdateConnector) to reference the provided GraphQL GQL document. Omitted in ExecuteMutation and ExecuteQuery since the caller shouldn't have access access the underlying GQL source. message*: str* :   A string describing the error. path*: list\[str \| int\] \| None* *= None* :   The result field which could not be populated due to error. Clients can use path to identify whether a null result is intentional or caused by a runtime error. It should be a list of string or index from the root of GraphQL query document. |

| ### GraphqlErrorExtensions *class* firebase_functions.dataconnect_fn.GraphqlErrorExtensions(*file: str* , *code: str* , *debug_details: str* ) |
|---|
| Bases: `object` GraphqlErrorExtensions contains additional information of GraphqlError. code*: str* :   Maps to canonical gRPC codes. If not specified, it represents Code.INTERNAL. debug_details*: str* :   More detailed error message to assist debugging. It contains application business logic that are inappropriate to leak publicly. In the emulator, Data Connect API always includes it to assist local development and debugging. In the backend, ConnectorService always hides it. GraphqlService without impersonation always include it. GraphqlService with impersonation includes it only if explicitly opted-in with include_debug_details in GraphqlRequestExtensions. file*: str* :   The source file name where the error occurred. Included only for UpdateSchema and UpdateConnector, it corresponds to File.path of the provided Source. |

| ### Mutation *class* firebase_functions.dataconnect_fn.Mutation(*data: Any* , *variables: Any* , *errors: list\[[GraphQLError](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.dataconnect_fn#firebase_functions.dataconnect_fn.GraphQLError "firebase_functions.dataconnect_fn.GraphQLError")\] \| None = None* ) |
|---|
| Bases: `object` An object within Firebase Data Connect. data*: Any* :   The result of the execution of the requested operation. If an error was raised before execution begins, the data entry should not be present in the result. (a request error: <https://spec.graphql.org/draft/#sec-Errors.Request-Errors>) If an error was raised during the execution that prevented a valid response, the data entry in the response should be null. (a field error: <https://spec.graphql.org/draft/#sec-Errors.Error-Result-Format>) errors*: list\[[GraphQLError](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.dataconnect_fn#firebase_functions.dataconnect_fn.GraphQLError "firebase_functions.dataconnect_fn.GraphQLError")\] \| None* *= None* :   Errors of this response. If the data entry in the response is not present, the errors entry must be present. It conforms to <https://spec.graphql.org/draft/#sec-Errors>. variables*: Any* :   Values for GraphQL variables provided in this request. |

| ### MutationEventData *class* firebase_functions.dataconnect_fn.MutationEventData(*payload: [Mutation](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.dataconnect_fn#firebase_functions.dataconnect_fn.Mutation "firebase_functions.dataconnect_fn.Mutation")* ) |
|---|
| Bases: `object` The data within all Mutation events. payload*: [Mutation](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.dataconnect_fn#firebase_functions.dataconnect_fn.Mutation "firebase_functions.dataconnect_fn.Mutation")* : |

| ### SourceLocation *class* firebase_functions.dataconnect_fn.SourceLocation(*line: int* , *column: int* ) |
|---|
| Bases: `object` SourceLocation references a location in a GraphQL source. column*: int* :   Column number starting at 1. line*: int* :   Line number starting at 1. |

## Functions

| ### on_mutation_executed firebase_functions.dataconnect_fn.on_mutation_executed(*\*\*kwargs* ) → Callable\[\[Callable\[\[[Event](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.dataconnect_fn#firebase_functions.dataconnect_fn.Event "firebase_functions.dataconnect_fn.Event")\[[MutationEventData](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.dataconnect_fn#firebase_functions.dataconnect_fn.MutationEventData "firebase_functions.dataconnect_fn.MutationEventData")\]\], None\]\], Callable\[\[[Event](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.dataconnect_fn#firebase_functions.dataconnect_fn.Event "firebase_functions.dataconnect_fn.Event")\[[MutationEventData](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.dataconnect_fn#firebase_functions.dataconnect_fn.MutationEventData "firebase_functions.dataconnect_fn.MutationEventData")\]\], None\]\] |
|---|
| Event handler that triggers when a mutation is executed in Firebase Data Connect. Example: ``` @on_mutation_executed( service = "service-id", connector = "connector-id", operation = "mutation-name" ) def mutation_executed_handler(event: Event[MutationEventData]): pass ``` Parameters: :   **\*\*kwargs** (as [`firebase_functions.options.DataConnectOptions`](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.options#firebase_functions.options.DataConnectOptions "firebase_functions.options.DataConnectOptions")) -- DataConnect options. Return type: :   `typing.Callable` \[ \[ [`firebase_functions.dataconnect_fn.Event`](https://firebase.google.com/docs/reference/functions/2nd-gen/python/firebase_functions.dataconnect_fn#firebase_functions.dataconnect_fn.Event "firebase_functions.dataconnect_fn.Event") \[ `object` \] \], None \] A function that takes a DataConnect event and returns `None`. |