{
  "db_name": "PostgreSQL",
  "query": "\n        SELECT\n            ha.user_id,\n            u.email as \"user_email?\",\n            COUNT(*) as request_count,\n            COALESCE(SUM(ha.prompt_tokens), 0)::bigint as total_input_tokens,\n            COALESCE(SUM(ha.completion_tokens), 0)::bigint as total_output_tokens,\n            COALESCE(SUM(ha.total_tokens), 0)::bigint as total_tokens,\n            SUM(ha.total_cost)::float8 as total_cost,\n            MAX(ha.timestamp) as last_active_at\n        FROM http_analytics ha\n        LEFT JOIN users u ON u.id = ha.user_id\n        WHERE ha.model = $1\n            AND ha.timestamp >= $2\n            AND ha.timestamp <= $3\n            AND ha.user_id IS NOT NULL\n        GROUP BY ha.user_id, u.email\n        ORDER BY request_count DESC\n        ",
  "describe": {
    "columns": [
      {
        "ordinal": 0,
        "name": "user_id",
        "type_info": "Uuid"
      },
      {
        "ordinal": 1,
        "name": "user_email?",
        "type_info": "Varchar"
      },
      {
        "ordinal": 2,
        "name": "request_count",
        "type_info": "Int8"
      },
      {
        "ordinal": 3,
        "name": "total_input_tokens",
        "type_info": "Int8"
      },
      {
        "ordinal": 4,
        "name": "total_output_tokens",
        "type_info": "Int8"
      },
      {
        "ordinal": 5,
        "name": "total_tokens",
        "type_info": "Int8"
      },
      {
        "ordinal": 6,
        "name": "total_cost",
        "type_info": "Float8"
      },
      {
        "ordinal": 7,
        "name": "last_active_at",
        "type_info": "Timestamptz"
      }
    ],
    "parameters": {
      "Left": [
        "Text",
        "Timestamptz",
        "Timestamptz"
      ]
    },
    "nullable": [
      true,
      false,
      null,
      null,
      null,
      null,
      null,
      null
    ]
  },
  "hash": "4ebb37e890dcdce25fdabc718f3c8904d073084319d9497676977d9192a97427"
}
