Accessing split information

Can someone please share a code snippet for how to access split data for a particular sid? I am using the sharadar zipline bundle. I cannot find a way to easily access the split data.

Splits are stored in the bundle but aren't part of the public API. However, you can pull them out of the bundle like this:

import pandas as pd
from quantrocket.db import connect_sqlite

BUNDLE = "sharadar-1d"
ADJUSTMENTS_DB_PATH = f"/var/lib/quantrocket/zipline/data/{BUNDLE}/2020-01-01T00;00;00/adjustments.sqlite"
ASSETS_DB_PATH = f"/var/lib/quantrocket/zipline/data/{BUNDLE}/2020-01-01T00;00;00/assets-8.sqlite"

def get_all_splits():
    """
    Returns a DataFrame of all splits from the Zipline bundle.
    """

    adjustments_conn = connect_sqlite(ADJUSTMENTS_DB_PATH)
    assets_conn = connect_sqlite(ASSETS_DB_PATH)

    splits = pd.io.sql.read_sql("""
        SELECT
            ratio as Ratio,
            effective_date as Date,
            sid AS ZiplineSid
        FROM splits
        ORDER BY effective_date
        """, adjustments_conn)

    splits["Date"] = pd.to_datetime(splits.Date, unit="s")

    real_sids = pd.io.sql.read_sql("""
        SELECT
            sid AS ZiplineSid,
            real_sid AS Sid
        FROM equities
        """, assets_conn, index_col="ZiplineSid").Sid

    splits = splits.join(real_sids, on="ZiplineSid").drop("ZiplineSid", axis=1)
    return splits