Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

3.0 KB
Raw Blame
{
  "db_name": "PostgreSQL",
  "query": "\n            WITH next_job AS (\n                SELECT *, lease_id as previous_lease_id\n                FROM posthog_batchimport\n                WHERE status = 'running' AND (leased_until IS NULL OR leased_until <= now())\n                ORDER BY created_at\n                LIMIT 1\n                FOR UPDATE SKIP LOCKED\n            )\n            UPDATE posthog_batchimport\n            SET\n                status = 'running',\n                leased_until = now() + interval '30 minutes', -- We lease for a long time because job init can be quite slow\n                lease_id = $1\n            FROM next_job\n            WHERE posthog_batchimport.id = next_job.id\n            RETURNING\n                posthog_batchimport.id,\n                posthog_batchimport.team_id,\n                posthog_batchimport.created_at,\n                posthog_batchimport.updated_at,\n                posthog_batchimport.status_message,\n                posthog_batchimport.display_status_message,\n                posthog_batchimport.state,\n                posthog_batchimport.import_config,\n                posthog_batchimport.secrets as \"secrets?\",\n                posthog_batchimport.backoff_attempt,\n                posthog_batchimport.backoff_until,\n                posthog_batchimport.pending_commit,\n                next_job.previous_lease_id\n            ",
  "describe": {
    "columns": [
      {
        "ordinal": 0,
        "name": "id",
        "type_info": "Uuid"
      },
      {
        "ordinal": 1,
        "name": "team_id",
        "type_info": "Int4"
      },
      {
        "ordinal": 2,
        "name": "created_at",
        "type_info": "Timestamptz"
      },
      {
        "ordinal": 3,
        "name": "updated_at",
        "type_info": "Timestamptz"
      },
      {
        "ordinal": 4,
        "name": "status_message",
        "type_info": "Text"
      },
      {
        "ordinal": 5,
        "name": "display_status_message",
        "type_info": "Text"
      },
      {
        "ordinal": 6,
        "name": "state",
        "type_info": "Jsonb"
      },
      {
        "ordinal": 7,
        "name": "import_config",
        "type_info": "Jsonb"
      },
      {
        "ordinal": 8,
        "name": "secrets?",
        "type_info": "Text"
      },
      {
        "ordinal": 9,
        "name": "backoff_attempt",
        "type_info": "Int4"
      },
      {
        "ordinal": 10,
        "name": "backoff_until",
        "type_info": "Timestamptz"
      },
      {
        "ordinal": 11,
        "name": "pending_commit",
        "type_info": "Jsonb"
      },
      {
        "ordinal": 12,
        "name": "previous_lease_id",
        "type_info": "Text"
      }
    ],
    "parameters": {
      "Left": [
        "Text"
      ]
    },
    "nullable": [
      false,
      false,
      false,
      false,
      true,
      true,
      true,
      false,
      true,
      false,
      true,
      true,
      true
    ]
  },
  "hash": "89f4bfbdd97031b3da1cdf2b255bca4fcd3f0677b54cb0ec07df3c99762842d8"
}