Skip to content

Commit

Permalink
feat(tableau): emit workbook as container entity in tableau source, s…
Browse files Browse the repository at this point in the history
…ome minor fixes in tableau source (#4261)
  • Loading branch information
mayurinehate authored Mar 4, 2022
1 parent 9f1c5a8 commit 92b0e1c
Show file tree
Hide file tree
Showing 21 changed files with 133,472 additions and 130,753 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ private void mapDatasetProperties(@Nonnull Dataset dataset, @Nonnull DataMap dat
properties.setExternalUrl(gmsProperties.getExternalUrl().toString());
}
properties.setCustomProperties(StringMapMapper.map(gmsProperties.getCustomProperties()));
properties.setName(dataset.getName()); // TODO: Move to using a display name produced by ingestion soures
if (gmsProperties.getName() != null) {
properties.setName(gmsProperties.getName());
} else {
properties.setName(dataset.getName());
}
properties.setQualifiedName(gmsProperties.getQualifiedName());
dataset.setProperties(properties);
dataset.setDescription(properties.getDescription());
if (gmsProperties.getUri() != null) {
Expand Down
10 changes: 8 additions & 2 deletions datahub-graphql-core/src/main/resources/entity.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,8 @@ type Dataset implements EntityWithRelationships & Entity {
container: Container

"""
The Dataset display name
Unique guid for dataset
No longer to be used as the Dataset display name. Use properties.name instead
"""
name: String!

Expand Down Expand Up @@ -796,7 +797,12 @@ type DatasetProperties {
"""
The name of the dataset used in display
"""
name: String
name: String!

"""
Fully-qualified name of the Dataset
"""
qualifiedName: String

"""
Environment in which the dataset belongs to or where it was generated
Expand Down
31 changes: 31 additions & 0 deletions datahub-web-react/src/Mocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ const dataset1 = {
tags: ['Private', 'PII'],
uri: 'www.google.com',
properties: {
name: 'The Great Test Dataset',
description: 'This is the greatest dataset in the world, youre gonna love it!',
customProperties: [
{
Expand Down Expand Up @@ -224,6 +225,7 @@ const dataset2 = {
tags: ['Outdated'],
uri: 'www.google.com',
properties: {
name: 'Some Other Dataset',
description: 'This is some other dataset, so who cares!',
customProperties: [],
},
Expand Down Expand Up @@ -298,6 +300,7 @@ export const dataset3 = {
origin: 'PROD',
uri: 'www.google.com',
properties: {
name: 'Yet Another Dataset',
description: 'This and here we have yet another Dataset (YAN). Are there more?',
origin: 'PROD',
customProperties: [{ key: 'propertyAKey', value: 'propertyAValue' }],
Expand Down Expand Up @@ -479,24 +482,52 @@ export const dataset4 = {
...dataset3,
name: 'Fourth Test Dataset',
urn: 'urn:li:dataset:4',
properties: {
name: 'Fourth Test Dataset',
description: 'This and here we have yet another Dataset (YAN). Are there more?',
origin: 'PROD',
customProperties: [{ key: 'propertyAKey', value: 'propertyAValue' }],
externalUrl: 'https://data.hub',
},
};

export const dataset5 = {
...dataset3,
name: 'Fifth Test Dataset',
urn: 'urn:li:dataset:5',
properties: {
name: 'Fifth Test Dataset',
description: 'This and here we have yet another Dataset (YAN). Are there more?',
origin: 'PROD',
customProperties: [{ key: 'propertyAKey', value: 'propertyAValue' }],
externalUrl: 'https://data.hub',
},
};

export const dataset6 = {
...dataset3,
name: 'Sixth Test Dataset',
urn: 'urn:li:dataset:6',
properties: {
name: 'Sixth Test Dataset',
description: 'This and here we have yet another Dataset (YAN). Are there more?',
origin: 'PROD',
customProperties: [{ key: 'propertyAKey', value: 'propertyAValue' }],
externalUrl: 'https://data.hub',
},
};

export const dataset7 = {
...dataset3,
name: 'Seventh Test Dataset',
urn: 'urn:li:dataset:7',
properties: {
name: 'Seventh Test Dataset',
description: 'This and here we have yet another Dataset (YAN). Are there more?',
origin: 'PROD',
customProperties: [{ key: 'propertyAKey', value: 'propertyAValue' }],
externalUrl: 'https://data.hub',
},
};

export const dataset3WithLineage = {
Expand Down
9 changes: 5 additions & 4 deletions datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ export class DatasetEntity implements Entity<Dataset> {
// if dataset has subTypes filled out, pick the most specific subtype and return it
const subTypes = dataset?.subTypes;
return {
name: dataset?.properties?.name || dataset?.name,
externalUrl: dataset?.properties?.externalUrl,
entityTypeOverride: subTypes ? capitalizeFirstLetter(subTypes.typeNames?.[0]) : '',
};
Expand All @@ -199,7 +200,7 @@ export class DatasetEntity implements Entity<Dataset> {
return (
<Preview
urn={data.urn}
name={data.name}
name={data.properties?.name || data.name}
origin={data.origin}
subtype={data.subTypes?.typeNames?.[0]}
description={data.editableProperties?.description || data.properties?.description}
Expand All @@ -219,7 +220,7 @@ export class DatasetEntity implements Entity<Dataset> {
return (
<Preview
urn={data.urn}
name={data.name}
name={data.properties?.name || data.name}
origin={data.origin}
description={data.editableProperties?.description || data.properties?.description}
platformName={data.platform.properties?.displayName || data.platform.name}
Expand Down Expand Up @@ -248,7 +249,7 @@ export class DatasetEntity implements Entity<Dataset> {
getLineageVizConfig = (entity: Dataset) => {
return {
urn: entity?.urn,
name: entity?.name,
name: entity.properties?.name || entity.name,
type: EntityType.Dataset,
subtype: entity.subTypes?.typeNames?.[0] || undefined,
downstreamChildren: getChildrenFromRelationships({
Expand All @@ -271,7 +272,7 @@ export class DatasetEntity implements Entity<Dataset> {
};

displayName = (data: Dataset) => {
return data?.name;
return data?.properties?.name || data.name;
};

platformLogoUrl = (data: Dataset) => {
Expand Down
1 change: 1 addition & 0 deletions datahub-web-react/src/graphql/browse.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ query getBrowseResults($input: BrowseInput!) {
name
origin
properties {
name
description
}
editableProperties {
Expand Down
1 change: 1 addition & 0 deletions datahub-web-react/src/graphql/fragments.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ fragment nonRecursiveDatasetFields on Dataset {
}
platformNativeType
properties {
name
description
customProperties {
key
Expand Down
1 change: 1 addition & 0 deletions datahub-web-react/src/graphql/preview.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ fragment entityPreview on Entity {
}
platformNativeType
properties {
name
description
customProperties {
key
Expand Down
1 change: 1 addition & 0 deletions datahub-web-react/src/graphql/relationships.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ fragment relationshipFields on Entity {
... on Dataset {
name
properties {
name
description
}
editableProperties {
Expand Down
1 change: 1 addition & 0 deletions datahub-web-react/src/graphql/search.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ fragment searchResults on SearchResults {
}
platformNativeType
properties {
name
description
customProperties {
key
Expand Down
58 changes: 38 additions & 20 deletions metadata-ingestion/source_docs/tableau.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Tableau

For context on getting started with ingestion, check out our [metadata ingestion guide](../README.md).

Note that this connector is currently considered in `BETA`, and has not been validated for production use.
Expand All @@ -19,22 +18,25 @@ on Tableau online.
Tableau's GraphQL interface is used to extract metadata information. Queries used to extract metadata are located
in `metadata-ingestion/src/datahub/ingestion/source/tableau_common.py`

- [Workbook](#Workbook)
- [Dashboard](#Dashboard)
- [Sheet](#Sheet)
- [Embedded Data source](#Embedded-Data-Source)
- [Published Data source](#Published-Data-Source)
- [Custom SQL Data source](#Custom-SQL-Data-Source)

### Dashboard
Dashboards from Tableau are ingested as Dashboard in datahub. <br/>

### Workbook
Workbooks from Tableau are ingested as Container in datahub. <br/>
- GraphQL query <br/>
```
```graphql
{
workbooksConnection(first: 15, offset: 0, filter: {projectNameWithin: ["default", "Project 2"]}) {
nodes {
id
name
luid
uri
projectName
owner {
username
Expand All @@ -43,6 +45,24 @@ Dashboards from Tableau are ingested as Dashboard in datahub. <br/>
uri
createdAt
updatedAt
}
pageInfo {
hasNextPage
endCursor
}
totalCount
}
}
```

### Dashboard
Dashboards from Tableau are ingested as Dashboard in datahub. <br/>
- GraphQL query <br/>
```graphql
{
workbooksConnection(first: 15, offset: 0, filter: {projectNameWithin: ["default", "Project 2"]}) {
nodes {
.....
dashboards {
id
name
Expand All @@ -68,7 +88,7 @@ Dashboards from Tableau are ingested as Dashboard in datahub. <br/>
### Sheet
Sheets from Tableau are ingested as charts in datahub. <br/>
- GraphQL query <br/>
```
```graphql
{
workbooksConnection(first: 10, offset: 0, filter: {projectNameWithin: ["default"]}) {
.....
Expand Down Expand Up @@ -150,7 +170,7 @@ Sheets from Tableau are ingested as charts in datahub. <br/>
Embedded Data source from Tableau is ingested as a Dataset in datahub.

- GraphQL query <br/>
```
```graphql
{
workbooksConnection(first: 15, offset: 0, filter: {projectNameWithin: ["default"]}) {
nodes {
Expand Down Expand Up @@ -229,7 +249,7 @@ Embedded Data source from Tableau is ingested as a Dataset in datahub.
Published Data source from Tableau is ingested as a Dataset in datahub.

- GraphQL query <br/>
```
```graphql
{
publishedDatasourcesConnection(filter: {idWithin: ["00cce29f-b561-bb41-3557-8e19660bb5dd", "618c87db-5959-338b-bcc7-6f5f4cc0b6c6"]}) {
nodes {
Expand Down Expand Up @@ -307,7 +327,7 @@ Published Data source from Tableau is ingested as a Dataset in datahub.
### Custom SQL Data Source
For custom sql data sources, the query is viewable in UI under View Definition tab. <br/>
- GraphQL query <br/>
```
```graphql
{
customSQLTablesConnection(filter: {idWithin: ["22b0b4c3-6b85-713d-a161-5a87fdd78f40"]}) {
nodes {
Expand Down Expand Up @@ -377,9 +397,7 @@ source:
# Credentials
username: [email protected]
password: pass
token_name: Acryl
token_value: token_generated_from_tableau


# Options
ingest_tags: True
ingest_owner: True
Expand All @@ -396,31 +414,31 @@ sink:
| Field | Required | Default | Description |
|-----------------------|----------|-----------|--------------------------------------------------------------------------|
| `connect_uri` || | Tableau host URL. |
| `site` | | | Tableau Online Site |
| `site` | | `""` | Tableau Site. Always required for Tableau Online. Use emptystring "" to connect with Default site on Tableau Server. |
| `env` | | `"PROD"` | Environment to use in namespace when constructing URNs. |
| `username` | | | Tableau user name. |
| `password` | | | Tableau password for authentication. |
| `token_name` | | | Tableau token name if authenticating using a personal token. |
| `token_value` | | | Tableau token value if authenticating using a personal token. |
| `username` | | | Tableau username, must be set if authenticating using username/password. |
| `password` | | | Tableau password, must be set if authenticating using username/password. |
| `token_name` | | | Tableau token name, must be set if authenticating using a personal access token. |
| `token_value` | | | Tableau token value, must be set if authenticating using a personal access token. |
| `projects` | | `default` | List of projects |
| `workbooks_page_size` | | 10 | Number of workbooks to query at a time using Tableau api. |
| `default_schema_map`* | | | Default schema to use when schema is not found. |
| `ingest_tags` | | `False` | Ingest Tags from source. This will override Tags entered from UI |
| `ingest_owners` | | `False` | Ingest Owner from source. This will override Owner info entered from UI |


*Tableau may not provide schema name when ingesting Custom SQL data source. Use `default_schema_map` to provide a default
schema name to use when constructing a table URN.


### Authentication

Currently, authentication is supported on Tableau Online using username and password
Currently, authentication is supported on Tableau using username and password
and personal token. For more information on Tableau authentication, refer to [How to Authenticate](https://help.tableau.com/current/api/metadata_api/en-us/docs/meta_api_auth.html) guide.


## Compatibility

Tableau Server Version: 2021.4.0 (20214.22.0114.0959) 64-bit Linux <br/>
Tableau Pod: prod-ca-a
Tableau Server Version: 2021.4.0 (20214.22.0114.0959) 64-bit Linux


## Questions
Expand Down
Loading

0 comments on commit 92b0e1c

Please sign in to comment.