Skip to content

Latest commit

 

History

History
70 lines (53 loc) · 1.86 KB

File metadata and controls

70 lines (53 loc) · 1.86 KB

GitLab Handler

This is the implementation of the GitLab handler for MindsDB. This interface support to connect to GitLab API and pull data into MindsDB

GitLab Handler Implementation

This handler was implemented using the python-gitlab library. python-gitlab is a Python library that wraps GitLab API.

GitLab Handler Initialization

The GitLab handler is initialized with the following parameters:

  • repository: a required name of a GitLab repository to connect to
  • api_key: an optional GitLab API key to use for authentication

Implemented Features

[x] GitLab Issues Table for a given Repository

  • Support SELECT
    • Support LIMIT
    • Support WHERE
    • Support ORDER BY
    • Support column selection
  • GitLab Merge Requests Table for a given Repository
    • Support SELECT
      • Support LIMIT
      • Support WHERE
      • Support ORDER BY
      • Support column selection

Usage

In order to make use of this handler and connect to a gitlab api in MindsDB, the following syntax can be used,

CREATE DATABASE mindsdb_gitlab
WITH ENGINE = 'gitlab',
PARAMETERS = {
  "repository": "gitlab-org/gitlab",
  "api_key": "api_key",    -- optional GitLab API key
};

Now, you can use this established connection to query your table as follows,

SELECT * FROM mindsdb_gitlab.issues;
SELECT number, state, creator, assignee, title, created, labels 
  FROM mindsdb_gitlab.issues
  WHERE state="opened"
  ORDER BY created ASC, creator DESC
  LIMIT 10;
SELECT number, state, creator, reviewers, title, created, has_conflicts
  FROM mindsdb_gitlab.merge_requests
  WHERE state="merged"
  ORDER BY created ASC, creator DESC
  LIMIT 10;

What is next??

Add support for:

  • GitLab Branches, Releases, Branches tables for a given Repository