Beispiel #1
0
    def __init__(self, ctx: PipelineContext, config: SupersetConfig):
        super().__init__(ctx)
        self.config = config
        self.report = SourceReport()

        login_response = requests.post(
            f"{self.config.connect_uri}/api/v1/security/login",
            None,
            {
                "username": self.config.username,
                "password": self.config.password,
                "refresh": True,
                "provider": self.config.provider,
            },
        )

        self.access_token = login_response.json()["access_token"]

        self.session = requests.Session()
        self.session.headers.update({
            "Authorization": f"Bearer {self.access_token}",
            "Content-Type": "application/json",
            "Accept": "*/*",
        })

        # Test the connection
        test_response = self.session.get(
            f"{self.config.connect_uri}/api/v1/database")
        if test_response.status_code == 200:
            pass
Beispiel #2
0
 def __init__(self, config: OpenApiConfig, ctx: PipelineContext,
              platform: str):
     super().__init__(ctx)
     self.config = config
     self.platform = platform
     self.report = SourceReport()
     self.url_basepath = ""
Beispiel #3
0
    def __init__(self, ctx: PipelineContext, config: ModeConfig):
        super().__init__(ctx)
        self.config = config
        self.report = SourceReport()

        self.session = requests.session()
        self.session.auth = HTTPBasicAuth(self.config.token,
                                          self.config.password)
        self.session.headers.update({
            "Content-Type": "application/json",
            "Accept": "application/hal+json",
        })

        # Test the connection
        try:
            self._get_request_json(f"{self.config.connect_uri}/api/account")
        except HTTPError as http_error:
            self.report.report_failure(
                key="mode-session",
                reason=f"Unable to retrieve user "
                f"{self.config.token} information, "
                f"{str(http_error)}",
            )

        self.workspace_uri = f"{self.config.connect_uri}/api/{self.config.workspace}"
        self.space_tokens = self._get_space_name_and_tokens()
Beispiel #4
0
    def __init__(self, ctx: PipelineContext, config: TableauConfig):
        super().__init__(ctx)

        self.config = config
        self.report = SourceReport()
        # This list keeps track of datasource being actively used by workbooks so that we only retrieve those
        # when emitting published data sources.
        self.datasource_ids_being_used: List[str] = []
        # This list keeps track of datasource being actively used by workbooks so that we only retrieve those
        # when emitting custom SQL data sources.
        self.custom_sql_ids_being_used: List[str] = []

        self._authenticate()
Beispiel #5
0
    def __init__(self, ctx: PipelineContext, config: LDAPSourceConfig):
        super().__init__(ctx)
        self.config = config
        self.report = SourceReport()

        ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_ALLOW)
        ldap.set_option(ldap.OPT_REFERRALS, 0)

        self.ldap_client = ldap.initialize(self.config.ldap_server)
        self.ldap_client.protocol_version = 3

        try:
            self.ldap_client.simple_bind_s(
                self.config.ldap_user, self.config.ldap_password
            )
        except ldap.LDAPError as e:
            raise ConfigurationError("LDAP connection failed") from e

        self.lc = create_controls(self.config.page_size)
Beispiel #6
0
    def __init__(self, ctx: PipelineContext, config: MetabaseConfig):
        super().__init__(ctx)
        self.config = config
        self.report = SourceReport()

        login_response = requests.post(
            f"{self.config.connect_uri}/api/session",
            None,
            {
                "username": self.config.username,
                "password": self.config.password,
            },
        )

        login_response.raise_for_status()
        self.access_token = login_response.json().get("id", "")

        self.session = requests.session()
        self.session.headers.update(
            {
                "X-Metabase-Session": f"{self.access_token}",
                "Content-Type": "application/json",
                "Accept": "*/*",
            }
        )

        # Test the connection
        try:
            test_response = self.session.get(
                f"{self.config.connect_uri}/api/user/current"
            )
            test_response.raise_for_status()
        except HTTPError as e:
            self.report.report_failure(
                key="metabase-session",
                reason=f"Unable to retrieve user {self.config.username} information. %s"
                % str(e),
            )
Beispiel #7
0
 def __init__(self, config: DBTConfig, ctx: PipelineContext, platform: str):
     super().__init__(ctx)
     self.config = config
     self.platform = platform
     self.report = SourceReport()
Beispiel #8
0
    def __init__(self, config: FeastRepositorySourceConfig, ctx: PipelineContext):
        super().__init__(ctx)

        self.source_config = config
        self.report = SourceReport()
        self.feature_store = FeatureStore(self.source_config.path)
Beispiel #9
0
 def __init__(self):
     self.source_report = SourceReport()
     self.work_units: List[MetadataWorkUnit] = [
         MetadataWorkUnit(id="workunit-1", mce=get_initial_mce())
     ]
Beispiel #10
0
 def __init__(self, config: SnowflakeUsageConfig, ctx: PipelineContext):
     super(SnowflakeUsageSource, self).__init__(config, ctx)
     self.config: SnowflakeUsageConfig = config
     self.report: SourceReport = SourceReport()
 def __init__(self, config: SnowflakeUsageConfig, ctx: PipelineContext):
     super(SnowflakeUsageSource, self).__init__(config, ctx)
     self.config: SnowflakeUsageConfig = config
     self.report: SourceReport = SourceReport()
     self.should_skip_this_run = self._should_skip_this_run()
Beispiel #12
0
 def __init__(self, ctx: PipelineContext):
     self.source_report = SourceReport()