Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(GraphQL API): GQL implementation of Charts + Dashboards #2117

Merged
merged 1 commit into from
Feb 18, 2021

Conversation

jjoyce0510
Copy link
Collaborator

@jjoyce0510 jjoyce0510 commented Feb 18, 2021

Scope
This PR primarily is scoped to the GQL API withindatahub-graphql-core.

However, there are a few changes at GMS layer:

  • updated value PDLs for Chart + Dashboard to add their respective URNs. Other value models do include urns, so I've added for consistency (and to avoid the client having to know how to construct urns).
  • implemented gms "client" classes for Dashboards and Charts.

Changes

  1. Added GraphQL implementation in datahub-graphql-core.
  2. Added Dashboards GMS client
  3. Added Charts GMS client
  4. Added URN field to Dashboard.pdl and Chart.pdl (These models are not available via the frontend and had no client previously so I don't think anyone is actively using them)
  5. Added mock entity dashboard / chart entities to the ingestion example dataset.

Validation
Tested via manual post requests. See examples below.

Dashboards
Query:

query dashboard($urn: String!) {
    dashboard(urn: $urn) {
        urn
        type
        tool
        dashboardId
        tool
        info {
            title
            description
            charts {
                urn
                info {
                    title 
                    description
                }
            }
            url
            access
            lastRefreshed
            created {
                time
            }
            lastModified {
                time
            }
        }
        ownership {
            owners {
                owner {
                    urn
                }
                type
                source {
                    type
                    url
                }
            }
            lastModified {
                time
            }
        }
    }
}

variables:

{
    "urn": "urn:li:dashboard:(Looker,0)"
}

result:

{"data":{"dashboard":{"urn":"urn:li:dashboard:(Looker,0)","type":"DASHBOARD","tool":"Looker","dashboardId":"0","info":{"title":"Sample Looker Dashboard","description":"This dashboard shows charts about user retention.","charts":[{"urn":"urn:li:chart:(Looker,1)","info":{"title":"Sample Looker Chart","description":"This chart contains sample data from Kafka"}}],"url":"https://www.looker.com","access":"PUBLIC","lastRefreshed":null,"created":{"time":1581404189000},"lastModified":{"time":1581407139000}},"ownership":{"owners":[{"owner":{"urn":"urn:li:corpuser:datahub"},"type":"DATAOWNER","source":null},{"owner":{"urn":"urn:li:corpuser:jdoe"},"type":"STAKEHOLDER","source":null}],"lastModified":{"time":1581407389000}}}}}

Charts
Query

query chart($urn: String!) {
    chart(urn: $urn) {
        urn
        type
        tool
        chartId
        info {
            title
            description
            inputs {
                urn
                name
            }
            url
            type
            access
            lastRefreshed
            lastModified {
                time
            }
            created {
                time
            }
        }
        query {
            rawQuery
            type
        }
        ownership {
            owners {
                owner {
                    urn
                }
                type
                source {
                    type
                    url
                }
            }
            lastModified {
                time
            }
        }
    }
}

variables:

{
    "urn": "urn:li:chart:(Looker,1)"
}

result:

{"data":{"chart":{"urn":"urn:li:chart:(Looker,1)","type":"CHART","tool":"Looker","chartId":"1","info":{"title":"Sample Looker Chart","description":"This chart contains sample data from Kafka","inputs":[{"urn":"urn:li:dataset:(urn:li:dataPlatform:kafka,SampleKafkaDataset,PROD)","name":"SampleKafkaDataset"}],"url":"https://www.looker.com","type":null,"access":"PUBLIC","lastRefreshed":null,"lastModified":{"time":1581407189000},"created":{"time":1581407189000}},"query":{"rawQuery":"SELECT * FROM SampleTable","type":"SQL"},"ownership":{"owners":[{"owner":{"urn":"urn:li:corpuser:datahub"},"type":"STAKEHOLDER","source":null},{"owner":{"urn":"urn:li:corpuser:jdoe"},"type":"DATAOWNER","source":null}],"lastModified":{"time":1581407589000}}}}}

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable)

Copy link
Contributor

@shirshanka shirshanka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@shirshanka shirshanka merged commit 12ff330 into datahub-project:master Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants