This article will provide you with a comprehensive understanding of how Tableau Hyper and the Hyper API works.
In order to perform a proper analysis, businesses have to ensure that they collect as much data as possible, allowing them to ensure that their analysis would not lead to incorrect or partial insights.
Since the amount of data being collected by businesses has grown exponentially, it is of paramount importance to the developers of Business Intelligence tools to ensure that their tools can handle this large volume of data.
Introduction to Tableau
Tableau is a popular BI and Data Analytics tool that was developed to help organizational decision-makers visualize, analyze and understand complex business data and make data-driven decisions.
You can create a wide range of interactive visualizations and derive valuable insights from them.
Understanding the Key Features of Tableau – Advanced Dashboard, In-Memory and Live Data, Attractive Visualizations, Robust Security & Predictive Analytics
Let’s Understand Tableau Hyper
- Bring users closer to their data by giving them fast analytical workload performance and write speed.
- It can be defined as a high-performance In-memory Data Engine technology that gives users the ability to analyze large and complex datasets faster, by seamlessly evaluating all analytical queries in the transactional database.
How to Create Tableau Hyper Files using Hyper API
- Install the library in your local system.
- The command for installing the library for Python is as follows:
pip install tableauhyperapi
Steps can be followed to create Tableau Hyper files using the Hyper API for Python
Step 1: Importing the Tableau Hyper API Library
- Users can import the Hyper API library by executing the following command:
from tableauhyperapi import HyperProcess, Telemetry, Connection, CreateMode, NOT_NULLABLE, NULLABLE, SqlType, TableDefinition,Inserter, escape_name, escape_string_literal, HyperException, print_exception, TableName
Step 2: Enabling the Tableau HyperProcess
- Enabling the HyperProcess will start the local Hyper Database Server.
- Starting or shutting down the Hyper Database Server usually takes a lot of time and hence, you should only shut down the Server when all your required processes are complete.
- The HyperProcess can be started by running the following command:
with HyperProcess(telemetry=Telemetry.SEND_USAGE_DATA_TO_TABLEAU) as hyper
- By setting telemetry to Telemetry.SEND_USAGE_DATA_TO_TABLEAU, users can instruct the Tableau HyperProcess to send all Hyper API usage data to Tableau.
- On the other hand, users can choose to not send this data by setting telemetry to Telemetry.DO_NOT_SEND_USAGE_DATA_TO_TABLEAU.
Step 3: Connecting to “.hyper” file
- A connection can be established to a “.hyper” file using the “Connection” object by running the following command:
with Connection(hyper.endpoint, 'Example.hyper', CreateMode.CREATE_AND_REPLACE) as connection
- The connection command requires three parameters i.e. the identifier for the HyperProcess, the name of the “.hyper” file, and the CreateMode.
- The identifier for the HyperProcess in this example is “hyper” as can be observed in the command in Step 2.
- The name of the “.hyper” file is the name of the file you wish to create.
- The final parameter i.e. CreateMode should be set to CreateMode.CREATE_AND_REPLACE if you wish to create a new file with the given name or overwrite the existing file (if any) with the same name and create a new one instead of it. If you wish to modify an existing “.hyper” file, then the CreateMode should be set to CreateMode.NONE.
Move data effortlessly with Hevo’s zero-maintenance data pipelines, Get a demo that’s customized to your unique data integration challenges
Step 4: Creating the Table
- In order to create a table, the table has to be defined first using the “TableDefinition” method. A table can be defined by running the following commands:
connection.catalog.create_schema('Extract_Schema') example_table = TableDefinition( TableName('Extract','Extract_Schema'), [ TableDefinition.Column('rowID', SqlType.big_int()), TableDefinition.Column('value', SqlType.big_int()), ])
- The three expected parameters in the “TableDefinition” method are the table name, the schema name, and the list of columns that are supposed to be in that table each of which can be defined using the “TableDefinition.Column” method.
- Once the table has been defined, it can be created by running the following command:
connection.catalog.create_table(example_table)
Step 5: Inserting Data into the Table
- Data can be inserted into the table by running the following command:
with Inserter(connection, example_table) as inserter:
for i in range (1, 101):
inserter.add_row([ i, i])
inserter.execute()
Step 6: Closing Connection and Shutting Down the Tableau HyperProcess
- Due to the usage of the “with” command, there is no need for the user to explicitly shutdown the HyperProcess. It would be done automatically as the program reaches the end of its execution.
- The entire Python code to create “.hyper” files using the Tableau Hyper API is as follows:
from tableauhyperapi import Connection,HyperProcess, SqlType, TableDefinition, escape_string_literal, escape_name, NOT_NULLABLE, Telemetry, Inserter, CreateMode, TableName
with HyperProcess(Telemetry.SEND_USAGE_DATA_TO_TABLEAU) as hyper:
print("The HyperProcess has started.")
with Connection(hyper.endpoint, 'Example.hyper', CreateMode.CREATE_AND_REPLACE) as connection:
print("The connection to the Hyper file is open.")
connection.catalog.create_schema('Extract_Schema')
example_table = TableDefinition(TableName('Extract','Extract_Schema'), [
TableDefinition.Column('rowID', SqlType.big_int()),
TableDefinition.Column('value', SqlType.big_int()),
])
print("The table is defined.")
connection.catalog.create_table(example_table)
with Inserter(connection, example_table) as inserter:
for i in range (1, 101):
inserter.add_row(
[ i, i ]
)
inserter.execute()
print("The data was added to the table.")
print("The connection to the Hyper extract file is closed.")
print("The HyperProcess has shut down.")
Find a plan that’s right for you, Experience transparent pricing that ensures no billing surprises even as you scale. Get a 14 day free trial with 24×7 support. No credit card is required. Get a custom quote tailored to your requirements
Functions of Tableau Hyper API
- The Tableau Hyper API houses a set of functions that give users the ability to interact with all their Tableau Extracts.
- Open existing Extract files.
- Perform various CRUD (Create, Read, Update, Delete) operations on Extract files.
- Create Extracts for data sources that are not yet supported by Tableau.
- Automate various custom Extract, Transform and Load (ETL) operations.
- Use SQL queries to interact with data in Tableau Hyper Extracts.
- The Tableau Hyper API only supports the following 64-bit platforms:
- Microsoft Windows Server 2019, 2016, 2012 R2, 2012, 2008 R2
- Microsoft Windows 7 or newer (64-bit)
- Amazon Linux 2, Red Hat Enterprise Linux (RHEL) 7.3+, CentOS 7.3+, Oracle Linux 7.3+, Ubuntu 16.04 LTS, and 18.04 LTS
- macOS 10.13 or newer
- Tableau Hyper API libraries are only available for the following programming languages:
- Python (3.6 or newer)
- Java (Java 8 or newer)
- C++ (C++11 or newer)
- C#/.NET (.NET Standard 2.0)
Updating Tableau Hyper Files using Hyper API
In order to make changes in an existing Hyper file, the following process can be implemented:
- Start the Tableau HyperProcess.
- Connect to the Hyper file with the CreateMode as CreateMode.NONE.
- Make necessary changes to the file.
The sample Python code to make changes to the file created in the previous section is as follows:
from tableauhyperapi import Connection, HyperProcess, SqlType, TableDefinition,
escape_string_literal, escape_name, NOT_NULLABLE, Telemetry, Inserter, CreateMode, TableName
with HyperProcess(Telemetry.SEND_USAGE_DATA_TO_TABLEAU) as hyper:
print("The HyperProcess has started.")
with Connection(hyper.endpoint, 'Example.hyper', CreateMode.NONE) as connection:
print("The connection to the .hyper file is open.")
with Inserter(connection, TableName('Extract','Extract_Schema')) as inserter:
inserter.add_row([101, 101])
inserter.add_row([102, 102])
inserter.execute()
print("The data in table "Extract" has been updated.")
print("The connection to the Hyper file is closed.")
print("The HyperProcess has shutdown.")
Visit our pricing page for more information.
Conclusion
This article provided you with an in-depth understanding of how Tableau Hyper works along with how you can use the Hyper API to perform all required operations on your Hyper files.
Most businesses now make use of multiple platforms to run their day-to-day operations. Hence, businesses rely on Data Integration solutions to integrate data from all their data sources into a Business Intelligence tool of their choice.
Businesses can instead use automated Data Integration platforms like Hevo.
Looking for a better way to manage your work? Get started with a free trial. Try for free
Manik is a passionate data enthusiast with extensive experience in data engineering and infrastructure. He excels in writing highly technical content, drawing from his background in data science and big data. Manik's problem-solving skills and analytical thinking drive him to create impactful content for data professionals, helping them navigate their day-to-day challenges. He holds a Bachelor's degree in Computers and Communication, with a minor in Big Data, from Manipal Institute of Technology.