Skip to main content

StackOverflow

kapa provides an integration to pull answered questions from StackOverflow.

Step 1: Query StackOverflow Data

Navigate to Stack Exchange Data Explorer.

Copy and paste the following SQL query into the input area:

SELECT
q.Id AS [Question Id],
q.Title AS [Question Title],
q.Body AS [Question Body],
q.CreationDate AS [Question Date],
a.Id AS [Answer Id],
a.Body AS [Answer Body],
a.CreationDate AS [Answer Date]
FROM
Posts q
JOIN
Posts a ON q.Id = a.ParentId
WHERE
q.PostTypeId = 1 -- Question
AND
a.PostTypeId = 2 -- Answer
AND
q.Tags LIKE '%<my-tag>%'
ORDER BY
q.CreationDate DESC;
danger

Ensure that the SELECT clause and the conditions q.PostTypeId = 1 and a.PostTypeId = 2 remain unchanged. This ensures proper data structure for our platform.

Modify the q.Tags LIKE '%<my-tag>%' portion to filter by your desired tags. For instance, to filter by next.js, replace my-tag with next.js.

Additional Filters:

Date Range: To filter questions from a specific date range, add the following after the q.Tags condition:

AND q.CreationDate BETWEEN 'YYYY-MM-DD' AND 'YYYY-MM-DD'

Replace YYYY-MM-DD with the desired start and end dates.

Specific User: To filter questions asked by a specific user:

AND q.OwnerUserId = USER_ID

Replace USER_ID with the desired user's ID.

Click "Run Query".

Step 2: Export Data

Once the query completes, click on the "Download CSV" button.

Step 3: Upload to Platform

Navigate to the kapa platform and select File Upload as the source type.

Upload the downloaded CSV.

The platform automatically detects and ingests the StackOverflow export.