Fix #6818 - Superset code cleanup and docs (#6821)

* code cleaning

* superset docs

* Fix metabase docs
This commit is contained in:
Pere Miquel Brull 2022-08-19 11:19:06 +02:00 committed by GitHub
parent 78b5f8c8e2
commit 6f3cd4cfed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 19 additions and 13 deletions

View File

@ -41,7 +41,7 @@
},
"provider": {
"title": "Provider",
"description": "Authentication provider for the Superset service.",
"description": "Authentication provider for the Superset service. For basic user/password authentication, the default value `db` can be used. This parameter is used internally to connect to Superset's REST API.",
"type": "string",
"default": "db"
},

View File

@ -13,6 +13,9 @@ REST Auth & Client for Apache Superset
"""
import json
from metadata.generated.schema.entity.services.connections.dashboard.supersetConnection import (
SupersetConnection,
)
from metadata.generated.schema.metadataIngestion.workflow import (
Source as WorkflowSource,
)
@ -28,7 +31,7 @@ class SupersetAuthenticationProvider(AuthenticationProvider):
Handle SuperSet Auth
"""
def __init__(self, config: WorkflowSource):
def __init__(self, config: SupersetConnection):
self.config = config
self.service_connection = self.config
client_config = ClientConfig(
@ -44,10 +47,10 @@ class SupersetAuthenticationProvider(AuthenticationProvider):
super().__init__()
@classmethod
def create(cls, config: WorkflowSource):
def create(cls, config: SupersetConnection):
return cls(config)
def auth_token(self) -> str:
def auth_token(self) -> None:
login_request = self._login_request()
login_response = self.client.post("/security/login", login_request)
self.generated_auth_token = login_response["access_token"]
@ -64,7 +67,7 @@ class SupersetAuthenticationProvider(AuthenticationProvider):
def get_access_token(self):
self.auth_token()
return (self.generated_auth_token, self.expiry)
return self.generated_auth_token, self.expiry
class SupersetAPIClient:
@ -75,7 +78,7 @@ class SupersetAPIClient:
client: REST
_auth_provider: AuthenticationProvider
def __init__(self, config: WorkflowSource):
def __init__(self, config: SupersetConnection):
self.config = config
self._auth_provider = SupersetAuthenticationProvider.create(config)
client_config = ClientConfig(
@ -89,7 +92,7 @@ class SupersetAPIClient:
def fetch_total_dashboards(self) -> int:
"""
Fetch total dahsboard
Fetch total dashboard
Returns:
int

View File

@ -20,6 +20,5 @@ We have tested Metabase with version -- 0.42.4 and version -- 0.43.4
- **hostPort**: URL to the Metabase instance.
- **username**: Specify the User to connect to Metabase. It should have enough privileges to read all the metadata.
- **password**: Password for Metabase.
- **dbServiceName**: Optionally, add the name of the database service to add lineage.
<MetadataIngestionConfig service="dashboard" connector="Metabase" goal="Airflow" />

View File

@ -20,6 +20,5 @@ We have tested Metabase with version -- 0.42.4 and version -- 0.43.4
- **hostPort**: URL to the Metabase instance.
- **username**: Specify the User to connect to Metabase. It should have enough privileges to read all the metadata.
- **password**: Password for Metabase.
- **dbServiceName**: Optionally, add the name of the database service to add lineage.
<MetadataIngestionConfig service="dashboard" connector="Metabase" goal="CLI" />

View File

@ -14,7 +14,6 @@ slug: /openmetadata/connectors/dashboard/metabase
- **Host and Port**: URL to the Metabase instance.
- **Username**: Specify the User to connect to Metabase. It should have enough privileges to read all the metadata.
- **Password**: Password for Metabase.
- **Database Service Name**: Optionally, add the name of the database service to add lineage.
<IngestionScheduleAndDeploy />

View File

@ -7,6 +7,8 @@ slug: /openmetadata/connectors/dashboard/superset/airflow
<Requirements />
The ingestion also works with Superset 2.0.0 🎉
<PythonMod connector="Superset" module="superset" />
<MetadataIngestionServiceDev service="dashboard" connector="Superset" goal="Airflow"/>
@ -16,6 +18,6 @@ slug: /openmetadata/connectors/dashboard/superset/airflow
- **hostPort**: URL to the Superset instance.
- **username**: Specify the User to connect to Superset. It should have enough privileges to read all the metadata.
- **password**: Password for Superset.
- **dbServiceName**: Optionally, add the name of the database service to add lineage.
- **provider**: Authentication provider for the Superset service. For basic user/password authentication, the default value `db` can be used. This parameter is used internally to connect to Superset's REST API.
<MetadataIngestionConfig service="dashboard" connector="Superset" goal="Airflow" />

View File

@ -7,6 +7,8 @@ slug: /openmetadata/connectors/dashboard/superset/cli
<Requirements />
The ingestion also works with Superset 2.0.0 🎉
<PythonMod connector="Superset" module="superset" />
<MetadataIngestionServiceDev service="dashboard" connector="Superset" goal="CLI"/>
@ -16,6 +18,6 @@ slug: /openmetadata/connectors/dashboard/superset/cli
- **hostPort**: URL to the Superset instance.
- **username**: Specify the User to connect to Superset. It should have enough privileges to read all the metadata.
- **password**: Password for Superset.
- **dbServiceName**: Optionally, add the name of the database service to add lineage.
- **provider**: Authentication provider for the Superset service. For basic user/password authentication, the default value `db` can be used. This parameter is used internally to connect to Superset's REST API.
<MetadataIngestionConfig service="dashboard" connector="Superset" goal="CLI" />

View File

@ -7,6 +7,8 @@ slug: /openmetadata/connectors/dashboard/superset
<Requirements />
The ingestion also works with Superset 2.0.0 🎉
<MetadataIngestionService connector="Superset"/>
<h4>Connection Options</h4>
@ -14,7 +16,7 @@ slug: /openmetadata/connectors/dashboard/superset
- **Host and Port**: URL to the Superset instance.
- **Username**: Specify the User to connect to Superset. It should have enough privileges to read all the metadata.
- **Password**: Password for Superset.
- **Database Service Name**: Optionally, add the name of the database service to add lineage.
- **Provider**: Authentication provider for the Superset service. For basic user/password authentication, the default value `db` can be used. This parameter is used internally to connect to Superset's REST API.
<IngestionScheduleAndDeploy />