Skip to content

Support include_metadata Query Parameter  #153

@SteadBytes

Description

@SteadBytes

Issue Summary

Keen provides an include_metadata=true query parameter to return execution metadata for ad-hoc queries (docs) which is not currently supported.

This would be useful to have as an optional kwarg for the ad-hoc query methods on KeenClient.

Example API's

Return a dictionary with result and execution_metadata keys:

>>> keen.count("purchases", timeframe="this_14_days", include_metadata=True)
{
    "result": 100,
    "execution_metadata": {
        "total_processing_time": 0.09057211875915527,
        "events_scanned": 1000,
        "properties_per_event": 4,
        "total_properties_scanned": 4000,
    },
}

Return a (result, execution_metadata) tuple:

>>> keen.count("purchases", timeframe="this_14_days", include_metadata=True)
(
    100,
    {
        "total_processing_time": 0.09057211875915527,
        "events_scanned": 1000,
        "properties_per_event": 4,
        "total_properties_scanned": 4000,
    },
)

Very happy to implement and PR for it after discussion on whether to support the feature and on the desired API 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions