Azure Table Storage Tutorial - Python Azure Tables SDK with NBA Stats API
Scenario:
The NBA playoffs start on 15 April following the conclusion of the Play-In Tournament on 14 April. In this tutorial, we use the nba_api Python API Client for NBA.com to fetch NBA teams stats and then run the Python Azure Tables SDK to create Azure table and entries. Finally, with Azure Storage Explorer we can easily build search query and visualize the results.
Objective:
To illustrate Azure Tables Python SDK usage using NBA API, followed by querying Azure Table Storage with Azure Storage Explorer's Query Builder.
Pre-requisites:
For this example, you would need:
- An Azure Table Storage
Steps:
- Install nba_api
- Install Azure Tables client library for Python
- Python code to retrieve data, create table, and insert entries
- Run nba.py
- Visualize the NBA table (with Azure Storage Explorer)
- Sample query (with Azure Storage Explorer)
[STEP 1]: Install nba_api
[STEP 2]: Install Azure Tables client library for Python
[STEP 3]: Python code to retrieve data, create table, and insert entries
Note:
- replace STORAGE_CONNECTION_STRING with your storage connection string.
- I use "state" as PartitionKey and "abbreviation" as RowKey.
- This article describes best practice when choosing partition & row key for entities.
- The response from calling teams.get_teams() is like the following:
nba.py
[STEP 4]: Run nba.py
[STEP 5]: Visualize the NBA table (with Azure Storage Explorer)
The NBA table contains data of the 30 NBA teams with the following info:
- ID
- City Name
- State Name
- Nickname
- Full Name
- Year Founded
- Abbreviation
[STEP 6]: Sample query (with Azure Storage Explorer)
Query Example: To find out all NBA teams that are based in California and were founded in 1948.
1. Click the "Query" button on the upper-left corner of the table.
2. Use Query Builder to build the query. Then click ▶ to execute.
3. Result is Lakers (LAL) & Kings (SAC).
Conclusion:
This example shows how to use the nba_api to retrieve NBA teams stats and the Azure Tables Python SDK to work with Azure Table storage. The Azure Tables client library for Python provides a simple and intuitive API for working with Azure Table Storage, with methods for creating and managing table clients, table operations, and entities.
References:
- https://pypi.org/project/nba-api/
- https://learn.microsoft.com/en-us/azure/storage/tables/table-storage-overview
- https://learn.microsoft.com/en-us/python/api/overview/azure/data-tables-readme?view=azure-python
- https://learn.microsoft.com/en-us/python/api/azure-data-tables/azure.data.tables?view=azure-python
Published on:
Learn moreRelated posts
How Azure CLI handles your tokens and what you might be ignoring
Running az login feels like magic. A browser pops up, you pick an account, and from then on, everything just works. No more passwords, no more...
Boost your Azure Cosmos DB Efficiency with Azure Advisor Insights
Azure Cosmos DB is Microsoft’s globally distributed, multi-model database service, trusted for mission-critical workloads that demand high ava...
Microsoft Azure Fundamentals #5: Complex Error Handling Patterns for High-Volume Microsoft Dataverse Integrations in Azure
🚀 1. Problem Context When integrating Microsoft Dataverse with Azure services (e.g., Azure Service Bus, Azure Functions, Logic Apps, Azure SQ...
Using the Secret Management PowerShell Module with Azure Key Vault and Azure Automation
Automation account credential resources are the easiest way to manage credentials for Azure Automation runbooks. The Secret Management module ...
Microsoft Azure Fundamentals #4: Azure Service Bus Topics and Subscriptions for multi-system CRM workflows in Microsoft Dataverse / Dynamics 365
🚀 1. Scenario Overview In modern enterprise environments, a single business event in Microsoft Dataverse (CRM) can trigger workflows across m...
Easily connect AI workloads to Azure Blob Storage with adlfs
Microsoft works with the fsspec open-source community to enhance adlfs. This update delivers faster file operations and improved reliability f...
Microsoft Azure Fundamentals #3: Maximizing Event-Driven Architecture in Microsoft Power Platform
🧩 1. Overview Event-driven architecture (EDA) transforms how systems communicate.Instead of traditional request–response or batch integration...
Azure Developer CLI (azd) – October 2025
This post announces the October release of the Azure Developer CLI (`azd`). The post Azure Developer CLI (azd) – October 2025 appeared f...
Microsoft Azure Fundamentals #2: Designing Real-Time Bi-Directional Sync Between Dataverse and Azure SQL for Multi-Region Deployments
Here’s a detailed technical breakdown of designing a real-time bi-directional sync between Dataverse and Azure SQL for multi-region deployment...
Azure DevOps local MCP Server is generally available
Today we are excited to take our local MCP Server for Azure DevOps out of preview 🥳. Since the initial preview announcement, we’ve work...