Mapping dashboard id between GraphQL and PostgreSQL in Tableau Server - postgresql

In order to develop my application, I am trying to get dashboard data using GraphQL from Tableau Server.
My sample GraphQL is like below,
{
dashboard {
id
luid
name
}
}
From GraphQL, I get a result like below.
{
“data”: {
“dashboards”: [
{
“id”: “0001a27e-6429-c8b7-0d29-644b2ca00e76”,
“luid”: “8291u72j-9281-c9d8-0r83-098i2jx82i00”,
“name”: “TestDashboard”
}
]
}
}
Can I get dashboard id “0001a27e-6429-c8b7-0d29-644b2ca00e76” (not luid) from PostgreSQL in Tableau Server?
If possible, what table in PostgreSQL do I check?
Thank you for your help.

Related

Retrieve ALL Github issues of a specific Project using the GraphQL API

I've been trying to retrieve all GitHub issues of a specific project using their GraphQL API.
The problem that i have is that i need to specify in the items a first or last param it doesn't work. Although by specifying one of these params i get only a partition of the issues.
I thought that i could get the first 100, then use pagination and get the other 100 etc until the response is an empty list. From what i read, i cannot find a parameter in the items that defines a page.
What are your thoughts on this? Is there a workaround?
Thanks a lot for your time.
This query seems to work fine and gives page info under items,
query{
organization(login: "microsoft") {
projectV2(number: 559) {
title
items(first: 100) {
pageInfo {
endCursor
hasNextPage
}
}
}
}
}
Output,
{
"data": {
"organization": {
"projectV2": {
"title": "Azure TRE - Engineering",
"items": {
"pageInfo": {
"endCursor": "Njc",
"hasNextPage": false
}
}
}
}
}
}
Tested the query using,
GitHub Explorer

Pagination on reactionGroups in the GitHub GraphQL API

I’m trying to extract the username of all the users that have reacted to an issue (and how they reacted) with the GitHub GraphQL API. I’ve only been able to extract a maximum of 11 users per reaction group per query, and I haven’t found a way to successfully paginate the queries - the same users are returned each time.
Here’s an example of my query using an issue with many reactions:
{
repository(owner: "mapbox", name: "mapbox-gl-js") {
issue(number: 3184) {
reactionGroups {
content
reactors(first: 30) {
totalCount
pageInfo {
hasNextPage
endCursor
}
edges {
node {
... on User {
login
}
}
}
}
}
}
}
}
For THUMBS_UP reactions this correctly returns totalCount: 77. However, there are only 11 usernames returned (not the 30 requested). The value of hasNextPage in pageInfo is false, and using the returned cursor value or modifying the reactors query to last:30 instead of first:30 has no impact on which 11 users are returned.
Is there a way I can modify my query to get this working (I’m new to GraphQL) or is this a current limitation of the API? Thanks!
(I've also asked this on the GitHub community forums, but no reply yet - see here)

Get GitHub Repository Insights via GitHub GraphQL API (v4)

I want to obtain information about the number of times my projects have been viewed, cloned and where the traffic came from (individually).
I can currently view this Traffic information by clicking on the Insights button of the repository (via the web interface).
Is there a schema in the GitHub v4 GraphQL API to retrieve this information?
The closest I got was the following; nodes didn't contain any sort of statistical data:
{
viewer {
repositories(first: 100) {
totalCount
nodes {
name
description
}
pageInfo {
endCursor
hasNextPage
}
}
}
}
// response
{
"data": {
"viewer": {
"repositories": {
"totalCount": 55,
"nodes": [
{
"name": "Repo Name",
"description": "Repo Description"
},
{
...
}
}
}
}
}
Currently it is not possible to retrieve traffic information using GraphQL API (as explained in here).
Alternately you can use REST API v3 as described in GitHub documentation.
Please notice that reviewing traffic requires tokens with push permissions to the desired repositories.

Github V4 GraphQL API - audit log query

i'm trying to interact with github api v4, i want to query audit log events based on schemas available in the api. I can found a documentary about the github api here and I can see the schemas available here but there are no working examples of how to query the different schemas.
If there is someone here experience with this API, specially with the audit log schemas, I need a working example to start interacting with the audit log schemas...
for example i want to query all organization add member to team events, suppose to be in the schema TeamAddMemberAuditEntry, or remove member from org OrgRemoveMemberAuditEntry
So far I've tried to query it with node.js:
require('isomorphic-fetch');
fetch('https://api.github.com/graphql', {
method: 'POST',
headers: { 'Content-Type': 'application/json',
'Authorization': 'bearer <token>',
'Accept': 'application/vnd.github.audit-log- preview+json'},
body: JSON.stringify({ query: '{ TeamAddMemberAuditEntry }' }),
})
.then(res => res.json())
.then(res => console.log(res.data));
If someone here will look for solution, after viewing the public schema this is how the query looks for getting audit-log objects, this is without the headers and the query prefix of course.
The auditLog is a union type, you can get multiple audit events by adding another "...on" block. for example here i'm getting all the orginvitemembers events
{
organization(login:"<your-org>") {
auditLog(first:2) {
edges {
node {
__typename
... on OrgInviteMemberAuditEntry {
action
actorIp
actorLogin
createdAt
userLogin
actorLocation{
country
city
}
}
}
}
}
}
}
I was after the same thing. I think your query statement is like the issue.
I came across this documentation in the GitHub blog.
https://github.blog/2019-06-21-the-github-enterprise-audit-log-api-for-graphql-beginners/
I was able to adapt the example query and come up with the following...
{
organization(login: "xyz-corp") {
auditLog(last: 10
, query: "action:org.remove_member") {
edges {
node {
... on AuditEntry {
action
actorLogin
userLogin
createdAt
user{
name
email
}
}
}
}
}
}
}
I was able to substitute the query with the following just as I would via the UI to get adds and updates.
action:org.add_member
action:org.update_member
Other audit log query items are described here
https://docs.github.com/en/organizations/keeping-your-organization-secure/reviewing-the-audit-log-for-your-organization

How to get info about specific user using github graphQL?

How can I get info about specific user or specific repo using github GraphQL? I've try this query:
{
search (query: "torvalds", type: USER, first: 1){
edges {
node {
}
}
}
}
but autocomplete for node show only __typename which return string "User".
DEMO
search returns a SearchResultItem, which is an interface. In order to access fields on it, you need to use a fragment on a concrete type like so:
{
search (query: "torvalds", type: USER, first: 1){
edges {
node {
... on User {
login
}
}
}
}
}
I made a short video tour of GitHub's GraphQL API which you might find useful: https://youtu.be/6xO87LlijoQ
EDIT: If you're just looking for a user or org and know the exact name, #stubailo's answer is actually better. You'll still need to use a fragment for most fields, but you'll get just one result of type RepositoryOwner.
The best way to get information about a specific user is to use the repositoryOwner query, like so:
{
repositoryOwner(login: "stubailo") {
login
... on User {
bio
}
}
}
Search is good too, but if you know the name of a user or organization, it's more direct to use the query above.