Large organizations utilize Data Pipeline Management solutions to automate repetitive business operations and enhance overall productivity. However, with such enormous amounts of data to analyze, it is critical that the data be presented in a form that users can easily understand. This can be accomplished by presenting data in a visual format, such as Maps or Graphs. This is where an Airflow Tableau connection comes in.
Integrating Apache Airflow, a popular Data Pipeline Management system, in conjunction with Tableau, a Business Intelligence (BI) & a Data Visualization platform, enables users to efficiently handle large volumes of data as well as access visually appealing data. This article will help you set up the Airflow Tableau connection easily.
Table of Contents
Prerequisites
Basic knowledge of workflow management.
What is Airflow?
Image Credit
Apache Airflow is a platform for authoring, scheduling, and monitoring Data Pipelines programmatically. In October 2014, Airflow was first launched by Maxime Beauchemin. Airflow was open source from the start, and it was formally launched to the public in June 2015 under the Airbnb Git Hub. Later, in March 2016, the Apache Software Foundation accepted the project into its Incubator program, and in January 2019, the foundation named Apache Airflow a Top-Level Project.
Airflow can be used to create workflows as DAGs (Directed Acyclic Graphs). The Airflow scheduler runs the tasks among a group of workers, adhering to the requirements users specify. The Graphical User Interface (GUI)makes it simple to see pipelines in production, track their progress, and resolve problems as required.
Key Features of Airflow
- Modern and Interactive Interface: The user is guided through administrative duties such as workflow management and user administration using the graphical interface. The Apache Airflow 2.0’s new User Interface (UI)is a user-friendly, lightweight designed interface.
- Increased Scheduler Performance: The Airflow’s new and improved scheduler impresses with its incredible speed and ability to operate many scheduler instances in an active model. The availability and failover security have both improved as a result of this.
- Smart Sensors: The tasks of Apache Airflow are carried out in sequential order. In some instances, it is rational to momentarily pause the workflow’s execution; this is done by sensors.
The sensors are run in bundles in the new Smart Sensors mode, consuming fewer resources. - Robust Integration: Airflow has a number of plug-and-play operators that can run the tasks on Google Cloud Platform, Amazon Web Platforms, Microsoft Azure, and a variety of other third-party services. As a result, Airflow is simple to integrate into existing infrastructure and expand to other technologies.
Hevo Data is a No-code Data Pipeline that offers a fully managed solution to set up data integration from 100+ Data Sources (including 30+ Free Data Sources) and will let you directly load data to a Data Warehouse to be visualized in a BI tool such as Tableau. It will automate your data flow in minutes without writing any line of code. Its fault-tolerant architecture makes sure that your data is secure and consistent. Hevo provides you with a truly efficient and fully automated solution to manage data in real-time and always have analysis-ready data.
Get started with hevo for free
Let’s look at some of the salient features of Hevo:
- Fully Managed: It requires no management and maintenance as Hevo is a fully automated platform.
- Data Transformation: It provides a simple interface to perfect, modify, and enrich the data you want to transfer.
- Real-Time: Hevo offers real-time data migration. So, your data is always ready for analysis.
- Schema Management: Hevo can automatically detect the schema of the incoming data and map it to the destination schema.
- Scalable Infrastructure: Hevo has in-built integrations for 100’s of sources that can help you scale your data infrastructure as required.
- Live Monitoring: Advanced monitoring gives you a one-stop view to watch all the activities that occur within Data Pipelines.
- Live Support: Hevo team is available round the clock to extend exceptional support to its customers through chat, email, and support calls.
Sign up here for a 14-day free trial!
Airflow Components
- Hooks: Airflow utilizes Hooks to connect to third-party systems, allowing access to APIs and Databases (e.g., Hive, S3, GCS, MySQL, Postgres).
- Providers: Packages containing the core Operators and Hooks for a certain service are known as Providers.
- Connections: Connections can be directly managed from the User Interface, and sensitive data is protected and saved in PostgreSQL or MySQL.
- Sensors: Sensors offer a significant feature called ‘reschedule’ mode, which allows the sensor to reschedule tasks instead of restricting a worker slot between pokes.
Installing Airflow on the System
Image Credit
Following are the easy steps to install Apache Airflow using pip:
- Install from PyPI using pip:
pip install apache-airflow
- Initialize the Database:
airflow initdb
- Start the Webserver, the default Port is 8080:
airflow webserver -p 8080
- Start the Scheduler:
airflow scheduler
What is Tableau?
Image Credit
Tableau Software is popular Business Intelligence, Data Visualization software company based in the United States. It can be used to create reports and dashboards of large amounts of data. Pat Hanrahan, Christian Chabot, and Chris Stolte established Tableau in the year 2003. Its main purpose is to make the Database industry more interactive and comprehensive.
Tableau can help users with next-generation ideas like predictive and prescriptive analysis by producing Graphs, Charts, Maps, and Reports. Today, it is utilized for visual data analysis by businesses, academic institutions, and many governmental organizations.
Key Features of Tableau
- Interactive Dashboard: Besides reporting and analyzing data, the Tableau Dashboard consists of Tableau Exchange, a one-stop shop for products and services. It helps users get a head start on Data Analysis. Users can even effortlessly duplicate a dashboard or its features from one worksheet to another.
- Collaborations and Sharing: Tableau makes it easy to collaborate and share data with the team. It can be in the form of visualizations, sheets, dashboards, and other formats in real-time. Tableau also enables users to securely share data from various data sources, including on-premise, Cloud, and hybrid.
- Using Tableau to Connect to Data Sources: Tableau connects to a large number of different Data Sources. It can access files on users’ computers, such as Microsoft Excel, text files, JSON, PDF, and so on. It can also access data stored on a database server like Microsoft SQL Server, MySQL, Oracle, Teradata, and others.
- Robust Security: Tableau takes extra precautions to protect data and users. It features a fail-safe security system based on authentication and authorization mechanisms for data connections and user access.
Now that you’re familiar with Airflow and Tableau, let’s dive straight into the Airflow Tableau connection. Let’s go through some easy steps to establish an Airflow Tableau connection.
Airflow Tableau Connection
One of the easiest methods to set up Airflow Tableau Connection is by using the Username and Password Authentication. Follow the below-mentioned steps to establish an Airflow Tableau connection.
Configuring Connection
The first step is to configure the Airflow Tableau connection.
- Login & Password: Users must specify the tableau Username and Password authentication as used for the initial connection.
- Host: Users are required to specify the Server URL used for the Tableau connection.
- Extras (optional): Users can specify the extra parameters such as the JSON dictionary that can be utilized in the Azure connection.
All the following parameters are optional:
- site_id: In the Tableau REST API, the
site_id
corresponds to the contentUrl
attribute. It is a part of the URL that states the /site/ in the URL. - token_name: The personal access token name is used with token authentication.
- personal_access_token: The personal access token value is also used with token authentication.
- verify: A boolean determines whether the server’s TLS certificate is verified or a string that determines the path to a CA bundle. Default is true.
- cert: If it is a String, define the
path
to ssl
client cert file (.pem), and if Tuple, define (‘cert’, ‘key’) pair.
Note: While specifying the Airflow Tableau connection in the environment variable, it must be specified using URI syntax. Also, All components of the URI MUST be URL-encoded.
Default Connection IDs
By default, all the Operators and Hooks that are related to Tableau utilize the tableau_default
.
Operators
In a Tableau, the TableauOperator is used in order to run Tableau Server-client Python commands.
- resource (str): Name of the resource to be used.
- method (str): Name of the resource method to execute.
- find (str): Reference of the resource that will be receiving the action.
- match_with (str): Resource field name must be matched with the find parameter. The default value is Id.
- site_id (str): ID of the site to which the workbook belongs. The default value is None.
- blocking_refresh (bool): By default, the extract refresh is blocking, which means it will wait until it completes. The default value is True.
- check_interval (float): Waiting time in seconds for the job, between each instance, ensures that the operation is completed. The default value is 20.
- tableau_conn_id (str): Credentials required to authenticate to the Tableau Server. The default value is
tableau_default
.
An example of how to use the TableauOperator is as follows:
task_refresh_workbook_blocking = TableauOperator(
resource='workbooks',
method='refresh',
find='MyWorkbook',
match_with='name',
blocking_refresh=True,
task_id='refresh_tableau_workbook_blocking',
)
Providers
Following are the airflow.providers.tableau
sub-packages with their respective Classes and Functions.
airflow.providers.tableau.hooks
- The status of the job indicates the finished code.
class airflow.providers.tableau.hooks.tableau.TableauJobFinishCodeTableauJobFinishCode(Enum)
- Allows communication with the Tableau Server Instance by connecting to it. Besides, it can be utilized as a Context Manager because it automatically authenticates connections whenever they are opened. However, when the connections are closed, it signs them out.
class airflow.providers.tableau.hooks.tableau.TableauHook(site_id=None, tableau_conn_id=default_conn_name)
- This exception indicates that a Job failed.
class TableauJobFailedException(AirflowException)
- Trying to parse a string into the boolean.
parse_boolean(val)
airflow.providers.tableau.operators.tableau
class airflow.providers.tableau.operators.tableau.TableauOperator(*, resource, method, find, match_with='id', site_id=None, blocking_refresh=True, check_interval=20, tableau_conn_id='tableau_default', **kwargs)
airflow.providers.tableau.sensors.tableau_job_status
This operator observes the status of a Tableau Server Job.
class
airflow.providers.tableau.sensors.tableau_job_status.TableauJobStatusSensor(*, job_id, site_id=None, tableau_conn_id='tableau_default', **kwargs)
That’s it, this is how you can easily establish the Airflow Tableau connection.
Conclusion
One of the advantages of setting up Apache Airflow Tableau connection is that Airflow enables users the flexibility to set up, schedule, and monitor any type of workflows easily, whereas Tableau provides users to create a highly interactive visual representation quickly.
This article helped us with an easy method to set up the Airflow Tableau connection. Tableau makes Business Analysis more efficient through intuitive, interactive, and easy-to-use services. Moreover, analyzing and visualizing your data by loading it into a Data Warehouse from Tableau can be cumbersome. This is where Hevo comes in.
visit our website to explore hevo
Hevo Data with its strong integration with 100+ Sources & BI tools allows you to not only export data from sources & load data in the destinations, but also transform & enrich your data, & make it analysis-ready so that you can focus only on your key business needs and perform insightful analysis using BI tools such as Tableau.
Give Hevo Data a try and sign up for a 14-day free trial today. Hevo offers plans & pricing for different use cases and business needs, check them out!
Share your experience of working with the Airflow Tableau connection in the comments section below.