Skip to main content

llama-index readers airbyte_stripe integration

Project description

Airbyte Stripe Loader

pip install llama-index-readers-airbyte-stripe

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

Usage

Here's an example usage of the AirbyteStripeReader.

from llama_index.readers.airbyte_stripe import AirbyteStripeReader

stripe_config = {
    # ...
}
reader = AirbyteStripeReader(config=stripe_config)
documents = reader.load_data(stream_name="invoices")

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-stripe/source_stripe/spec.yaml.

The general shape looks like this:

{
    "client_secret": "<secret key>",
    "account_id": "<account id>",
    "start_date": "<date from which to start retrieving records from in ISO format, e.g. 2020-10-20T00:00:00Z>",
}

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 = AirbyteStripeReader(
    config=stripe_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 = AirbyteStripeReader(config={...})
documents = reader.load_data(stream_name="invoices")
current_state = reader.last_state  # can be pickled away or stored otherwise

updated_documents = reader.load_data(
    stream_name="invoices", 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_stripe-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_stripe-0.4.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_readers_airbyte_stripe-0.4.1.tar.gz
Algorithm Hash digest
SHA256 989cfce4e8ca4b54c1798cbb4862ad6de901f9ba67a4de4d48d80aa3fabf095a
MD5 d9f2608caeedf198d53697a2afbced6e
BLAKE2b-256 23378a7b9d04b10b309309ea31ce8d71b58a8c3a7e11d21a66dc91a73a8edf86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_readers_airbyte_stripe-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 999cba7571f1cff4142d32a046d3cd51c461d0abe46c07d7486c1b2fa49f5bcb
MD5 40ed3104ebe0f537b6f6e2edb583b42c
BLAKE2b-256 597754f1e0a457f5d37ced516ebd7b1c4e130308bdcf79a68e91184164d7f630

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