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

# Source

> Implement the Source component of a custom Collate connector, which connects to an external system and emits records for ingestion.

# Source

The **Source** is the connector to external systems and outputs a record for downstream to process and push to Collate.

## Source API

```python theme={null}
class Source(IterStep, ABC):
    """
    Abstract source implementation. The workflow will run
    its next_record and pass them to the next step.
    """

    metadata: OpenMetadata
    connection_obj: Any
    service_connection: Any

    # From the parent - Adding here just to showcase
    @abstractmethod
    def _iter(self) -> Iterable[Either]:
        """Main entrypoint to run through the Iterator"""

    @abstractmethod
    def prepare(self):
        pass

    @abstractmethod
    def test_connection(self) -> None:
        pass
```

**prepare** will be called through Python's init method. This will be a place where you could make connections to external sources or initiate the client library.

**\_iter** is where the client can connect to an external resource and emit the data downstream.

**test\_connection** is used (by Collate supported connectors ONLY) to validate permissions and connectivity before moving forward with the ingestion.

## Example

A simple example of this implementation can be found in the [Custom Database connector example](https://github.com/open-metadata/OpenMetadata/blob/main/ingestion/tests/integration/custom_connectors/custom_database.py).

## For Consumers of openmetadata-ingestion to Define Custom Connectors in Their Own Package with the Same Namespace

As a consumer of the `openmetadata-ingestion` package, you can add your custom connectors within the same namespace from a different package repository.

**Here is the situation**

```
├─my_code_repository_package
  ├── src
      ├── my_other_relevant_code_package
      ├── metadata
      │   └── ingestion
      │       └── source
      │        └── database
      │         └── my_awesome_connector.py
      └── setup.py
├── openmetadata_ingestion
  ├── src
      ├── metadata
      │   └── ingestion
      │       └── source
      │        └── database
      │         └── existingSource1
      |         └── existingSource2
      |         └── ....
      └── setup.py
```

If you want my\_awesome\_connector.py to build as a source and run as a part of workflows defined in openmetadata\_ingestion below are the steps.

**First add your custom project in PyCharm.**

![Add project in pycharm](https://mintcdn.com/collatedocs/4naDY91iIgdASVXO/public/images/sdk/python/build-connector/add-project-in-pycharm.png?fit=max\&auto=format\&n=4naDY91iIgdASVXO\&q=85\&s=c6032e5d26449fc455e6e89c0d7f1f8b)

**Now Go to IDE and Project Settings in PyCharm, inside that go to project section, and select python interpreter, Select virtual environment created for the project as python interpreter**

![Select interpreter in pycharm](https://mintcdn.com/collatedocs/4naDY91iIgdASVXO/public/images/sdk/python/build-connector/select-interpreter.png?fit=max\&auto=format\&n=4naDY91iIgdASVXO\&q=85\&s=3d3a5c8e09124b584267aa97f57eadc6)

**Now apply and confirm that interpreter**

![Select interpreter in pycharm](https://mintcdn.com/collatedocs/4naDY91iIgdASVXO/public/images/sdk/python/build-connector/add-interpreter.png?fit=max\&auto=format\&n=4naDY91iIgdASVXO\&q=85\&s=6992e6715fad86689c60fb645926846c)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.