Giter Club home page Giter Club logo

tap-ms-graph's Introduction

tap-ms-graph

tap-ms-graph is a Singer tap for MSGraph.

Built with the Meltano Tap SDK for Singer Taps and the Microsoft Graph API reference.

Install from GitHub:

pipx install git+https://github.com/Slalom-Consulting/tap-ms-graph.git@main

Configuration

Accepted Config Options

Setting Required Default Description
tenant True None The directory tenant that you want to request permission from. The value can be in GUID or a friendly name format.
client_id True None The application ID that the Azure app registration portal assigned when you registered your app.
client_secret True None The client secret that you generated for your app in the app registration portal.
stream_config False None Custom configuration for streams.
include_odata_type False False Include '@odata_type' field when returned from API.
api_version False v1.0 The version of the Microsoft Graph API to use
auth_url False None Override the Azure AD authentication base URL. Required if using a national cloud.
api_url False None Override the Graph API service base URL. Required if using a national cloud.

A full list of supported settings and capabilities for this tap is available by running:

tap-ms-graph --about

Custom Stream Configuration

Many streams support advanced query capabilities (eg. $count, $select, $filter, $search, $orderby, ...) and can be added to the tap configuration stream parameters:

{
    "stream_config": {
        "name_of_stream": {
            "parameters": "url_query_string"
        }
    }
}

Configure using environment variables

This Singer tap will automatically import any environment variables within the working directory's .env if the --config=ENV is provided, such that config values will be considered if a matching environment variable is set either in the terminal context or in the .env file.

Usage

You can easily run tap-ms-graph by itself or in a pipeline using Meltano.

Executing the Tap Directly

tap-ms-graph --version
tap-ms-graph --help
tap-ms-graph --config CONFIG --discover > ./catalog.json

Developer Resources

Follow these instructions to contribute to this project.

Initialize your Development Environment

pipx install poetry
poetry install

Create and Run Tests

Create tests within the tap_ms_graph/tests subfolder and then run:

poetry run pytest

You can also test the tap-ms-graph CLI interface directly using poetry run:

poetry run tap-ms-graph --help

Testing with Meltano

Note: This tap will work in any Singer environment and does not require Meltano. Examples here are for convenience and to streamline end-to-end orchestration scenarios.

Next, install Meltano (if you haven't already) and any needed plugins:

# Install meltano
pipx install meltano
# Initialize meltano within this directory
cd tap-ms-graph
meltano install

Now you can test and orchestrate using Meltano:

# Test invocation:
meltano invoke tap-ms-graph --version
# OR run a test `elt` pipeline:
meltano elt tap-ms-graph target-jsonl

SDK Dev Guide

See the dev guide for more instructions on how to use the SDK to develop your own taps and targets.

tap-ms-graph's People

Contributors

robby-rob-slalom avatar

Stargazers

 avatar

tap-ms-graph's Issues

users schema are missing nullable strings

Most fields in Active Directory that are strings are nullable

"displayName": {
  "type": "string"
},

so when you get a record like above, the validation of json failes....

{"type": "RECORD", "stream": "users", "record": {"givenName": null, ...}

reco the following for almost all strings in schema

"displayName": {
  "type": ["null","string"]
},

Use and Access Site Lists

Hi,

This tap looks like it can be very handy to obtain a SharePoint List, however I'm not quite sure how I could do this.

I can't access this URL at my workplace:
https://graph.microsoft.com/v1.0/groups

But I can access this to get the content of the SharePoint List.

https://graph.microsoft.com/v1.0/sites/{SiteID}/Lists/{ListID}/items/?expand=fields

This call will return the contents of the List which I will need to paginate through the items in it.

Having a look at the code I have a feeling that I need to add the following code to access sites.

streams.py

class SitesStream(MSGraphStream):
    name = "sites"
    path = "/sites"
    primary_keys = ["id"]
    odata_context = "sites"

tap.py

from tap_ms_graph.streams import (
    GroupMembersStream,
    GroupsStream,
    SubscribedSkusStream,
    SitesStream,
    UsersStream,
)

STREAM_TYPES = [
    GroupsStream,
    GroupMembersStream,
    SubscribedSkusStream,
    SitesStream,
    UsersStream,
]

However when I run the following Meltano command meltano select tap-ms-graph --list, I can't see any Sites available to select. I would like to add some enhancements to access SharePoint Lists but not sure if I am heading in the right direction or not.

Any advice would be much appreciated as I need to ingest several SharePoint Lists.
Thanks

Managed Identity/native auth

Hi,

This tap looks very promising, and we are looking to deploy it in our system.
However we were wondering if it would be possible to set up authentication with Managed Identity or using native Auth.
As we avoid the use of service principals where possible.

We think it should only require a relative minor change to this method:
https://github.com/Slalom-Consulting/tap-ms-graph/blob/main/tap_ms_graph/auth.py

We are happy to provide a PR with this change, but would like to discuss the design principles regarding how configuration would look with multiple auth options.

Some of our thoughts are:
add use DefaultAzureCredentials = true as an option
add managed Identity ID as an option

We might also need to think about precedence in the case that multiple authentication methods are configured. As well as configuration validation.

Tagging colleague: @hholgersen

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.