A powerful integration that brings AI functionality to Tableau Server or Tableau Cloud using LangChain, enabling natural language interactions with the data you trust in Tableau.
This repo is an implementation of tableau_langchain and it's PyPi registry.
- Natural language querying of Tableau data
- Available via Web interface or Dashboard extension
- Support for both Tableau Server and Tableau Cloud
Before you begin, ensure you have the following:
- Tableau Server Version 2025.1 or later OR Tableau Cloud, a free Tableau Cloud trial is available via the Tableau Developer Program
- Python 3.12+ - Download Python
- Git - Download Git
- API credentials for your chosen AI model (OpenAI, etc.)
When using this code, data from Tableau will be sent to an external AI model (by default, OpenAI). For learning and testing, it is strongly recommended to use the Superstore dataset included with Tableau.
If you need to process sensitive or proprietary information, consider configuring the tool to use a local AI model instead of an external service. This approach ensures your data remains within your organisation’s infrastructure and reduces the risk of data exposure.
git clone https://github.com//tableau-langchain-starter-kit.git
cd tableau-langchain-starter-kit
Creating a virtual environment helps isolate project dependencies:
python -m venv venv
Windows:
venv\Scripts\activate
macOS/Linux:
source venv/bin/activate
💡 Tip: You should see (venv)
at the beginning of your command prompt when the virtual environment is active.
pip install -r requirements.txt
If you encounter any installation issues, try upgrading pip first:
pip install --upgrade pip
- Copy the template environment file:
cp .env_template .env
- Open the
.env
file in your preferred text editor and configure the following variables:
# Model Providers
OPENAI_API_KEY='from OpenAI developer portal'
MODEL_PROVIDER='openai'
# LangSmith
LANGCHAIN_TRACING='true'
LANGCHAIN_API_KEY="from Langsmith app"
LANGCHAIN_PROJECT="Langsmith project name"
# Tableau Server / Cloud
TABLEAU_DOMAIN='your Tableau Cloud or Server domain'
TABLEAU_SITE='your Tableau site'
TABLEAU_JWT_CLIENT_ID='from Connected App configuration page'
TABLEAU_JWT_SECRET_ID='from Connected App configuration page'
TABLEAU_JWT_SECRET='from Connected App configuration page'
TABLEAU_API_VERSION='3.21'
TABLEAU_USER='user account for the Agent'
DATASOURCE_LUID='unique identifier for a data source found via the graphql metadata API'
.env
file to version control. It's already included in .gitignore
.
Perfect for testing your configuration and running quick experiments:
python main.py
This mode allows you to:
- Test your Tableau connection
- Verify AI service integration
- Run sample queries from the command line
Launch the full web application with dashboard extension support:
python web_app.py
Once running, open your browser and navigate to:
- Local development:
http://localhost:8000
- The application will display the correct URL in the terminal
You will now be able to ask questions in natural language like:
- "What are the trends in customer satisfaction?"
- "Compare revenue between Q1 and Q2"
- "Show me outliers in the sales data"
Launch the full web application with dashboard extension support:
python web_app.py
Once running, open your Tableau workbook, or the Superstore Dashboard
On a dashboard page, in the bottom left menu drag a dashboard exention, local extension, and select tableau_langchain.trex from the dashboard_extension folder.
This project is licensed under the MIT License - see the LICENSE file for details.
- Check out the Tableau LangChain repo for further developments
- Join the #tableau-langchain conversation on Slack. Sign up to the DataDev Slack channel here.
- Tableau LangChain the team developing the tools
- LangChain for the AI framework
- Tableau for the visualization platform
- All contributors who have helped improve this project
⭐ If you find this project helpful, please consider giving it a star!