Listing Metrics

One of the most imporant entities in DataJunction are metrics. Exploring DataJunction usually starts with exploring available metrics.

curl -X GET http://localhost:8000/metrics/
from datajunction import DJClient
dj = DJClient(DJ_URL)
metrics = dj.metrics()

You can also narrow the list of metrics to a specific namespace. Here’s an example of only listing metrics in a default namespace.

curl -X GET http://localhost:8000/namespaces/default/?type_=metric
namespace = dj.namespace("default")
print(namespace.metrics())

Metric Details

After selecting a metric, you can retrieve details for the given metric. Here’s an example of retrieving details for a metric named default.num_repair_orders.

curl -X GET http://localhost:8000/metrics/default.num_repair_orders/
from datajunction import DJClient
dj = DJClient("http://localhost:8000")
metric = dj.metric("default.num_repair_orders")

Metric details include the available dimensions that are discoverable through the DataJunction DAG. See the pages on Requesting Data and Requesting SQL to learn how combinations of metrics and dimensions can be used.