Python SDK (pymycorr)

pymycorr is the official Python client for Mycorr. It fetches a table, at its latest version or any earlier one, straight into a pandas or polars DataFrame, using Apache Arrow so large tables arrive quickly.

Installation

pip install pymycorr

Requires Python 3.10 or later.

Authentication

pymycorr authenticates using a personal access token. You can provide it in three ways:

  1. Environment variable — set MYCORR_API_TOKEN in your shell:
export MYCORR_API_TOKEN="your-api-token"
  1. .env file — create a .env file in your project directory:
MYCORR_API_TOKEN=your-api-token
  1. Constructor parameter — pass the token directly:
from pymycorr import MyCorr

client = MyCorr(token="your-api-token")

To generate a token, see Personal access tokens.

Never commit a token to version control. Keep it in an environment variable, or in a .env file listed in your .gitignore.

Quick start

from pymycorr import MyCorr

# Initialize the client (reads MYCORR_API_TOKEN from env)
client = MyCorr()

# Fetch a table as a pandas DataFrame
df = client.get_table("your-table-id")
print(df.head())

# Fetch a specific version
df_v2 = client.get_table("your-table-id", version=2)

# Fetch as a polars DataFrame instead
df_polars = client.get_table("your-table-id", engine="polars")

# Get table metadata without downloading data
info = client.get_table_info("your-table-id")
print(info["schema"])

API reference

MyCorr(url=None, token=None, env_file=None, progress="auto")

Creates a new client instance.

ParameterDescription
urlAPI endpoint. Defaults to the Mycorr production URL.
tokenAPI token. If not provided, reads from MYCORR_API_TOKEN env variable.
env_filePath to a .env file. Defaults to .env in the current directory.
progressProgress display: "auto", True, or False.

get_table(table_id, version=None, engine="pandas", progress=None)

Fetches table data as a DataFrame.

ParameterDescription
table_idThe table identifier (found in the table URL).
versionVersion number (int) or alias ("latest", "stable"). Defaults to the latest version.
engine"pandas" (default) or "polars".
progressOverride the client-level progress setting for this request.

get_table_info(table_id, version=None)

Returns table metadata and schema as a dictionary, without downloading the full dataset.

ParameterDescription
table_idThe table identifier.
versionVersion number or alias. Defaults to the latest version.

Errors

pymycorr raises specific exceptions for different error scenarios:

ExceptionDescription
TableNotFoundErrorThe requested table does not exist or you don't have access.
QuotaExceededErrorYour egress quota has been exceeded.
TableConversionErrorFailed to convert the data to a DataFrame.
StreamingErrorError during data streaming.
TableAPIErrorBase exception for all API errors.
from pymycorr import MyCorr
from pymycorr.exceptions import TableNotFoundError

client = MyCorr()

try:
    df = client.get_table("your-table-id")
except TableNotFoundError:
    print("Table not found — check the table ID and your permissions.")