Use this repository to build a real-time dashboard in Python using Tinybird and Dash. To learn more about this implementation, check out the blog post.
To implement this project, you'll need to have the following installed
- Python > v3.8
- Node.js > v18 (to use the Mockingbird CLI)
Clone the repository:
git clone https://github.com/tinybirdco/real-time-python-dashboard.git
cd real-time-python-dashboard
Setup virtual environment:
python -mvenv .e
. .e/bin/activate
echo ".e*" >> .gitignore
Install requirements:
pip install requirements.txt
Install Tinybird CLI
pip install tinybird-cli
If you need a free Tinybird account, sign up here.
Go to ui.tinybird.co and create a Workspace called in either region. Copy your user admin token from the Tokens in the UI. This is the token associated to your email address:
Authenticate to your Tinybird Workspace
cd tinybird
tb auth --token <your user admin token>
echo ".tinyb" >> .gitignore
From the tinybird
folder, run the following to push the Tinybird Pipes and Data Source to your Workspace:
tb push datasources pipes
For this demo, you'll use Mockingbird to stream mock data to Tinybird to populate your flight_bookings
Data Source with mock flight bookings data.
npm install -G @tinybirdco/mockingbird-cli
echo "node_modules" >> .gitignore
You can send up to 1,000 rows per second to Tinybird using Mockingbird:
export TB_HOST=<us_gcp OR eu_gcp>
export TB_TOKEN=<your_user_admin_token>
mockingbird-cli tinybird \
--template "Flight Bookings" \
--eps 10 \
--endpoint=$TB_HOST \
--datasource=flight_bookings \
--token=$TB_TOKEN
From the main project directory:
python app.py
Open http://127.0.0.1:8050/ to view your real-time dashboard.
If you find any issues or have suggestions for improvements, please submit an issue or a pull request.
This code is available under the MIT license. See the LICENSE file for more details.
• Community Slack • Tinybird Docs •