Lakehouse Dynamic Table Development Quick Start Guide
Overview
Dynamic Tables are the core vehicle for incremental computation in Singdata Lakehouse. You simply declaratively define the query logic, and the system automatically detects upstream data changes and incrementally refreshes results, eliminating the need to manually write complex incremental ETL logic. This guide is organized by development workflow to help you quickly master dynamic table creation, refresh, and monitoring methods.
Quick Navigation
- Create Dynamic Table -- Declaratively define incremental computation logic
- Manual Refresh -- Use REFRESH to trigger computation immediately
- View Refresh History -- Monitor refresh status and mode
- View Dynamic Table Structure -- Use DESC to view definition
- Drop Dynamic Table -- Use DROP DYNAMIC TABLE to clean up
SQL Commands Covered
| Command | Purpose | Use Case |
|---|---|---|
CREATE DYNAMIC TABLE ... AS SELECT | Create dynamic table | Declaratively define incremental computation logic |
REFRESH DYNAMIC TABLE | Manual refresh trigger | Compute latest results immediately |
SHOW DYNAMIC TABLE REFRESH HISTORY | View refresh history | Monitor refresh status |
DESC DYNAMIC TABLE | View dynamic table structure | View definition and configuration |
DROP DYNAMIC TABLE | Drop dynamic table | Clean up dynamic tables no longer needed |
Prerequisites
The following examples use simulated orders table orders_dt and products table products_dt:
Create Dynamic Table
Use CREATE DYNAMIC TABLE to declaratively define computation logic. The system automatically handles incremental computation.
Parameter Descriptions:
REFRESH INTERVAL 10 MINUTE: Automatically refresh every 10 minutes.VCLUSTER default: Specifies the compute cluster used for the refresh.
Manual Refresh
Use REFRESH DYNAMIC TABLE to trigger computation immediately without waiting for scheduled refresh.
Result Verification:
| category | order_count | total_quantity |
|---|---|---|
| Laptop | 1 | 1 |
| Phone | 2 | 3 |
View Refresh History
Use SHOW DYNAMIC TABLE REFRESH HISTORY to monitor refresh status and determine whether it was an incremental or full refresh.
Key Field Descriptions:
state: Refresh status (SUCCEED / FAILED / RUNNING)refresh_mode: Refresh mode (INCREMENTAL / FULL)refresh_trigger: Trigger method (MANUAL / SYSTEM_SCHEDULED)
View Dynamic Table Structure
Use DESC DYNAMIC TABLE to view the dynamic table's definition and configuration.
Returned Information:
- Table structure (column names, types)
- Refresh interval
- VCluster used
- Underlying SQL definition
Incremental Computation Verification
Insert new data into the source table to verify the dynamic table's incremental refresh capability.
Result Explanation:
| category | order_count | total_quantity |
|---|---|---|
| Audio | 1 | 5 |
| Laptop | 1 | 1 |
| Phone | 2 | 3 |
Drop Dynamic Table
Use DROP DYNAMIC TABLE to drop a dynamic table. Note that you must use DROP DYNAMIC TABLE, not DROP TABLE.
Clean Up Test Data
After completing dynamic table verification, it is recommended to clean up test tables:
Notes
- VCluster Selection: Use
GENERALtype VClusters (such asdefault), notANALYTICStype. - Refresh Frequency: Higher frequency leads to higher CRU consumption. Use
1 DAYfor T+1 scenarios,1 HOURfor hourly. - Non-deterministic Functions: Avoid using non-deterministic functions like
CURRENT_TIMESTAMP(),RAND()in Dynamic Tables. - DROP Syntax: You must use
DROP DYNAMIC TABLE; usingDROP TABLEwill produce an error. - Incremental Limitations: Some complex queries (such as outer JOINs with non-equi conditions) may not execute incrementally; the system will automatically fall back to full refresh.
