> Markdown versions of all pages of this connector library are available by appending `.md` to the page URL. For the full index of connectors, see [llms.txt](https://connectors.appmixer.com/llms.txt).

# appmixer.posthog.core.RunQuery

- Component: `appmixer.posthog.core.RunQuery`
- Kind: Action
- Version: 1.0.0
- Visibility: Public
- Connector: [appmixer.posthog 1.1.0](https://connectors.appmixer.com/connector/appmixer.posthog/1.1.0.md)
- Component page: <https://connectors.appmixer.com/connector/appmixer.posthog/1.1.0/component/appmixer.posthog.core.RunQuery>

Run a HogQL (SQL-like) query against a PostHog project's analytics data and return the result rows.

## Input ports

### Port `in`

| Field | Type | Description |
| --- | --- | --- |
| Project (`projectId`) | text | Pick a project, or type the numeric Project ID directly. |
| HogQL Query (`query`) | textarea | HogQL query to run, e.g. SELECT event, count() FROM events GROUP BY event ORDER BY count() DESC LIMIT 10. |

## Output ports

### Port `out`

| Field | Type | Description |
| --- | --- | --- |
| Result Rows (`results`) | array | - |
| Columns (`columns`) | array | - |
| Row Count (`count`) | integer | - |

## Full metadata (component.json)

```json
{
  "name": "appmixer.posthog.core.RunQuery",
  "description": "Run a HogQL (SQL-like) query against a PostHog project's analytics data and return the result rows.",
  "author": "Appmixer <info@appmixer.com>",
  "version": "1.0.0",
  "auth": {
    "service": "appmixer:posthog"
  },
  "quota": {
    "manager": "appmixer:posthog",
    "resources": "query",
    "scope": {
      "userId": "{{userId}}"
    }
  },
  "inPorts": [
    {
      "name": "in",
      "schema": {
        "type": "object",
        "properties": {
          "projectId": {
            "type": "string"
          },
          "query": {
            "type": "string"
          }
        },
        "required": [
          "projectId",
          "query"
        ]
      },
      "inspector": {
        "inputs": {
          "projectId": {
            "type": "text",
            "index": 1,
            "label": "Project",
            "tooltip": "Pick a project, or type the numeric Project ID directly.",
            "source": {
              "url": "/component/appmixer/posthog/core/ListProjects?outPort=out",
              "data": {
                "properties": {
                  "isSource": true
                },
                "transform": "./ListProjects#toSelectArray"
              }
            }
          },
          "query": {
            "type": "textarea",
            "index": 2,
            "label": "HogQL Query",
            "tooltip": "HogQL query to run, e.g. SELECT event, count() FROM events GROUP BY event ORDER BY count() DESC LIMIT 10."
          }
        }
      }
    }
  ],
  "outPorts": [
    {
      "name": "out",
      "schema": {
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "title": "Result Rows",
            "items": {
              "type": "array"
            },
            "example": [
              [
                "$pageview",
                1234
              ],
              [
                "order_created",
                56
              ]
            ]
          },
          "columns": {
            "type": "array",
            "title": "Columns",
            "items": {
              "type": "string"
            },
            "example": [
              "event",
              "count()"
            ]
          },
          "count": {
            "type": "integer",
            "title": "Row Count",
            "example": 2
          }
        }
      }
    }
  ],
  "icon": "(data URI omitted)"
}
```
