> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open-metadata.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Service Mixin

[<img src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/src/metadata/ingestion/ometa/mixins/service_mixin.py#L0")

# module `service_mixin`

Helper mixin to handle services

***

[<img src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/src/metadata/ingestion/ometa/mixins/service_mixin.py#L33")

## class `OMetaServiceMixin`

OpenMetadata API methods related to service.

To be inherited by OpenMetadata

***

[<img src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/src/metadata/ingestion/ometa/mixins/service_mixin.py#L64")

### method `create_service_from_source`

```python theme={null}
create_service_from_source(entity: Type[~T], config: Source) → ~T
```

Create a service of type T.

We need to extract from the WorkflowSource:

* name: serviceName
* serviceType: Type Enum
* connection: (DatabaseConnection, DashboardConnection...)

**Args:**

`entity`: Service Type

`config`: WorkflowSource

**Returns:**

Created Service

***

[<img src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/src/metadata/ingestion/ometa/mixins/service_mixin.py#L42")

### method `get_create_service_from_source`

```python theme={null}
get_create_service_from_source(entity: Type[~T], config: Source) → ~C
```

Prepare a CreateService request from source config

**Args:**

`entity`: Service Type

`config`: WorkflowSource

**Returns:**

CreateService request

If the OpenMetadata Connection has storeServiceConnection set to false, we won't pass the connection details when creating the service.

***

[<img src="https://img.shields.io/badge/-source-cccccc?style=flat-square" />](https://github.com/open-metadata/OpenMetadata/tree/main/ingestion/src/metadata/ingestion/ometa/mixins/service_mixin.py#L83")

### method `get_service_or_create`

```python theme={null}
get_service_or_create(entity: Type[~T], config: Source) → ~T
```

Fetches a service by name, or creates it using the WorkflowSource config

**Args:**

`entity`: Entity Type to get or create

`config`: WorkflowSource

**Returns:**
Entity Service of T

***
