PY 01: Discovery, tables and schema

Track: Code (Python client + raw REST) Prerequisite: altfndata_client.py downloaded from docs.altfndata.com, and a class API key from your instructor. This tutorial mirrors the first cells of altfndata_tutorials_student.ipynb, which lives alongside these markdown files in this same folder.

The task

Instantiate the reusable Python client, list the tables available to your key, and pull the schema for one table, so you know what fields exist before writing any real queries.

Starter steps

  1. Import the client and create an instance with your instructor-provided key:
from altfndata_client import AltFndataClient

client = AltFndataClient(api_key="YOUR_CLASS_KEY")
  1. List every table your key can see:
tables = client.list_tables()
print(tables)
  1. Pull the schema for one table, for example all_watches_data:
schema = client.get_schema("all_watches_data")
for field in schema:
    print(field)
  1. Confirm the documented fields you will use across this track are present in the schema output: designer, model, item_title, sale_date, usd_price_decimal, sale_estimates_high_usd_price, status, vendor, stock_ticker.
  2. See the same discovery call as raw REST, so you understand what the client is doing underneath:
import requests

resp = requests.get(
    "https://api.altfndata.com/v1/tables",
    headers={"X-API-Key": "YOUR_CLASS_KEY"},
)
print(resp.json())

Expected result

client.list_tables() returns a list of table name strings, including names like all_watches_data, all_jewels_gems_data, all_handbags_data, and all_fine_art_data, exactly matching what you would see in the sandbox's Coverage panel. client.get_schema(...) returns a structured object (typically a list of dicts) with one entry per column, each carrying a field name and a data type. The raw requests.get call returns the same table list as plain JSON, since the client is a thin wrapper over this REST endpoint.

Stretch challenge

Write a small loop that calls client.get_schema(...) for three different tables and prints only the field names that are common to all three, confirming the documented shared vocabulary (designer, item_title, sale_date, usd_price_decimal, status, vendor, stock_ticker) programmatically instead of by eye.