Skip to content
Snippets Groups Projects
Commit aec8d50a authored by Christian Boettcher's avatar Christian Boettcher
Browse files

add some debug logging

parent a9b61892
No related branches found
No related tags found
No related merge requests found
Pipeline #86260 failed
...@@ -3,12 +3,15 @@ from urllib.parse import urljoin ...@@ -3,12 +3,15 @@ from urllib.parse import urljoin
from airflow.secrets import BaseSecretsBackend from airflow.secrets import BaseSecretsBackend
from airflow.models.connection import Connection from airflow.models.connection import Connection
import requests import requests
import logging
from datacat_integration.connection import DataCatConnection from datacat_integration.connection import DataCatConnection
from datacat_integration.hooks import DataCatalogHook, get_connection_from_entry from datacat_integration.hooks import get_connection_from_entry
connection_backend_type = "airflow_connections" connection_backend_type = "airflow_connections"
log = logging.getLogger(__name__)
def get_connection_with_secrets_from_entry(data: Dict[str, Any], secrets: Dict[str, str] , datacat_type: str, oid: str) -> Connection: def get_connection_with_secrets_from_entry(data: Dict[str, Any], secrets: Dict[str, str] , datacat_type: str, oid: str) -> Connection:
"""returns an aiflow connection from the data provided in the datacat entry and the secrets.""" """returns an aiflow connection from the data provided in the datacat entry and the secrets."""
...@@ -72,9 +75,8 @@ class DataCatConnectionWithSecrets(DataCatConnection): ...@@ -72,9 +75,8 @@ class DataCatConnectionWithSecrets(DataCatConnection):
class DatacatSecretsBackend(BaseSecretsBackend): class DatacatSecretsBackend(BaseSecretsBackend):
"""A Backend for directly managing connections in apache airflow""" """A Backend for directly managing connections in apache airflow"""
# TODO init with datacat elevated login to prevent secrets acces from jobs
def __init__(self, **kwargs): def __init__(self, **kwargs):
log.debug("Init of Datacat Secrets Backend")
super().__init__(**kwargs) super().__init__(**kwargs)
self.url = kwargs["url"] self.url = kwargs["url"]
self.user = kwargs["user"] self.user = kwargs["user"]
...@@ -83,6 +85,7 @@ class DatacatSecretsBackend(BaseSecretsBackend): ...@@ -83,6 +85,7 @@ class DatacatSecretsBackend(BaseSecretsBackend):
def get_connection(self, conn_id: str): def get_connection(self, conn_id: str):
"""returns a Connection object created from the <conenction_type>/<conn_id> object in the datacatalog""" """returns a Connection object created from the <conenction_type>/<conn_id> object in the datacatalog"""
# only for testing: check that a specific oid has been requested # only for testing: check that a specific oid has been requested
log.debug(f"Get connection: {conn_id}")
if conn_id != "860355e9-975f-4253-9421-1815e20c879b": if conn_id != "860355e9-975f-4253-9421-1815e20c879b":
return None return None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment