Skip to main content

llama-index readers airbyte_shopify integration

Project description

Airbyte Shopify Loader

pip install llama-index-readers-airbyte-shopify

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

Usage

Here's an example usage of the AirbyteShopifyReader.

from llama_index.readers.airbyte_shopify import AirbyteShopifyReader

shopify_config = {
    # ...
}
reader = AirbyteShopifyReader(config=shopify_config)
documents = reader.load_data(stream_name="orders")

Configuration

Check out the Airbyte documentation page 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-shopify/source_shopify/spec.json.

The general shape looks like this:

{
    "start_date": "<date from which to start retrieving records from in ISO format, e.g. 2020-10-20T00:00:00Z>",
    "shop": "<name of the shop you want to retrieve documents from>",
    "credentials": {
        "auth_method": "api_password",
        "api_password": "<your api password>",
    },
}

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:

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


reader = AirbyteShopifyReader(
    config=shopify_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):

reader = AirbyteShopifyReader(config={...})
documents = reader.load_data(stream_name="orders")
current_state = reader.last_state  # can be pickled away or stored otherwise

updated_documents = reader.load_data(
    stream_name="orders", 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_readers_airbyte_shopify-0.4.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file llama_index_readers_airbyte_shopify-0.4.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_readers_airbyte_shopify-0.4.1.tar.gz
Algorithm Hash digest
SHA256 9f0212cac8268105aafef5c19d337cda91a7b80483f6df19b3d8d2926a5cee24
MD5 277cf5e62eded78aeed278886cef7f47
BLAKE2b-256 f971d254265209fbc28563e7a8f8284632da6fe079c3da250390d3a0cd2f4ac4

See more details on using hashes here.

File details

Details for the file llama_index_readers_airbyte_shopify-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_readers_airbyte_shopify-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f575535ccee2831690716ed6c8deae1f719923bf27efd5b537092a2467623343
MD5 f8f8a52acc1d72c71c3b66056aa1cfc2
BLAKE2b-256 cbf5d03d8ecf2d51efb3f7a18ccc81f229d2d6e357181c975b3340ebc1c5b98a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page