-
Notifications
You must be signed in to change notification settings - Fork 17.4k
Get Airflow configs with sensitive data from Secret Backends #9645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
46010c5
6b1b4c3
e0f1b25
67bc20d
c071725
3b38109
032d33f
35d75e5
d8d5b8f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -16,9 +16,10 @@ | |||||
| # under the License. | ||||||
|
|
||||||
| from abc import ABC | ||||||
| from typing import List, Optional | ||||||
| from typing import TYPE_CHECKING, List, Optional | ||||||
|
|
||||||
| from airflow.models.connection import Connection | ||||||
| if TYPE_CHECKING: | ||||||
| from airflow.models.connection import Connection | ||||||
|
|
||||||
|
|
||||||
| class BaseSecretsBackend(ABC): | ||||||
|
|
@@ -52,13 +53,14 @@ def get_conn_uri(self, conn_id: str) -> Optional[str]: | |||||
| """ | ||||||
| raise NotImplementedError() | ||||||
|
|
||||||
| def get_connections(self, conn_id: str) -> List[Connection]: | ||||||
| def get_connections(self, conn_id: str) -> List['Connection']: | ||||||
| """ | ||||||
| Return connection object with a given ``conn_id``. | ||||||
|
|
||||||
| :param conn_id: connection id | ||||||
| :type conn_id: str | ||||||
| """ | ||||||
| from airflow.models.connection import Connection | ||||||
| conn_uri = self.get_conn_uri(conn_id=conn_id) | ||||||
| if not conn_uri: | ||||||
| return [] | ||||||
|
|
@@ -73,3 +75,12 @@ def get_variable(self, key: str) -> Optional[str]: | |||||
| :return: Variable Value | ||||||
| """ | ||||||
| raise NotImplementedError() | ||||||
|
|
||||||
| def get_config(self, key: str) -> Optional[str]: # pylint: disable=unused-argument | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, except it comes from a single value in the config file. Hmmmm. Perhaps update the example to show include a [core]
sql_alchemy_conn_secret = core/sql_alchemy_connDunno.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added docs in 032d33f |
||||||
| """ | ||||||
| Return value for Airflow Config Key | ||||||
|
|
||||||
| :param key: Config Key | ||||||
| :return: Config Value | ||||||
| """ | ||||||
| return None | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why this is a function in the module, and not a method on the AirflowConfiguration class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to keep it similar to
def run_command(command):, no other reason