llama-index-readers-airbyte-salesforce


Namellama-index-readers-airbyte-salesforce JSON
Version 0.1.3 PyPI version JSON
download
home_page
Summaryllama-index readers airbyte_salesforce integration
upload_time2024-02-21 19:17:49
maintainerflash1293
docs_urlNone
authorYour Name
requires_python>=3.8.1,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Airbyte Salesforce Loader

The Airbyte Salesforce Loader allows you to access different Salesforce objects.

## Installation

- Install llama_hub: `pip install llama_hub`
- Install the salesforce source: `pip install airbyte-source-salesforce`

## Usage

Here's an example usage of the AirbyteSalesforceReader.

```python
from llama_hub.airbyte_salesforce import AirbyteSalesforceReader

salesforce_config = {
    # ...
}
reader = AirbyteSalesforceReader(config=salesforce_config)
documents = reader.load_data(stream_name="asset")
```

## Configuration

Check out the [Airbyte documentation page](https://docs.airbyte.com/integrations/sources/salesforce/) for details about how to configure the reader.
The JSON schema the config object should adhere to can be found on Github: [https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/source-salesforce/source_salesforce/spec.yaml](https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/source-salesforce/source_salesforce/spec.yaml).

The general shape looks like this:

```python
{
    "client_id": "<oauth client id>",
    "client_secret": "<oauth client secret>",
    "refresh_token": "<oauth refresh token>",
    "start_date": "<date from which to start retrieving records from in ISO format, e.g. 2020-10-20T00:00:00Z>",
    "is_sandbox": False,  # set to True if you're using a sandbox environment
    "streams_criteria": [  # Array of filters for salesforce objects that should be loadable
        {
            "criteria": "exacts",
            "value": "Account",
        },  # Exact name of salesforce object
        {"criteria": "starts with", "value": "Asset"},  # Prefix of the name
        # Other allowed criteria: ends with, contains, starts not with, ends not with, not contains, not exacts
    ],
}
```

By default all fields are stored as metadata in the documents and the text is set to the JSON representation of all the fields. Construct the text of the document by passing a `record_handler` to the reader:

```python
def handle_record(record, id):
    return Document(
        doc_id=id, text=record.data["title"], extra_info=record.data
    )


reader = AirbyteSalesforceReader(
    config=salesforce_config, record_handler=handle_record
)
```

## Lazy loads

The `reader.load_data` endpoint will collect all documents and return them as a list. If there are a large number of documents, this can cause issues. By using `reader.lazy_load_data` instead, an iterator is returned which can be consumed document by document without the need to keep all documents in memory.

## Incremental loads

This loader supports loading data incrementally (only returning documents that weren't loaded last time or got updated in the meantime):

```python
reader = AirbyteSalesforceReader(config={...})
documents = reader.load_data(stream_name="asset")
current_state = reader.last_state  # can be pickled away or stored otherwise

updated_documents = reader.load_data(
    stream_name="asset", state=current_state
)  # only loads documents that were updated since last time
```

This loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/tree/main/llama_index) and/or subsequently used as a Tool in a [LangChain](https://github.com/hwchase17/langchain) Agent. See [here](https://github.com/emptycrown/llama-hub/tree/main) for examples.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "llama-index-readers-airbyte-salesforce",
    "maintainer": "flash1293",
    "docs_url": null,
    "requires_python": ">=3.8.1,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/6c/dd/7d47d574b6e2ee9bb414068d1a314c2c5c8f320979fbfb19b73ff676801f/llama_index_readers_airbyte_salesforce-0.1.3.tar.gz",
    "platform": null,
    "description": "# Airbyte Salesforce Loader\n\nThe Airbyte Salesforce Loader allows you to access different Salesforce objects.\n\n## Installation\n\n- Install llama_hub: `pip install llama_hub`\n- Install the salesforce source: `pip install airbyte-source-salesforce`\n\n## Usage\n\nHere's an example usage of the AirbyteSalesforceReader.\n\n```python\nfrom llama_hub.airbyte_salesforce import AirbyteSalesforceReader\n\nsalesforce_config = {\n    # ...\n}\nreader = AirbyteSalesforceReader(config=salesforce_config)\ndocuments = reader.load_data(stream_name=\"asset\")\n```\n\n## Configuration\n\nCheck out the [Airbyte documentation page](https://docs.airbyte.com/integrations/sources/salesforce/) for details about how to configure the reader.\nThe JSON schema the config object should adhere to can be found on Github: [https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/source-salesforce/source_salesforce/spec.yaml](https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/source-salesforce/source_salesforce/spec.yaml).\n\nThe general shape looks like this:\n\n```python\n{\n    \"client_id\": \"<oauth client id>\",\n    \"client_secret\": \"<oauth client secret>\",\n    \"refresh_token\": \"<oauth refresh token>\",\n    \"start_date\": \"<date from which to start retrieving records from in ISO format, e.g. 2020-10-20T00:00:00Z>\",\n    \"is_sandbox\": False,  # set to True if you're using a sandbox environment\n    \"streams_criteria\": [  # Array of filters for salesforce objects that should be loadable\n        {\n            \"criteria\": \"exacts\",\n            \"value\": \"Account\",\n        },  # Exact name of salesforce object\n        {\"criteria\": \"starts with\", \"value\": \"Asset\"},  # Prefix of the name\n        # Other allowed criteria: ends with, contains, starts not with, ends not with, not contains, not exacts\n    ],\n}\n```\n\nBy default all fields are stored as metadata in the documents and the text is set to the JSON representation of all the fields. Construct the text of the document by passing a `record_handler` to the reader:\n\n```python\ndef handle_record(record, id):\n    return Document(\n        doc_id=id, text=record.data[\"title\"], extra_info=record.data\n    )\n\n\nreader = AirbyteSalesforceReader(\n    config=salesforce_config, record_handler=handle_record\n)\n```\n\n## Lazy loads\n\nThe `reader.load_data` endpoint will collect all documents and return them as a list. If there are a large number of documents, this can cause issues. By using `reader.lazy_load_data` instead, an iterator is returned which can be consumed document by document without the need to keep all documents in memory.\n\n## Incremental loads\n\nThis loader supports loading data incrementally (only returning documents that weren't loaded last time or got updated in the meantime):\n\n```python\nreader = AirbyteSalesforceReader(config={...})\ndocuments = reader.load_data(stream_name=\"asset\")\ncurrent_state = reader.last_state  # can be pickled away or stored otherwise\n\nupdated_documents = reader.load_data(\n    stream_name=\"asset\", state=current_state\n)  # only loads documents that were updated since last time\n```\n\nThis loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/tree/main/llama_index) and/or subsequently used as a Tool in a [LangChain](https://github.com/hwchase17/langchain) Agent. See [here](https://github.com/emptycrown/llama-hub/tree/main) for examples.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "llama-index readers airbyte_salesforce integration",
    "version": "0.1.3",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0dfdf1b6575ba2b0b8abd20bd184924d0963d7150166f63937fd9f3fdb7429a5",
                "md5": "c476f21b2d9c8d3321ebe14e16a56c12",
                "sha256": "c82a193c6b807e2e8ac62f1e28148f3a82f2a9375b809b3ded3a3bf7bcb1d3b2"
            },
            "downloads": -1,
            "filename": "llama_index_readers_airbyte_salesforce-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c476f21b2d9c8d3321ebe14e16a56c12",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.1,<4.0",
            "size": 3412,
            "upload_time": "2024-02-21T19:17:47",
            "upload_time_iso_8601": "2024-02-21T19:17:47.625711Z",
            "url": "https://files.pythonhosted.org/packages/0d/fd/f1b6575ba2b0b8abd20bd184924d0963d7150166f63937fd9f3fdb7429a5/llama_index_readers_airbyte_salesforce-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6cdd7d47d574b6e2ee9bb414068d1a314c2c5c8f320979fbfb19b73ff676801f",
                "md5": "12e76d99dae6d295f372ea2f56cb7704",
                "sha256": "13e4fb3841e74baeba843b45bed0bdd847c2e72400afc7609e7b5ef2998b5624"
            },
            "downloads": -1,
            "filename": "llama_index_readers_airbyte_salesforce-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "12e76d99dae6d295f372ea2f56cb7704",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.1,<4.0",
            "size": 3069,
            "upload_time": "2024-02-21T19:17:49",
            "upload_time_iso_8601": "2024-02-21T19:17:49.464889Z",
            "url": "https://files.pythonhosted.org/packages/6c/dd/7d47d574b6e2ee9bb414068d1a314c2c5c8f320979fbfb19b73ff676801f/llama_index_readers_airbyte_salesforce-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-21 19:17:49",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-readers-airbyte-salesforce"
}
        
Elapsed time: 0.18848s