Git Product home page Git Product logo

devopsdb's Introduction

DevOpsDb

Query your organiation's Dev and Operations data sources as though they were a single SQL database.

Note: This is a very early prototype. The code that exists is working and unit tested, but it is still a work in progress.

Why?

Trying to pull data from around the organisation using APIs or UIs is frustrating.

Wouldn't it be nice to write a simple SQL join instead?

DevOpsDb allows you to write SQL queries against your organisations Dev and Ops services.

For example:

-- All builds over 10 minutes, with the Pull Request that triggered them
select 
  b.startedBy, 
  b.startedDate, 
  pr.title 
from devops.builds b
  inner join devops.pullRequests pr on p.branch = b.branch
where 
  b.buildTimeMinutes > 10 and 
  (b.status = 'in-progress' or b.status = 'completed')
limit 50

It will take the query, figure out the necessary API requests, and return the data in a nice SQL-like table format.

The aim is to support 'connectors' for Azure Devops, GitHub, Git and Azure.. maybe more

What state is this project in?

There is no config file and the command line interface is still a dumb prompt, so although it works it's can't really be used in anger yet.

That said, it is possible to write complex SELECT statements against a single 'table', but no joins yet. ('complex' means you can select specific columns or 'select * from..', write WHERE clauses using =, != or like (with nested and/or conditions), and use the limit keyword to trim the result set)

Coming soon:

  • A config file to add config for connectors
  • A fully functional 'Azure DevOps' connector (this will be the first of many)
  • A more usable command line interface
  • Ability to use 'joins'

Overview of the code/interesting bits

The code that takes the SQL Abstract Syntax Tree (AST) and converts it into a query model that the APIs can use is here: https://github.com/DSaunders/DevOpsDb/blob/main/inputs/sql.go

For examples of what the output from parsing a SQL query looks like, see these tests: https://github.com/DSaunders/DevOpsDb/blob/main/inputs/sql_select_with_where_multiple_clauses_test.go

The WHERE logic in a query is implmented as a tree of conditions that are resolved recursively. See: https://github.com/DSaunders/DevOpsDb/blob/main/models/queryfilter.go

After we have that query model, we pass it to 'connectors' to execute the API calls. Here's the Azure DevOps one (this is still a spike, but it illustrates how it works): https://github.com/DSaunders/DevOpsDb/blob/main/connectors/devops.go

devopsdb's People

Contributors

dsaunders avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.