> For the complete documentation index, see [llms.txt](https://docs.vectice.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vectice.com/25.2/log-and-manage-assets-with-vectice-api/log-assets-to-vectice/log-a-custom-data-source.md).

# Log a custom data source

To wrap data from any data source, create a custom resource class and inherit from the Vectice base`Resource` class. Then create a `_build_metadata()` and `_fetch_data()` method to collect metadata from your custom data sources.

## Custom resource example code

Below is a pre-built custom resource code example you could use to build your own data resource:

```python
from vectice import Resource, DatasetSourceOrigin, FilesMetadata

class MyCustomResource(Resource):
    _source_name = "Data source name"
    
    def __init__(
                self,
                paths: str | list[str],
            ):
                super().__init__(paths=paths)

    def _build_metadata(self) -> FilesMetadata:  # 
        files = ...  # fetch file list from your custom storage, retrieve them from self._paths
        total_size = ...  # compute total file size
        return FilesMetadata(
            size=total_size,
            origin=self._source_name,
            files=files,
            usage=self.usage,
        )

    def _fetch_data(self) -> dict[str, bytes]:
        files_data = {}
        for file in self.metadata.files:
            file_contents = ...  # fetch file contents from your custom storage
            files_data[file.name] = file_contents
        return files_data
```

From this point, you can use your custom resource class to wrap data from any data source (i.e., Redshift, RDS, Snowflake, etc).

To learn how to log your dataset from your custom data source, view our [How to log datasets](/25.2/log-and-manage-assets-with-vectice-api/log-assets-to-vectice/log-datasets.md) guide.

<figure><img src="/files/9N7tOnLgcncWIUZTScD7" alt=""><figcaption><p>Filter Datasets by Data Source in the UI</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.vectice.com/25.2/log-and-manage-assets-with-vectice-api/log-assets-to-vectice/log-a-custom-data-source.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
