diff --git a/dbt-metricflow/dbt_metricflow/cli/sample_dbt_models/semantic_manifest.json b/dbt-metricflow/dbt_metricflow/cli/sample_dbt_models/semantic_manifest.json index 28032c8865..cd8e597a9c 100644 --- a/dbt-metricflow/dbt_metricflow/cli/sample_dbt_models/semantic_manifest.json +++ b/dbt-metricflow/dbt_metricflow/cli/sample_dbt_models/semantic_manifest.json @@ -1 +1,521 @@ -{"semantic_models": [{"name": "customers", "defaults": {"agg_time_dimension": "ds"}, "description": "Location and description of all customers.", "node_relation": {"alias": "customers", "schema_name": "dbt_test", "database": "metricflow", "relation_name": "\"metricflow\".\"dbt_test\".\"customers\""}, "entities": [{"name": "customer", "description": null, "type": "primary", "role": null, "expr": "id_customer", "metadata": null}, {"name": "country", "description": null, "type": "foreign", "role": null, "expr": null, "metadata": null}], "measures": [{"name": "new_customers", "agg": "sum", "description": null, "create_metric": false, "expr": "1", "agg_params": null, "metadata": null, "non_additive_dimension": null, "agg_time_dimension": null}], "dimensions": [{"name": "ds", "description": null, "type": "time", "is_partition": false, "type_params": {"time_granularity": "day", "validity_params": null}, "expr": null, "metadata": null}, {"name": "customer_country", "description": null, "type": "categorical", "is_partition": false, "type_params": null, "expr": "country", "metadata": null}], "metadata": null}, {"name": "countries", "defaults": null, "description": "Regions mapped to countries.", "node_relation": {"alias": "countries", "schema_name": "dbt_test", "database": "metricflow", "relation_name": "\"metricflow\".\"dbt_test\".\"countries\""}, "entities": [{"name": "country", "description": null, "type": "primary", "role": null, "expr": null, "metadata": null}], "measures": [], "dimensions": [{"name": "region", "description": "The region associated with the country.", "type": "categorical", "is_partition": false, "type_params": null, "expr": null, "metadata": null}], "metadata": null}, {"name": "transactions", "defaults": {"agg_time_dimension": "ds"}, "description": "Each row represents one transaction. There\nwill be a new row for any cancellations or alterations.\nThere is a transaction, order, and customer id for\nevery transaction. There is only one transaction id per\ntransaction, but there can be many rows per order id and\ncustomer id. The `ds` or date is reflected in UTC.\n", "node_relation": {"alias": "transactions", "schema_name": "dbt_test", "database": "metricflow", "relation_name": "\"metricflow\".\"dbt_test\".\"transactions\""}, "entities": [{"name": "transaction", "description": null, "type": "primary", "role": null, "expr": "id_transaction", "metadata": null}, {"name": "customer", "description": null, "type": "foreign", "role": null, "expr": "id_customer", "metadata": null}, {"name": "id_order", "description": null, "type": "foreign", "role": null, "expr": null, "metadata": null}], "measures": [{"name": "transaction_amount_usd", "agg": "sum", "description": "The total USD value of the transaction.", "create_metric": false, "expr": null, "agg_params": null, "metadata": null, "non_additive_dimension": null, "agg_time_dimension": null}, {"name": "transactions", "agg": "sum", "description": "The total number of transactions.", "create_metric": false, "expr": "1", "agg_params": null, "metadata": null, "non_additive_dimension": null, "agg_time_dimension": null}, {"name": "quick_buy_amount_usd", "agg": "sum", "description": "The total USD value of the transactions that were purchased using the \"quick buy\" button.", "create_metric": false, "expr": "CASE WHEN transaction_type_name = 'quick-buy' THEN transaction_amount_usd ELSE 0 END", "agg_params": null, "metadata": null, "non_additive_dimension": null, "agg_time_dimension": null}, {"name": "quick_buy_transactions", "agg": "sum_boolean", "description": "The total transactions bought as quick buy.", "create_metric": false, "expr": "CASE WHEN transaction_type_name = 'quick-buy' THEN TRUE ELSE FALSE END", "agg_params": null, "metadata": null, "non_additive_dimension": null, "agg_time_dimension": null}, {"name": "cancellations_usd", "agg": "sum", "description": "The total USD value of the transactions that were cancelled.", "create_metric": false, "expr": "CASE WHEN transaction_type_name = 'cancellation' THEN transaction_amount_usd ELSE 0 END", "agg_params": null, "metadata": null, "non_additive_dimension": null, "agg_time_dimension": null}, {"name": "alterations_usd", "agg": "sum", "description": "The total USD value of the transactions that were altered.", "create_metric": false, "expr": "CASE WHEN transaction_type_name = 'alteration' THEN transaction_amount_usd ELSE 0 END", "agg_params": null, "metadata": null, "non_additive_dimension": null, "agg_time_dimension": null}, {"name": "transacting_customers", "agg": "count_distinct", "description": "The distinct count of customers transacting on any given day.", "create_metric": false, "expr": "id_customer", "agg_params": null, "metadata": null, "non_additive_dimension": null, "agg_time_dimension": null}], "dimensions": [{"name": "ds", "description": null, "type": "time", "is_partition": false, "type_params": {"time_granularity": "day", "validity_params": null}, "expr": null, "metadata": null}, {"name": "is_large", "description": null, "type": "categorical", "is_partition": false, "type_params": null, "expr": "CASE WHEN transaction_amount_usd >= 30 THEN TRUE ELSE FALSE END", "metadata": null}, {"name": "quick_buy_transaction", "description": null, "type": "categorical", "is_partition": false, "type_params": null, "expr": "CASE\n WHEN transaction_type_name = 'quick-buy' THEN 'Quick Buy'\n ELSE 'Not Quick Buy'\nEND", "metadata": null}], "metadata": null}], "metrics": [{"name": "new_customers", "description": "", "type": "simple", "type_params": {"measure": {"name": "new_customers", "filter": null, "alias": null}, "numerator": null, "denominator": null, "expr": null, "window": null, "grain_to_date": null, "metrics": [], "input_measures": []}, "filter": null, "metadata": null}, {"name": "quick_buy_transactions", "description": "", "type": "simple", "type_params": {"measure": {"name": "quick_buy_transactions", "filter": null, "alias": null}, "numerator": null, "denominator": null, "expr": null, "window": null, "grain_to_date": null, "metrics": [], "input_measures": []}, "filter": null, "metadata": null}, {"name": "quick_buy_amount_usd", "description": "", "type": "simple", "type_params": {"measure": {"name": "quick_buy_amount_usd", "filter": null, "alias": null}, "numerator": null, "denominator": null, "expr": null, "window": null, "grain_to_date": null, "metrics": [], "input_measures": []}, "filter": null, "metadata": null}, {"name": "cancellations", "description": "", "type": "simple", "type_params": {"measure": {"name": "cancellations_usd", "filter": null, "alias": null}, "numerator": null, "denominator": null, "expr": null, "window": null, "grain_to_date": null, "metrics": [], "input_measures": []}, "filter": null, "metadata": null}, {"name": "transactions", "description": "", "type": "simple", "type_params": {"measure": {"name": "transactions", "filter": null, "alias": null}, "numerator": null, "denominator": null, "expr": null, "window": null, "grain_to_date": null, "metrics": [], "input_measures": []}, "filter": null, "metadata": null}, {"name": "alterations", "description": "", "type": "simple", "type_params": {"measure": {"name": "alterations_usd", "filter": null, "alias": null}, "numerator": null, "denominator": null, "expr": null, "window": null, "grain_to_date": null, "metrics": [], "input_measures": []}, "filter": null, "metadata": null}, {"name": "transaction_amount", "description": "", "type": "simple", "type_params": {"measure": {"name": "transaction_amount_usd", "filter": null, "alias": null}, "numerator": null, "denominator": null, "expr": null, "window": null, "grain_to_date": null, "metrics": [], "input_measures": []}, "filter": null, "metadata": null}, {"name": "cancellation_rate", "description": "", "type": "ratio", "type_params": {"measure": null, "numerator": {"name": "cancellations", "filter": null, "alias": null, "offset_window": null, "offset_to_grain": null}, "denominator": {"name": "transaction_amount", "filter": null, "alias": null, "offset_window": null, "offset_to_grain": null}, "expr": null, "window": null, "grain_to_date": null, "metrics": [], "input_measures": []}, "filter": null, "metadata": null}, {"name": "revenue_usd", "description": "", "type": "derived", "type_params": {"measure": null, "numerator": null, "denominator": null, "expr": "transaction_amount - cancellations + alterations", "window": null, "grain_to_date": null, "metrics": [{"name": "transaction_amount", "filter": null, "alias": null, "offset_window": null, "offset_to_grain": null}, {"name": "cancellations", "filter": null, "alias": null, "offset_window": null, "offset_to_grain": null}, {"name": "alterations", "filter": null, "alias": null, "offset_window": null, "offset_to_grain": null}], "input_measures": []}, "filter": null, "metadata": null}, {"name": "cancellations_mx", "description": "", "type": "simple", "type_params": {"measure": {"name": "cancellations_usd", "filter": null, "alias": null}, "numerator": null, "denominator": null, "expr": null, "window": null, "grain_to_date": null, "metrics": [], "input_measures": []}, "filter": {"where_sql_template": "{{ dimension('customer_country', entity_path=['customer']) }} = 'MX'\n"}, "metadata": null}, {"name": "transaction_usd_na", "description": "", "type": "simple", "type_params": {"measure": {"name": "transaction_amount_usd", "filter": null, "alias": null}, "numerator": null, "denominator": null, "expr": null, "window": null, "grain_to_date": null, "metrics": [], "input_measures": []}, "filter": {"where_sql_template": "{{ dimension('region', entity_path=['customer', 'country']) }} = 'NA'\n"}, "metadata": null}], "interfaces_version": "0.1.0.dev7"} +{ + "semantic_models": [ + { + "name": "customers", + "defaults": { + "agg_time_dimension": "ds" + }, + "description": "Location and description of all customers.", + "node_relation": { + "alias": "customers", + "schema_name": "dbt_test", + "database": "metricflow", + "relation_name": "\"metricflow\".\"dbt_test\".\"customers\"" + }, + "entities": [ + { + "name": "customer", + "description": null, + "type": "primary", + "role": null, + "expr": "id_customer", + "metadata": null + }, + { + "name": "country", + "description": null, + "type": "foreign", + "role": null, + "expr": null, + "metadata": null + } + ], + "measures": [ + { + "name": "new_customers", + "agg": "sum", + "description": null, + "create_metric": false, + "expr": "1", + "agg_params": null, + "metadata": null, + "non_additive_dimension": null, + "agg_time_dimension": null + } + ], + "dimensions": [ + { + "name": "ds", + "description": null, + "type": "time", + "is_partition": false, + "type_params": { + "time_granularity": "day", + "validity_params": null + }, + "expr": null, + "metadata": null + }, + { + "name": "customer_country", + "description": null, + "type": "categorical", + "is_partition": false, + "type_params": null, + "expr": "country", + "metadata": null + } + ], + "metadata": null + }, + { + "name": "countries", + "defaults": null, + "description": "Regions mapped to countries.", + "node_relation": { + "alias": "countries", + "schema_name": "dbt_test", + "database": "metricflow", + "relation_name": "\"metricflow\".\"dbt_test\".\"countries\"" + }, + "entities": [ + { + "name": "country", + "description": null, + "type": "primary", + "role": null, + "expr": null, + "metadata": null + } + ], + "measures": [], + "dimensions": [ + { + "name": "region", + "description": "The region associated with the country.", + "type": "categorical", + "is_partition": false, + "type_params": null, + "expr": null, + "metadata": null + } + ], + "metadata": null + }, + { + "name": "transactions", + "defaults": { + "agg_time_dimension": "ds" + }, + "description": "Each row represents one transaction. There\nwill be a new row for any cancellations or alterations.\nThere is a transaction, order, and customer id for\nevery transaction. There is only one transaction id per\ntransaction, but there can be many rows per order id and\ncustomer id. The `ds` or date is reflected in UTC.\n", + "node_relation": { + "alias": "transactions", + "schema_name": "dbt_test", + "database": "metricflow", + "relation_name": "\"metricflow\".\"dbt_test\".\"transactions\"" + }, + "entities": [ + { + "name": "transaction", + "description": null, + "type": "primary", + "role": null, + "expr": "id_transaction", + "metadata": null + }, + { + "name": "customer", + "description": null, + "type": "foreign", + "role": null, + "expr": "id_customer", + "metadata": null + }, + { + "name": "id_order", + "description": null, + "type": "foreign", + "role": null, + "expr": null, + "metadata": null + } + ], + "measures": [ + { + "name": "transaction_amount_usd", + "agg": "sum", + "description": "The total USD value of the transaction.", + "create_metric": false, + "expr": null, + "agg_params": null, + "metadata": null, + "non_additive_dimension": null, + "agg_time_dimension": null + }, + { + "name": "transactions", + "agg": "sum", + "description": "The total number of transactions.", + "create_metric": false, + "expr": "1", + "agg_params": null, + "metadata": null, + "non_additive_dimension": null, + "agg_time_dimension": null + }, + { + "name": "quick_buy_amount_usd", + "agg": "sum", + "description": "The total USD value of the transactions that were purchased using the \"quick buy\" button.", + "create_metric": false, + "expr": "CASE WHEN transaction_type_name = 'quick-buy' THEN transaction_amount_usd ELSE 0 END", + "agg_params": null, + "metadata": null, + "non_additive_dimension": null, + "agg_time_dimension": null + }, + { + "name": "quick_buy_transactions", + "agg": "sum_boolean", + "description": "The total transactions bought as quick buy.", + "create_metric": false, + "expr": "CASE WHEN transaction_type_name = 'quick-buy' THEN TRUE ELSE FALSE END", + "agg_params": null, + "metadata": null, + "non_additive_dimension": null, + "agg_time_dimension": null + }, + { + "name": "cancellations_usd", + "agg": "sum", + "description": "The total USD value of the transactions that were cancelled.", + "create_metric": false, + "expr": "CASE WHEN transaction_type_name = 'cancellation' THEN transaction_amount_usd ELSE 0 END", + "agg_params": null, + "metadata": null, + "non_additive_dimension": null, + "agg_time_dimension": null + }, + { + "name": "alterations_usd", + "agg": "sum", + "description": "The total USD value of the transactions that were altered.", + "create_metric": false, + "expr": "CASE WHEN transaction_type_name = 'alteration' THEN transaction_amount_usd ELSE 0 END", + "agg_params": null, + "metadata": null, + "non_additive_dimension": null, + "agg_time_dimension": null + }, + { + "name": "transacting_customers", + "agg": "count_distinct", + "description": "The distinct count of customers transacting on any given day.", + "create_metric": false, + "expr": "id_customer", + "agg_params": null, + "metadata": null, + "non_additive_dimension": null, + "agg_time_dimension": null + } + ], + "dimensions": [ + { + "name": "ds", + "description": null, + "type": "time", + "is_partition": false, + "type_params": { + "time_granularity": "day", + "validity_params": null + }, + "expr": null, + "metadata": null + }, + { + "name": "is_large", + "description": null, + "type": "categorical", + "is_partition": false, + "type_params": null, + "expr": "CASE WHEN transaction_amount_usd >= 30 THEN TRUE ELSE FALSE END", + "metadata": null + }, + { + "name": "quick_buy_transaction", + "description": null, + "type": "categorical", + "is_partition": false, + "type_params": null, + "expr": "CASE\n WHEN transaction_type_name = 'quick-buy' THEN 'Quick Buy'\n ELSE 'Not Quick Buy'\nEND", + "metadata": null + } + ], + "metadata": null + } + ], + "metrics": [ + { + "name": "new_customers", + "description": "", + "type": "simple", + "type_params": { + "measure": { + "name": "new_customers", + "filter": null, + "alias": null + }, + "numerator": null, + "denominator": null, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": [], + "input_measures": [] + }, + "filter": null, + "metadata": null + }, + { + "name": "quick_buy_transactions", + "description": "", + "type": "simple", + "type_params": { + "measure": { + "name": "quick_buy_transactions", + "filter": null, + "alias": null + }, + "numerator": null, + "denominator": null, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": [], + "input_measures": [] + }, + "filter": null, + "metadata": null + }, + { + "name": "quick_buy_amount_usd", + "description": "", + "type": "simple", + "type_params": { + "measure": { + "name": "quick_buy_amount_usd", + "filter": null, + "alias": null + }, + "numerator": null, + "denominator": null, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": [], + "input_measures": [] + }, + "filter": null, + "metadata": null + }, + { + "name": "cancellations", + "description": "", + "type": "simple", + "type_params": { + "measure": { + "name": "cancellations_usd", + "filter": null, + "alias": null + }, + "numerator": null, + "denominator": null, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": [], + "input_measures": [] + }, + "filter": null, + "metadata": null + }, + { + "name": "transactions", + "description": "", + "type": "simple", + "type_params": { + "measure": { + "name": "transactions", + "filter": null, + "alias": null + }, + "numerator": null, + "denominator": null, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": [], + "input_measures": [] + }, + "filter": null, + "metadata": null + }, + { + "name": "alterations", + "description": "", + "type": "simple", + "type_params": { + "measure": { + "name": "alterations_usd", + "filter": null, + "alias": null + }, + "numerator": null, + "denominator": null, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": [], + "input_measures": [] + }, + "filter": null, + "metadata": null + }, + { + "name": "transaction_amount", + "description": "", + "type": "simple", + "type_params": { + "measure": { + "name": "transaction_amount_usd", + "filter": null, + "alias": null + }, + "numerator": null, + "denominator": null, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": [], + "input_measures": [] + }, + "filter": null, + "metadata": null + }, + { + "name": "cancellation_rate", + "description": "", + "type": "ratio", + "type_params": { + "measure": null, + "numerator": { + "name": "cancellations", + "filter": null, + "alias": null, + "offset_window": null, + "offset_to_grain": null + }, + "denominator": { + "name": "transaction_amount", + "filter": null, + "alias": null, + "offset_window": null, + "offset_to_grain": null + }, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": [], + "input_measures": [] + }, + "filter": null, + "metadata": null + }, + { + "name": "revenue_usd", + "description": "", + "type": "derived", + "type_params": { + "measure": null, + "numerator": null, + "denominator": null, + "expr": "transaction_amount - cancellations + alterations", + "window": null, + "grain_to_date": null, + "metrics": [ + { + "name": "transaction_amount", + "filter": null, + "alias": null, + "offset_window": null, + "offset_to_grain": null + }, + { + "name": "cancellations", + "filter": null, + "alias": null, + "offset_window": null, + "offset_to_grain": null + }, + { + "name": "alterations", + "filter": null, + "alias": null, + "offset_window": null, + "offset_to_grain": null + } + ], + "input_measures": [] + }, + "filter": null, + "metadata": null + }, + { + "name": "cancellations_mx", + "description": "", + "type": "simple", + "type_params": { + "measure": { + "name": "cancellations_usd", + "filter": null, + "alias": null + }, + "numerator": null, + "denominator": null, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": [], + "input_measures": [] + }, + "filter": { + "where_sql_template": "{{ dimension('customer_country', entity_path=['customer']) }} = 'MX'\n" + }, + "metadata": null + }, + { + "name": "transaction_usd_na", + "description": "", + "type": "simple", + "type_params": { + "measure": { + "name": "transaction_amount_usd", + "filter": null, + "alias": null + }, + "numerator": null, + "denominator": null, + "expr": null, + "window": null, + "grain_to_date": null, + "metrics": [], + "input_measures": [] + }, + "filter": { + "where_sql_template": "{{ dimension('region', entity_path=['customer', 'country']) }} = 'NA'\n" + }, + "metadata": null + } + ], + "interfaces_version": "0.1.0.dev7" +}