[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M69BP1F17XK0TFKMDS23QNEV":3,"skill-same:01M69BP1F17XK0TFKMDS23QNEV":86},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":37,"publishedAt":51,"linkOnly":52,"markdownContent":53,"markdownBody":54,"frontMatter":55,"refName":57,"commitSha":58,"skillDirectory":59,"forksCount":60,"repositoryHtmlUrl":61,"repositoryHomepageUrl":6,"ownerHtmlUrl":62,"ownerBlogUrl":63,"ownerDescription":64,"updatedAt":65,"install":66,"resources":79},"01M69BP1F17XK0TFKMDS23QNEV","fabric-semantic-model",null,"Infer and generate Power BI semantic models (TMDL format) from Microsoft Fabric lakehouse tables. Covers star-schema detection, table classification (fact\u002Fdimension), relationship inference, DAX measure generation, data type mapping, and deployment via REST API. Use when: create semantic model, build data model, star schema, Power BI model, TMDL, fact table, dimension table.","microsoft\u002Fgh-copilot-fabric-agents","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M69BNKRQPFJ5Z6ECX2S8E17F",3,"MIT","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fgh-copilot-fabric-agents\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ffabric-semantic-model\u002FSKILL.md",[18,23,26,29,34],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000013","分析与可视化",{"categoryNo":27,"categoryName":28,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":30,"categoryName":31,"taxonomyType":32,"taxonomyTypeDesc":33},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",{"categoryNo":35,"categoryName":36,"taxonomyType":32,"taxonomyTypeDesc":33},"01JBSEEDCAT000000000000033","数据分析师",[38,39,40,41,42,9,43,44,45,46,47,48,49,50],"fabric","fabric semantic model","MCP","inference","mcp server","dax","microsoft fabric","deployment","power bi","create","generate","code","lakehouse","2026-11-10 10:12:30",false,"---\nname: fabric-semantic-model\ndescription: \"Infer and generate Power BI semantic models (TMDL format) from Microsoft Fabric lakehouse tables. Covers star-schema detection, table classification (fact\u002Fdimension), relationship inference, DAX measure generation, data type mapping, and deployment via REST API. Use when: create semantic model, build data model, star schema, Power BI model, TMDL, fact table, dimension table.\"\ncompatibility: \"Requires the Fabric MCP Server VS Code extension for table discovery. Generates TMDL files deployable to Microsoft Fabric via REST API.\"\n---\n\n# Fabric Semantic Model Creator — Reference\n\nGenerates Power BI semantic models in TMDL format by analyzing lakehouse table schemas and sample data. The agent reasons about table names, column names, data types, cardinality, and sample values to infer the best star-schema model.\n\n## Table Classification Rules\n\nClassify each lakehouse table as **fact** or **dimension** based on these signals:\n\n| Signal | Fact Table | Dimension Table |\n|--------|-----------|-----------------|\n| **Name patterns** | Contains `fact_`, `fct_`, `sales`, `orders`, `transactions`, `events`, `log`, `movements` | Contains `dim_`, `lookup`, `calendar`, `date`, `product`, `customer`, `employee`, `geography`, `category`, `status` |\n| **Column patterns** | Has multiple `_id`\u002F`_key` foreign keys + numeric measure columns (`amount`, `quantity`, `price`, `total`, `count`) | Has a single primary key + descriptive text columns (`name`, `description`, `label`, `title`, `code`) |\n| **Row count** | Typically high (transactions) | Typically low (reference data) |\n| **Numeric density** | Many numeric columns relative to total | Few numeric columns, mostly strings |\n\nIf ambiguous, default to **dimension**. Better to have an extra dimension than miss a fact table's relationships.\n\n## Relationship Inference Rules\n\nDetect relationships by matching column names across tables:\n\n1. **Exact key match**: `orders.customer_id` → `customers.customer_id` (or `customers.id`)\n2. **Name-based match**: column named `{table_name}_id` or `{table_name}_key` in a fact table points to the dimension with that name\n3. **Single-column PK in dimension**: if a dimension has exactly one `_id`\u002F`_key` column and a fact table has a column with the same name, infer the relationship\n4. **Date keys**: columns named `date`, `date_id`, `fecha`, `order_date`, etc. connect to a date\u002Fcalendar dimension\n\nAll relationships are **many-to-one** (fact → dimension) unless the agent detects a bridge\u002Fjunction table (many-to-many).\n\nCross-filter direction: **Single** by default. Only use **Both** for bridge tables.\n\n## DAX Measure Generation Rules\n\nGenerate measures based on column classification:\n\n| Column Pattern | Measure | DAX Expression |\n|---------------|---------|---------------|\n| `amount`, `total`, `revenue`, `sales`, `importe` | Sum | `SUM('{table}'[{column}])` |\n| `quantity`, `qty`, `count`, `cantidad`, `units` | Sum | `SUM('{table}'[{column}])` |\n| `price`, `cost`, `precio`, `coste` | Average | `AVERAGE('{table}'[{column}])` |\n| `discount`, `descuento` | Sum + Average | Both measures |\n| Any numeric in fact table | Row Count | `COUNTROWS('{table}')` (one per fact table) |\n| `id`\u002F`key` in dimension | Distinct Count | `DISTINCTCOUNT('{table}'[{column}])` |\n\nNaming convention: `Total {Column}`, `Avg {Column}`, `# {Table}` (row count), `# Unique {Column}` (distinct count). Use business-friendly names, not technical ones.\n\n## Data Type Mapping\n\nMap lakehouse (Spark) types to TMDL types:\n\n| Spark Type | TMDL `dataType` | Notes |\n|-----------|-----------------|-------|\n| `string` | `string` | |\n| `int`, `integer` | `int64` | TMDL uses `int64` for all integers |\n| `long`, `bigint` | `int64` | |\n| `float` | `double` | TMDL has no float, use double |\n| `double` | `double` | |\n| `decimal` | `decimal` | |\n| `boolean` | `boolean` | |\n| `date` | `dateTime` | TMDL uses `dateTime` for dates |\n| `timestamp` | `dateTime` | |\n\n## TMDL File Structure\n\nThe semantic model is a folder of `.tmdl` files plus metadata:\n\n```\n{model_name}\u002F\n├── definition\u002F\n│   ├── database.tmdl          # Database-level settings\n│   ├── model.tmdl             # Model-level settings (culture, access)\n│   ├── relationships.tmdl     # All relationships\n│   └── tables\u002F\n│       ├── {table1}.tmdl      # Table definition + columns + measures + partition\n│       ├── {table2}.tmdl\n│       └── ...\n└── definition.pbism            # Semantic model settings\n```\n\n### database.tmdl template\n\n```tmdl\ndatabase '{MODEL_NAME}'\n\tcompatibilityLevel: 1604\n```\n\n### model.tmdl template\n\nThe model must include a `dataSource` block pointing to the lakehouse's SQL analytics endpoint. The agent must fetch this endpoint from the Fabric REST API: `GET \u002Fv1\u002Fworkspaces\u002F{id}\u002Flakehouses\u002F{id}` → look for `properties.sqlEndpointProperties.connectionString`.\n\n```tmdl\nmodel Model\n\tculture: es-ES\n\tdefaultPowerBIDataSourceVersion: powerBI_V3\n\tdiscourageImplicitMeasures\n\tsourceQueryCulture: es-ES\n\n\tdataSource '{LAKEHOUSE_NAME}'\n\t\ttype: structured\n\t\tconnectionDetails\n\t\t\tprotocol: tds\n\t\t\taddress\n\t\t\t\tserver: {SQL_ENDPOINT}\n\t\t\t\tdatabase: {LAKEHOUSE_NAME}\n\t\tcredential\n\t\t\tAuthenticationKind: OAuth2\n```\n\n### Table .tmdl template (for each table)\n\nPartitions use Power Query `m` expressions with `mode: directQuery` connecting to the SQL analytics endpoint. Do NOT use `entity` partitions or `expressionSource: DatabaseQuery` — those fail when deploying via REST API.\n\n```tmdl\ntable '{TABLE_NAME}'\n\n\tmeasure '# {TABLE_NAME}' = COUNTROWS('{TABLE_NAME}')\n\t\tformatString: #,##0\n\n\tcolumn {COLUMN_NAME}\n\t\tdataType: {TMDL_TYPE}\n\t\tsourceColumn: {SOURCE_COLUMN}\n\t\tsummarizeBy: {none|sum|average|count}\n\n\tpartition '{TABLE_NAME}' = m\n\t\tmode: directQuery\n\t\tsource =\n\t\t\tlet\n\t\t\t\tSource = Sql.Database(\"{SQL_ENDPOINT}\", \"{LAKEHOUSE_NAME}\"),\n\t\t\t\tdbo_{TABLE_NAME} = Source{{[Schema=\"dbo\",Item=\"{TABLE_NAME}\"]}}[Data]\n\t\t\tin dbo_{TABLE_NAME}\n```\n\n### relationships.tmdl template\n\n```tmdl\nrelationship {GUID}\n\tfromColumn: '{FACT_TABLE}'.{FK_COLUMN}\n\ttoColumn: '{DIM_TABLE}'.{PK_COLUMN}\n```\n\n### definition.pbism\n\n```json\n{\n  \"version\": \"4.0\",\n  \"settings\": {}\n}\n```\n\n## Sample Data Analysis\n\nWhen classifying tables and inferring relationships, analyze sample data (first 100 rows) to:\n\n1. **Confirm cardinality**: A column with 10 distinct values in 10000 rows is likely a FK to a dimension\n2. **Detect date formats**: Sample values reveal if a string column is actually a date\n3. **Detect key patterns**: IDs that are sequential integers vs UUIDs vs composite\n4. **Validate relationships**: Check that FK values actually exist in the referenced dimension's PK\n\n## Gotchas\n\n- **Star schema is mandatory.** DAX is optimized for star schema. Flat\u002Fdenormalized tables work but give poor performance and confuse AI tools. If the lakehouse has a single flat table, the agent should recommend splitting it into fact + dimensions (but not do it automatically).\n- **Partitions must use Power Query `m` with `mode: directQuery`.** Do NOT use `entity` partitions, `expressionSource: DatabaseQuery`, or `mode: directLake` — those all fail when deploying via the REST API. The correct pattern is a Power Query `Sql.Database()` expression pointing to the lakehouse SQL analytics endpoint. See the table template above.\n- **The model needs a `dataSource` block.** Without it, the partition's `Sql.Database()` call has no endpoint. Fetch the SQL analytics endpoint from `GET \u002Fv1\u002Fworkspaces\u002F{id}\u002Flakehouses\u002F{id}` → `properties.sqlEndpointProperties.connectionString`. Use `credential: AuthenticationKind: OAuth2`.\n- **Use the script for SQL endpoint and schema discovery, not MCP.** The MCP server doesn't expose the SQL analytics endpoint and `onelake_get_table` fails for some lakehouses. Use the script's `sql-endpoint` command for the endpoint and `list-tables` command for table schemas. These use the REST API + Delta log reading and are reliable.\n- **`summarizeBy: none` for all non-measure columns.** Only measure columns should have `sum`\u002F`average`. Setting `summarizeBy` on regular columns creates implicit measures which pollute the model.\n- **Use `discourageImplicitMeasures`** in model.tmdl. This forces explicit DAX measures and prevents automatic SUM\u002FCOUNT on numeric columns.\n- **Spanish locale**: Use `culture: es-ES` and `sourceQueryCulture: es-ES` in model.tmdl. Format strings use `.` for thousands and `,` for decimals in Spanish.\n- **Relationship GUIDs**: Generate a unique UUID for each relationship. Use Python's `uuid.uuid4()`.\n- **Column names with spaces or special chars**: Wrap in single quotes in TMDL: `column 'Total Amount'`.\n- **Key columns should be `isHidden` and `isKey`**: Primary keys in dimensions should be hidden from report view and marked as the table key.\n- **One `COUNTROWS` measure per fact table**: Always generate this as the base row-count measure.\n- **The Fabric API requires `definition` as a required field** for semantic model creation (unlike notebooks where it's optional). The `definition\u002F` folder (TMDL) must be included in the payload.\n- **`displayName` must be unique.** Use the script's `list` command to check before deploying. If a model with the same name exists, ask the user — do not overwrite.\n\n## Deployment, Management & Cleanup\n\nUse [.\u002Fscripts\u002Ffabric_semantic_model.py](.\u002Fscripts\u002Ffabric_semantic_model.py) to manage semantic models in Fabric via the REST API. Uses `DefaultAzureCredential` (Azure CLI session).\n\n**Install dependencies** (one-time):\n```bash\npip install azure-identity requests\n```\n\n### Deploy a semantic model\n\nReads a local TMDL folder, base64-encodes each file, and creates a SemanticModel item via `POST \u002Fv1\u002Fworkspaces\u002F{id}\u002FsemanticModels`. Includes the `.platform` and `definition.pbism` files.\n\n```bash\npython scripts\u002Ffabric_semantic_model.py deploy \u003Cworkspace_id> \u003Cmodel_name> \u003Ctmdl_folder_path>\n```\n\n### List semantic models\n\n```bash\npython scripts\u002Ffabric_semantic_model.py list \u003Cworkspace_id> [\u003Cmodel_name>]\n```\n\n### Delete a semantic model\n\n```bash\npython scripts\u002Ffabric_semantic_model.py delete \u003Cworkspace_id> \u003Cmodel_id>\n```\n\n### List tables with schemas\n\nReturns all tables in a lakehouse with their column names and types as JSON. Uses the Fabric REST API to list tables, then reads each table's Delta log to extract the schema. Use it instead of MCP `onelake_get_table` if it fails.\n\n```bash\npython scripts\u002Ffabric_semantic_model.py list-tables \u003Cworkspace_id> \u003Clakehouse_id>\n```\n\n### Get lakehouse SQL analytics endpoint\n\nReturns the SQL analytics endpoint required for the `dataSource` block in model.tmdl. Run this in Phase 1 and use the output when generating TMDL files.\n\n```bash\npython scripts\u002Ffabric_semantic_model.py sql-endpoint \u003Cworkspace_id> \u003Clakehouse_id>\n```\n\n### Deployment gotchas\n\n- The `definition` field is **required** for semantic model creation — unlike notebooks, you cannot create an empty model and update it later.\n- `displayName` must be unique in the workspace.\n- TMDL format is the default and recommended. Use `definition\u002F` folder structure.\n- The API may return 202 for provisioning — the script polls automatically.\n\n## Global Rules\n\n- **TMDL format only.** Generate TMDL files, not model.bim (TMSL). TMDL is the modern format, text-based, and Git-friendly.\n- **Star schema.** Always model as star schema with clear fact and dimension tables.\n- **Explicit measures only.** Use `discourageImplicitMeasures` and create all measures explicitly in DAX.\n- **Business-friendly names.** Tables, columns, and measures should use clear names like \"Total Revenue\" not \"TR_AMT\".\n- **Non-destructive.** Never overwrite an existing semantic model. Deploy with a unique name or ask the user first.\n","# Fabric Semantic Model Creator — Reference\n\nGenerates Power BI semantic models in TMDL format by analyzing lakehouse table schemas and sample data. The agent reasons about table names, column names, data types, cardinality, and sample values to infer the best star-schema model.\n\n## Table Classification Rules\n\nClassify each lakehouse table as **fact** or **dimension** based on these signals:\n\n| Signal | Fact Table | Dimension Table |\n|--------|-----------|-----------------|\n| **Name patterns** | Contains `fact_`, `fct_`, `sales`, `orders`, `transactions`, `events`, `log`, `movements` | Contains `dim_`, `lookup`, `calendar`, `date`, `product`, `customer`, `employee`, `geography`, `category`, `status` |\n| **Column patterns** | Has multiple `_id`\u002F`_key` foreign keys + numeric measure columns (`amount`, `quantity`, `price`, `total`, `count`) | Has a single primary key + descriptive text columns (`name`, `description`, `label`, `title`, `code`) |\n| **Row count** | Typically high (transactions) | Typically low (reference data) |\n| **Numeric density** | Many numeric columns relative to total | Few numeric columns, mostly strings |\n\nIf ambiguous, default to **dimension**. Better to have an extra dimension than miss a fact table's relationships.\n\n## Relationship Inference Rules\n\nDetect relationships by matching column names across tables:\n\n1. **Exact key match**: `orders.customer_id` → `customers.customer_id` (or `customers.id`)\n2. **Name-based match**: column named `{table_name}_id` or `{table_name}_key` in a fact table points to the dimension with that name\n3. **Single-column PK in dimension**: if a dimension has exactly one `_id`\u002F`_key` column and a fact table has a column with the same name, infer the relationship\n4. **Date keys**: columns named `date`, `date_id`, `fecha`, `order_date`, etc. connect to a date\u002Fcalendar dimension\n\nAll relationships are **many-to-one** (fact → dimension) unless the agent detects a bridge\u002Fjunction table (many-to-many).\n\nCross-filter direction: **Single** by default. Only use **Both** for bridge tables.\n\n## DAX Measure Generation Rules\n\nGenerate measures based on column classification:\n\n| Column Pattern | Measure | DAX Expression |\n|---------------|---------|---------------|\n| `amount`, `total`, `revenue`, `sales`, `importe` | Sum | `SUM('{table}'[{column}])` |\n| `quantity`, `qty`, `count`, `cantidad`, `units` | Sum | `SUM('{table}'[{column}])` |\n| `price`, `cost`, `precio`, `coste` | Average | `AVERAGE('{table}'[{column}])` |\n| `discount`, `descuento` | Sum + Average | Both measures |\n| Any numeric in fact table | Row Count | `COUNTROWS('{table}')` (one per fact table) |\n| `id`\u002F`key` in dimension | Distinct Count | `DISTINCTCOUNT('{table}'[{column}])` |\n\nNaming convention: `Total {Column}`, `Avg {Column}`, `# {Table}` (row count), `# Unique {Column}` (distinct count). Use business-friendly names, not technical ones.\n\n## Data Type Mapping\n\nMap lakehouse (Spark) types to TMDL types:\n\n| Spark Type | TMDL `dataType` | Notes |\n|-----------|-----------------|-------|\n| `string` | `string` | |\n| `int`, `integer` | `int64` | TMDL uses `int64` for all integers |\n| `long`, `bigint` | `int64` | |\n| `float` | `double` | TMDL has no float, use double |\n| `double` | `double` | |\n| `decimal` | `decimal` | |\n| `boolean` | `boolean` | |\n| `date` | `dateTime` | TMDL uses `dateTime` for dates |\n| `timestamp` | `dateTime` | |\n\n## TMDL File Structure\n\nThe semantic model is a folder of `.tmdl` files plus metadata:\n\n```\n{model_name}\u002F\n├── definition\u002F\n│   ├── database.tmdl          # Database-level settings\n│   ├── model.tmdl             # Model-level settings (culture, access)\n│   ├── relationships.tmdl     # All relationships\n│   └── tables\u002F\n│       ├── {table1}.tmdl      # Table definition + columns + measures + partition\n│       ├── {table2}.tmdl\n│       └── ...\n└── definition.pbism            # Semantic model settings\n```\n\n### database.tmdl template\n\n```tmdl\ndatabase '{MODEL_NAME}'\n\tcompatibilityLevel: 1604\n```\n\n### model.tmdl template\n\nThe model must include a `dataSource` block pointing to the lakehouse's SQL analytics endpoint. The agent must fetch this endpoint from the Fabric REST API: `GET \u002Fv1\u002Fworkspaces\u002F{id}\u002Flakehouses\u002F{id}` → look for `properties.sqlEndpointProperties.connectionString`.\n\n```tmdl\nmodel Model\n\tculture: es-ES\n\tdefaultPowerBIDataSourceVersion: powerBI_V3\n\tdiscourageImplicitMeasures\n\tsourceQueryCulture: es-ES\n\n\tdataSource '{LAKEHOUSE_NAME}'\n\t\ttype: structured\n\t\tconnectionDetails\n\t\t\tprotocol: tds\n\t\t\taddress\n\t\t\t\tserver: {SQL_ENDPOINT}\n\t\t\t\tdatabase: {LAKEHOUSE_NAME}\n\t\tcredential\n\t\t\tAuthenticationKind: OAuth2\n```\n\n### Table .tmdl template (for each table)\n\nPartitions use Power Query `m` expressions with `mode: directQuery` connecting to the SQL analytics endpoint. Do NOT use `entity` partitions or `expressionSource: DatabaseQuery` — those fail when deploying via REST API.\n\n```tmdl\ntable '{TABLE_NAME}'\n\n\tmeasure '# {TABLE_NAME}' = COUNTROWS('{TABLE_NAME}')\n\t\tformatString: #,##0\n\n\tcolumn {COLUMN_NAME}\n\t\tdataType: {TMDL_TYPE}\n\t\tsourceColumn: {SOURCE_COLUMN}\n\t\tsummarizeBy: {none|sum|average|count}\n\n\tpartition '{TABLE_NAME}' = m\n\t\tmode: directQuery\n\t\tsource =\n\t\t\tlet\n\t\t\t\tSource = Sql.Database(\"{SQL_ENDPOINT}\", \"{LAKEHOUSE_NAME}\"),\n\t\t\t\tdbo_{TABLE_NAME} = Source{{[Schema=\"dbo\",Item=\"{TABLE_NAME}\"]}}[Data]\n\t\t\tin dbo_{TABLE_NAME}\n```\n\n### relationships.tmdl template\n\n```tmdl\nrelationship {GUID}\n\tfromColumn: '{FACT_TABLE}'.{FK_COLUMN}\n\ttoColumn: '{DIM_TABLE}'.{PK_COLUMN}\n```\n\n### definition.pbism\n\n```json\n{\n  \"version\": \"4.0\",\n  \"settings\": {}\n}\n```\n\n## Sample Data Analysis\n\nWhen classifying tables and inferring relationships, analyze sample data (first 100 rows) to:\n\n1. **Confirm cardinality**: A column with 10 distinct values in 10000 rows is likely a FK to a dimension\n2. **Detect date formats**: Sample values reveal if a string column is actually a date\n3. **Detect key patterns**: IDs that are sequential integers vs UUIDs vs composite\n4. **Validate relationships**: Check that FK values actually exist in the referenced dimension's PK\n\n## Gotchas\n\n- **Star schema is mandatory.** DAX is optimized for star schema. Flat\u002Fdenormalized tables work but give poor performance and confuse AI tools. If the lakehouse has a single flat table, the agent should recommend splitting it into fact + dimensions (but not do it automatically).\n- **Partitions must use Power Query `m` with `mode: directQuery`.** Do NOT use `entity` partitions, `expressionSource: DatabaseQuery`, or `mode: directLake` — those all fail when deploying via the REST API. The correct pattern is a Power Query `Sql.Database()` expression pointing to the lakehouse SQL analytics endpoint. See the table template above.\n- **The model needs a `dataSource` block.** Without it, the partition's `Sql.Database()` call has no endpoint. Fetch the SQL analytics endpoint from `GET \u002Fv1\u002Fworkspaces\u002F{id}\u002Flakehouses\u002F{id}` → `properties.sqlEndpointProperties.connectionString`. Use `credential: AuthenticationKind: OAuth2`.\n- **Use the script for SQL endpoint and schema discovery, not MCP.** The MCP server doesn't expose the SQL analytics endpoint and `onelake_get_table` fails for some lakehouses. Use the script's `sql-endpoint` command for the endpoint and `list-tables` command for table schemas. These use the REST API + Delta log reading and are reliable.\n- **`summarizeBy: none` for all non-measure columns.** Only measure columns should have `sum`\u002F`average`. Setting `summarizeBy` on regular columns creates implicit measures which pollute the model.\n- **Use `discourageImplicitMeasures`** in model.tmdl. This forces explicit DAX measures and prevents automatic SUM\u002FCOUNT on numeric columns.\n- **Spanish locale**: Use `culture: es-ES` and `sourceQueryCulture: es-ES` in model.tmdl. Format strings use `.` for thousands and `,` for decimals in Spanish.\n- **Relationship GUIDs**: Generate a unique UUID for each relationship. Use Python's `uuid.uuid4()`.\n- **Column names with spaces or special chars**: Wrap in single quotes in TMDL: `column 'Total Amount'`.\n- **Key columns should be `isHidden` and `isKey`**: Primary keys in dimensions should be hidden from report view and marked as the table key.\n- **One `COUNTROWS` measure per fact table**: Always generate this as the base row-count measure.\n- **The Fabric API requires `definition` as a required field** for semantic model creation (unlike notebooks where it's optional). The `definition\u002F` folder (TMDL) must be included in the payload.\n- **`displayName` must be unique.** Use the script's `list` command to check before deploying. If a model with the same name exists, ask the user — do not overwrite.\n\n## Deployment, Management & Cleanup\n\nUse [.\u002Fscripts\u002Ffabric_semantic_model.py](.\u002Fscripts\u002Ffabric_semantic_model.py) to manage semantic models in Fabric via the REST API. Uses `DefaultAzureCredential` (Azure CLI session).\n\n**Install dependencies** (one-time):\n```bash\npip install azure-identity requests\n```\n\n### Deploy a semantic model\n\nReads a local TMDL folder, base64-encodes each file, and creates a SemanticModel item via `POST \u002Fv1\u002Fworkspaces\u002F{id}\u002FsemanticModels`. Includes the `.platform` and `definition.pbism` files.\n\n```bash\npython scripts\u002Ffabric_semantic_model.py deploy \u003Cworkspace_id> \u003Cmodel_name> \u003Ctmdl_folder_path>\n```\n\n### List semantic models\n\n```bash\npython scripts\u002Ffabric_semantic_model.py list \u003Cworkspace_id> [\u003Cmodel_name>]\n```\n\n### Delete a semantic model\n\n```bash\npython scripts\u002Ffabric_semantic_model.py delete \u003Cworkspace_id> \u003Cmodel_id>\n```\n\n### List tables with schemas\n\nReturns all tables in a lakehouse with their column names and types as JSON. Uses the Fabric REST API to list tables, then reads each table's Delta log to extract the schema. Use it instead of MCP `onelake_get_table` if it fails.\n\n```bash\npython scripts\u002Ffabric_semantic_model.py list-tables \u003Cworkspace_id> \u003Clakehouse_id>\n```\n\n### Get lakehouse SQL analytics endpoint\n\nReturns the SQL analytics endpoint required for the `dataSource` block in model.tmdl. Run this in Phase 1 and use the output when generating TMDL files.\n\n```bash\npython scripts\u002Ffabric_semantic_model.py sql-endpoint \u003Cworkspace_id> \u003Clakehouse_id>\n```\n\n### Deployment gotchas\n\n- The `definition` field is **required** for semantic model creation — unlike notebooks, you cannot create an empty model and update it later.\n- `displayName` must be unique in the workspace.\n- TMDL format is the default and recommended. Use `definition\u002F` folder structure.\n- The API may return 202 for provisioning — the script polls automatically.\n\n## Global Rules\n\n- **TMDL format only.** Generate TMDL files, not model.bim (TMSL). TMDL is the modern format, text-based, and Git-friendly.\n- **Star schema.** Always model as star schema with clear fact and dimension tables.\n- **Explicit measures only.** Use `discourageImplicitMeasures` and create all measures explicitly in DAX.\n- **Business-friendly names.** Tables, columns, and measures should use clear names like \"Total Revenue\" not \"TR_AMT\".\n- **Non-destructive.** Never overwrite an existing semantic model. Deploy with a unique name or ask the user first.\n",{"name":5,"description":7,"compatibility":56},"Requires the Fabric MCP Server VS Code extension for table discovery. Generates TMDL files deployable to Microsoft Fabric via REST API.","main","a54dec65de5a1d2a62bd5cbd9e5003adca5f5a84",".github\u002Fskills\u002Ffabric-semantic-model",1,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fgh-copilot-fabric-agents","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-06-04 21:31:34",{"source":8,"skillName":5,"commands":67,"prompt":77,"zipAvailable":78},[68,71,74],{"tool":69,"command":70},"npx","npx skills add microsoft\u002Fgh-copilot-fabric-agents --skill fabric-semantic-model",{"tool":72,"command":73},"bunx","bunx skills add microsoft\u002Fgh-copilot-fabric-agents --skill fabric-semantic-model",{"tool":75,"command":76},"pnpm","pnpm dlx skills add microsoft\u002Fgh-copilot-fabric-agents --skill fabric-semantic-model","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fgh-copilot-fabric-agents\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ffabric-semantic-model\u002FSKILL.md",true,[80],{"path":81,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":84,"sourceHtmlUrl":85},"scripts\u002Ffabric_semantic_model.py","SCRIPT","脚本",12209,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fgh-copilot-fabric-agents\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ffabric-semantic-model\u002Fscripts\u002Ffabric_semantic_model.py",[87,102,119,137],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":97,"publishedAt":51},"01M69BP4V2GV4WZVHWX5A65QEW","fabric-synthetic-data","Generate and upload synthetic data to Microsoft Fabric lakehouse tables. Covers star-schema generation, realistic fake data (names, dates, IDs, transactions), configurable row counts, referential integrity between tables, Parquet export, and OneLake upload. Use when: synthetic data, test data, fake data, sample data, generate tables, populate lakehouse, seed data, mock data.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fgh-copilot-fabric-agents\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ffabric-synthetic-data\u002FSKILL.md",[93,94,95,96],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":27,"categoryName":28,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":30,"categoryName":31,"taxonomyType":32,"taxonomyTypeDesc":33},{"categoryNo":35,"categoryName":36,"taxonomyType":32,"taxonomyTypeDesc":33},[98,38,99,40,100,42,101,9,44,48,49,50],"fabric synthetic data","synthetic data","python","test",{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":109,"publishedAt":51},"01M69BNXPJX1D29F4SAD54K1HZ","fabric-optimization-review","Review and optimize data storage, data models, and semantic models in Microsoft Fabric lakehouses. Covers Delta table optimization (V-Order, Z-Order, compaction, partitioning), data model anti-pattern detection, semantic model DAX review, relationship optimization, AI\u002Fagentic readiness (descriptions, synonyms, linguistic schema, display folders), workspace audit (Fabric best practices, dimensional modeling, Direct Lake), and actionable recommendation reports. Use when: optimization, performance, review, tuning, best practices, V-Order, Z-Order, partitioning, compaction, DAX optimization, data model review, AI readiness, agentic, NLQ, Copilot, natural language, workspace audit, Direct Lake, dimensional modeling, audit.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fgh-copilot-fabric-agents\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ffabric-optimization-review\u002FSKILL.md",[108],{"categoryNo":27,"categoryName":28,"taxonomyType":21,"taxonomyTypeDesc":22},[110,38,111,42,112,9,43,113,114,44,115,49,116,117,40,100,118],"fabric optimization review","review","storage","dax optimization","copilot","pattern detection","best practices","performance","agentic",{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":129,"publishedAt":51},"01M69BNSNSETNDE2R5AEQAGZVC","fabric-metadata-creation","Create reviewable metadata proposals for Microsoft Fabric lakehouse tables and semantic models. Covers schema analysis, concise technical and business descriptions, glossary terms, classifications, Purview-like sensitivity label proposals, PII and sensitive data detection, relationship and lineage hints, data quality rules, CDE candidates, data products, JSON\u002FPDF output, and steward review questions. Use when: metadata creation, data catalog, Purview mapping, glossary inference, data classification, sensitivity labels, stewardship review, governance metadata.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fgh-copilot-fabric-agents\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ffabric-metadata-creation\u002FSKILL.md",[125,128],{"categoryNo":126,"categoryName":127,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000002","文档处理",{"categoryNo":27,"categoryName":28,"taxonomyType":21,"taxonomyTypeDesc":22},[130,38,131,132,40,111,100,41,42,9,133,44,134,135,136,47,49,50],"fabric metadata creation","governance","PDF","identity","purview","azure","data catalog",{"skillNo":138,"name":139,"nameZh":6,"description":140,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":141,"categories":142,"keywords":145,"publishedAt":51},"01M69BNNR7HC8MMMB1W3DS371C","fabric-data-cleaner","Algorithm reference and self-contained PySpark notebook templates for cleaning Microsoft Fabric lakehouse tables. Covers profiling, duplicate detection, null analysis, type validation, statistics, IQR outlier detection, date format validation, Spanish DNI\u002FNIE checksum validation, and email\u002Fphone format checks. Each notebook can be uploaded and run independently in Fabric.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fgh-copilot-fabric-agents\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ffabric-data-cleaner\u002FSKILL.md",[143,144],{"categoryNo":27,"categoryName":28,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":35,"categoryName":36,"taxonomyType":32,"taxonomyTypeDesc":33},[146,147,38,44,148,149,9,42,150,49,50,40,151],"fabric data cleaner","fabric data","pyspark","vscode","validation","run"]