Skip to content

Quick start

This example uses illustrative records in the example namespace. Run it in a new, empty working directory, separate from any deployment. It does not use live data.

Install

Use Python 3.11 or 3.12 and an isolated virtual environment:

python -m venv .venv
. .venv/bin/activate
python -m pip install shareddata

On Windows activate with .venv\Scripts\Activate.ps1. Native locking requirements and rewrite limitations are described in the Windows guide. On Linux, the native locking helper needs a C compiler and matching Python development headers when it compiles for an interpreter without a cached helper.

Isolate storage

Set these values before importing SharedData. These relative folders are examples, not locations from a running installation:

export DATABASE_FOLDER=./example-data
export DATABASE_FOLDERS=./example-data
export SHAREDDATA_S3_ENABLED=false
export LOG_API=false
export LOG_FILE=false

The example only uses local files. Cloud credentials, API tokens and other service connections are unnecessary. Do not run it from a directory containing a deployment configuration. SharedData reads configuration from the environment and dotenv files; see Configuration.

Write and read records

Save as example.py and run python example.py:

from SharedData.SharedData import SharedData
import pandas as pd

store = SharedData(__file__, user="example")
index = pd.MultiIndex.from_tuples(
    [(pd.Timestamp("2026-01-02"), "EXAMPLE")],
    names=["date", "symbol"],
)
rows = pd.DataFrame({"close": [100.0]}, index=index)
records = store.table(
    "MarketData", "D1", "DEMO", "PRICES",
    value=rows,
)
print(records.loc["2026-01-02", "EXAMPLE"])

table() returns a SharedNumpy record array. Indexed writes use upsert(); loc reads records. Local processes see committed writes through their shared mapping. Durable publication is a separate operation; read the table guide.

Next steps