Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Commit

Permalink
increment version, update CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
PubChimps committed Jan 13, 2023
1 parent eb0f919 commit 2580f2b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
## Upcoming
* (please add here)

## 1.1.4
Added API call to hook to return connector schemas

## [1.1.3](https://github.com/fivetran/airflow-provider-fivetran/releases/tag/v1.1.3) - 2022-12-12
Added ability to test a Fivetran Connection type

Expand Down
21 changes: 19 additions & 2 deletions fivetran_provider/hooks/fivetran.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class FivetranHook(BaseHook):
default_conn_name = "fivetran_default"
conn_type = "fivetran"
hook_name = "Fivetran"
api_user_agent = "airflow_provider_fivetran/1.1.3"
api_user_agent = "airflow_provider_fivetran/1.1.4"
api_protocol = "https"
api_host = "api.fivetran.com"
api_path_connectors = "v1/connectors/"
Expand All @@ -54,6 +54,23 @@ def get_ui_field_behaviour() -> Dict:
},
}

@staticmethod
def _get_airflow_version() -> str:
"""
Fetch and return the current Airflow version
from aws provider
https://github.com/apache/airflow/blob/main/airflow/providers/amazon/aws/hooks/base_aws.py#L486
"""
try:
# This can be a circular import under specific configurations.
# Importing locally to either avoid or catch it if it does happen.
from airflow import __version__ as airflow_version

return "-airflow_version/" + airflow_version
except Exception:
# Under no condition should an error here ever cause an issue for the user.
return ""

def __init__(
self,
fivetran_conn_id: str = "fivetran",
Expand Down Expand Up @@ -89,7 +106,7 @@ def _do_api_call(self, endpoint_info, json=None):
auth = (self.fivetran_conn.login, self.fivetran_conn.password)
url = f"{self.api_protocol}://{self.api_host}/{endpoint}"

headers = {"User-Agent": self.api_user_agent}
headers = {"User-Agent": self.api_user_agent + self._get_airflow_version()}

if method == "GET":
request_func = requests.get
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = airflow-provider-fivetran
version = 1.1.3
version = 1.1.4
description = A Fivetran provider for Apache Airflow
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down

0 comments on commit 2580f2b

Please sign in to comment.