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

Built Distribution

File details

Details for the file llama_index_readers_airbyte_stripe-0.3.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_readers_airbyte_stripe-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b5e0d0e638debffaec245226de163a42e01304b80635ded93e1c097a74df276a
MD5 4dbabc7aa063d1ac7497ae0b43c2d8bd
BLAKE2b-256 2bd65e584d1d0c1b27de41c0093e1b71c801d0f607ca340368bd426f90f540e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_readers_airbyte_stripe-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4917346f078a1d1ff7829a6a53cdb92694484a6d512619c050473abfce57cfb
MD5 a0943c4a0e8fdac6104c7301e02f97a7
BLAKE2b-256 8c4286451c2af50adff3f49d9c12dfcaa19a3702c1e3cfe5050f39ef77e7c826

See more details on using hashes here.

Supported by

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