View all connectors

Tabnine

This guide explains how to upload Tabnine usage metrics into DX using a CSV file. Once an API is made available by Tabnine, this process will be automated through a DX data connector.

Prerequisites

Setup instructions

Follow the steps below to import Tabnine data into DX.

Step 1– Create custom table

To import Tabnine usage metrics into DX, you’ll first need to create a custom table in your DX database.

  • Use a Postgres client (Postico or pgAdmin) to connect to your DX database.
  • Then, execute the SQL statement below:
CREATE TABLE custom.tabnine_daily_usages (
    id SERIAL PRIMARY KEY,
    date DATE NOT NULL,
    email VARCHAR(255),
    user_identifier UUID,
    user_name VARCHAR(255),
    current_team VARCHAR(255),
    user_role VARCHAR(255),
    languages TEXT,
    ides TEXT,
    number_of_devices INTEGER,
    num_of_keystrokes INTEGER,
    number_of_completions INTEGER,
    num_of_characters_added INTEGER,
    num_of_lines_completed INTEGER,
    chat_interactions INTEGER,
    chat_consumption INTEGER,
    copy_code_consumption INTEGER,
    chat_consumed_characters INTEGER,
    chat_consumed_lines INTEGER,
    copy_clicks INTEGER,
    insert_clicks INTEGER,
    click_thumbs INTEGER,
    copied_text INTEGER,
    click_navs INTEGER
);

Step 2- Prepare Tabnine data

Download a raw export of your Tabnine usage metrics, then update the CSV file to match this template so that the column headers match the schema of the database table created in Step 1.

Step 3- Import Tabnine data

Use the Import CSV feature in Postico or pgAdmin to upload your data to DX.

  1. Right-click the custom.tabnine_daily_usages table and click Import CSV
  2. Select the formatted CSV from Step 3
  3. Ensure “First row is header” is checked
  4. Click Import

Step 5- View reports

Once your data is uploaded, use DX’s prebuilt reports or use Data Studio to create custom reports. The example query below joins Tabnine data and DX data, displaying Tabnine daily usage alongside PR throughput.

SELECT
  du.name,
  du.email,
  COUNT(DISTINCT pr.id) AS number_of_prs_merged,
  COUNT(DISTINCT CASE WHEN tdu.date IS NOT NULL THEN tdu.date END) AS tabnine_days_active
FROM custom.tabnine_daily_usages tdu
INNER JOIN dx_users du
  ON du.email = tdu.email
INNER JOIN pull_requests pr
  ON pr.dx_user_id = du.id
WHERE pr.merged >= CURRENT_DATE - INTERVAL '30 days'
  AND tdu.date >= CURRENT_DATE - INTERVAL '30 days'
GROUP BY du.name, du.email;