Skip to content

Commit

Permalink
Small fixes on the TabularConnection (apache#24874)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokko authored Jul 6, 2022
1 parent 3b35325 commit 2c4fd05
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
7 changes: 5 additions & 2 deletions docs/apache-airflow-providers-tabular/connections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,21 @@
.. _howto/connection:tabular:

Tabular Connection
==================
Connecting to Tabular
=====================

The Tabular connection type enables connection to Tabular to request a short lived token to access the Apache Iceberg tables. This token can be injected as an environment variable, to be used with Trino, Spark, Flink or your favorite query engine that supports Apache Iceberg.

After installing the Tabular provider in your Airflow environment, the corresponding connection type of ``tabular`` will be made available.

Default Connection IDs
----------------------

Tabular Hook uses the parameter ``tabular_conn_id`` for Connection IDs and the value of the parameter as ``tabular_default`` by default. You can create multiple connections in case you want to switch between environments.

Configuring the Connection
--------------------------

Client ID
The Client ID from Tabular

Expand Down
4 changes: 2 additions & 2 deletions docs/apache-airflow-providers-tabular/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Package apache-airflow-providers-tabular
`Tabular <https://tabular.io/>`__


Release: 0.0.1
Release: 1.0.0

Provider package
----------------
Expand All @@ -71,7 +71,7 @@ are in ``airflow.providers.tabular`` python package.
Installation
------------

You can install this package on top of an existing Airflow 2.1+ installation via
You can install this package on top of an existing Airflow 2.2+ installation via
``pip install apache-airflow-providers-tabular``

.. include:: ../../airflow/providers/tabular/CHANGELOG.rst
34 changes: 15 additions & 19 deletions tests/providers/tabular/hooks/test_tabular.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,24 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import unittest

import requests_mock

from airflow.providers.tabular.hooks.tabular import TabularHook


class TestTabularHook(unittest.TestCase):
"""Test endpoint"""

def test_tabular(self):
access_token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSU'
with requests_mock.Mocker() as m:
m.post(
'https://api.tabulardata.io/ws/v1/oauth/tokens',
json={
'access_token': access_token,
'token_type': 'Bearer',
'expires_in': 86400,
'warehouse_id': 'fadc4c31-e81f-48cd-9ce8-64cd5ce3fa5d',
'region': 'us-west-2',
'catalog_url': 'warehouses/fadc4c31-e81f-48cd-9ce8-64cd5ce3fa5d',
},
)
assert TabularHook().get_conn() == access_token
def test_tabular_hook():
access_token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSU'
with requests_mock.Mocker() as m:
m.post(
'https://api.tabulardata.io/ws/v1/oauth/tokens',
json={
'access_token': access_token,
'token_type': 'Bearer',
'expires_in': 86400,
'warehouse_id': 'fadc4c31-e81f-48cd-9ce8-64cd5ce3fa5d',
'region': 'us-west-2',
'catalog_url': 'warehouses/fadc4c31-e81f-48cd-9ce8-64cd5ce3fa5d',
},
)
assert TabularHook().get_conn() == access_token

0 comments on commit 2c4fd05

Please sign in to comment.