sqlite query to surface the relationships from metadata.sqlite in PowerBI
This example visualizes the relationships between tables in a PowerBI data model by querying the metadata.sqlite database. It shows a table-level schema diagram where columns from different tables are connected based on foreign key relationships, with cardinality information included. The code uses SQLite queries through the PowerBI metadata store, joining the `relationship`, `table`, and `column` tables to extract source and target table/column pairs. The visualization renders the resulting graph structure, highlighting how tables interconnect through their columns. The implementation relies on standard SQL joins and explicit column selections, with the final query outputting the relationship endpoints and cardinalities for a clear overview of the model's data flow.
AI-generated description