[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M69BP4V2GV4WZVHWX5A65QEW":3,"skill-same:01M69BP4V2GV4WZVHWX5A65QEW":87},{"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":34,"publishedAt":46,"linkOnly":47,"markdownContent":48,"markdownBody":49,"frontMatter":50,"refName":52,"commitSha":53,"skillDirectory":54,"forksCount":55,"repositoryHtmlUrl":56,"repositoryHomepageUrl":6,"ownerHtmlUrl":57,"ownerBlogUrl":58,"ownerDescription":59,"updatedAt":60,"install":61,"resources":74},"01M69BP4V2GV4WZVHWX5A65QEW","fabric-synthetic-data",null,"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.","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-synthetic-data\u002FSKILL.md",[18,23,26,31],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":27,"categoryName":28,"taxonomyType":29,"taxonomyTypeDesc":30},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",{"categoryNo":32,"categoryName":33,"taxonomyType":29,"taxonomyTypeDesc":30},"01JBSEEDCAT000000000000033","数据分析师",[35,36,37,38,39,40,41,9,42,43,44,45],"synthetic data","fabric","fabric synthetic data","MCP","python","mcp server","test","microsoft fabric","generate","code","lakehouse","2026-11-10 10:12:30",false,"---\nname: fabric-synthetic-data\ndescription: \"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.\"\ncompatibility: \"Requires the Fabric MCP Server VS Code extension for workspace discovery. Uses Python with pandas and pyarrow for local data generation. Upload via OneLake MCP + Fabric REST API.\"\n---\n\n# Fabric Synthetic Data Generator — Reference\n\nGenerates realistic synthetic data locally as Parquet files, then uploads them to a Fabric lakehouse as Delta tables. Designed for populating test\u002Fdev lakehouses with star-schema-compatible data.\n\n## Data Domain Templates\n\nThe agent should ask the user what domain they want. Common domains and their table structures:\n\n### Retail \u002F E-commerce\n| Table | Type | Key Columns | Sample Columns |\n|-------|------|-------------|----------------|\n| customers | dim | customer_id | name, email, phone, city, country, registration_date |\n| products | dim | product_id | name, category, brand, price, cost |\n| stores | dim | store_id | name, city, country, opening_date |\n| dates | dim | date_id | date, year, quarter, month, month_name, day, day_of_week, is_weekend |\n| orders | fact | order_id | customer_id, store_id, date_id, total_amount, discount, tax |\n| order_lines | fact | order_line_id | order_id, product_id, quantity, unit_price, line_total |\n\n### Healthcare\n| Table | Type | Key Columns | Sample Columns |\n|-------|------|-------------|----------------|\n| patients | dim | patient_id | name, dni, birth_date, gender, city, phone |\n| doctors | dim | doctor_id | name, speciality, hospital_id |\n| hospitals | dim | hospital_id | name, city, beds, founded_date |\n| visits | fact | visit_id | patient_id, doctor_id, hospital_id, visit_date, diagnosis_code, cost |\n\n### Airlines (like your existing data)\n| Table | Type | Key Columns | Sample Columns |\n|-------|------|-------------|----------------|\n| airlines | dim | airline_id | name, code, country |\n| airports | dim | airport_id | name, code, city, country, latitude, longitude |\n| aircraft | dim | aircraft_id | model, manufacturer, capacity, airline_id |\n| passengers | dim | passenger_id | name, email, phone, passport, nationality |\n| flights | fact | flight_id | airline_id, aircraft_id, origin_airport_id, dest_airport_id, departure_date, arrival_date, status, delay_minutes |\n| bookings | fact | booking_id | passenger_id, flight_id, booking_date, seat, class, price |\n\n### Citizen Incidents (Smart City \u002F Municipal)\n| Table | Type | Key Columns | Sample Columns |\n|-------|------|-------------|----------------|\n| citizens | dim | citizen_id | name, dni, email, phone, birth_date, address, city, postal_code, registration_date |\n| streets | dim | street_id | street_name, street_type, district, neighborhood, postal_code, city, latitude, longitude |\n| incident_types | dim | incident_type_id | name, category, default_priority_id, sla_hours |\n| priorities | dim | priority_id | name, level, max_resolution_hours, color |\n| statuses | dim | status_id | name, is_final, sort_order |\n| departments | dim | department_id | name, manager_name, phone, email |\n| technicians | dim | technician_id | name, dni, department_id, role, hire_date, phone |\n| dates | dim | date_id | date, year, quarter, month, month_name, day, day_of_week, is_weekend, is_holiday |\n| incidents | fact | incident_id | citizen_id, street_id, incident_type_id, priority_id, status_id, department_id, assigned_technician_id, report_date_id, resolution_date_id, description, latitude, longitude, channel, resolution_time_hours, citizen_satisfaction, cost |\n| incident_updates | fact | update_id | incident_id, technician_id, update_date_id, previous_status_id, new_status_id, comment |\n\n### Custom\nThe user describes their tables and the agent designs the schema.\n\n## Questions to Ask the User\n\nBefore generating data, the agent must gather:\n\n1. **Domain**: What kind of data? (retail, healthcare, airlines, HR, finance, or custom)\n2. **Tables**: Which tables to generate? (all from template, or pick specific ones)\n3. **Volume**: How many rows per table? Suggest defaults:\n   - Dimensions: 100-10,000 rows\n   - Facts: 10,000-1,000,000 rows\n   - Date dimension: auto-calculated from date range\n4. **Date range**: What time period? (e.g., 2020-2024). Affects date dimension and fact table timestamps.\n5. **Locale**: Spanish (DNIs, Spanish names, phone +34) or international?\n6. **Target lakehouse**: Which workspace and lakehouse to upload to?\n7. **Referential integrity**: Should FK values always reference valid PKs? (default: yes)\n\n## Data Generation Rules\n\n### Real-Time-Friendly Schema Design\n\nBecause the agent may later be asked to deploy a real-time streaming notebook (see\n\"Real-Time Streaming (Optional Follow-Up)\"), **every schema must be designed from\nthe start so it can be streamed event-by-event without rework.** Apply these rules\nduring Phase 2 (schema design), not as an afterthought:\n\n1. **Pick a clear \"stream-able\" fact.** At least one fact table must represent a\n   discrete event that could plausibly happen in real time (an order placed, an\n   incident reported, a flight departing, a sensor reading, a booking made). If the\n   domain has no such fact, add one. Facts that are periodic aggregates (e.g.\n   `monthly_sales_summary`) are NOT stream-able — do not pick those as the only fact.\n\n2. **Event timestamp column.** Every stream-able fact should have either:\n   - a `report_date_id` \u002F `event_date_id` FK to the date dimension, **and\u002For**\n   - a full-resolution `event_timestamp` (timestamp) column.\n\n   The runtime notebook always injects an `event_timestamp` field into the emitted\n   JSON, so having one in the fact schema too is natural and avoids surprising the\n   downstream consumer.\n\n3. **Separate \"event-creation\" columns from \"event-completion\" columns.** A real-time\n   event is emitted the moment it starts — completion data does not exist yet. Mark\n   the completion columns explicitly in the schema proposal with a **(post-event)**\n   tag so the user understands they will be `NULL` in the stream. Typical examples:\n\n   | Creation-time (always set) | Post-event (often NULL in stream) |\n   |----------------------------|-----------------------------------|\n   | citizen_id, incident_type_id, priority_id, report_date_id, channel, latitude, longitude, description | resolution_date_id, resolution_time_hours, citizen_satisfaction, cost |\n   | customer_id, product_id, store_id, order_date_id, quantity, unit_price | shipped_date_id, delivered_date_id, return_reason, rating |\n   | passenger_id, flight_id, booking_date_id, seat, class, price | check_in_time, boarding_time, satisfaction_score |\n\n   The fact should still include these columns (the static dataset fills them in), but\n   the real-time generator will emit them as `None` most of the time.\n\n4. **Status \u002F lifecycle columns.** If the fact has a status FK (`status_id`), the\n   `statuses` dimension must include at least one \"initial\" status (`open`,\n   `pending`, `scheduled`, `booked`) so new events have something valid to point to.\n   Avoid schemas where every status implies the event already finished.\n\n5. **Long-integer primary keys.** Stream-able fact PKs must be `int64` \u002F `long`. The\n   streaming template generates PKs as `int(time.time()*1000)*1000 + counter` which\n   overflows anything smaller. Do NOT use UUID strings or composite PKs for a fact\n   the user might want to stream.\n\n6. **Dimensions must be cacheable in memory.** Keep every dimension that a\n   stream-able fact references under ~50,000 rows. The streaming notebook loads each\n   dim with `.limit(50000).toPandas()`, so huge dims would get silently truncated.\n   If a \"dimension\" is naturally large (e.g. `citizens` = 10M), either (a) cap it at\n   50k for the demo, or (b) warn the user and tell them the stream will only sample\n   the first 50k PKs.\n\n7. **Categorical value lists must be explicit and reusable.** For every categorical\n   column (`channel`, `class`, `category`, `gender`, …), record the **exact** list of\n   allowed values in Phase 2. The streaming notebook's `generate_event()` re-uses\n   the same list via `random.choice([...])`. Ad-hoc categories break parity between\n   the static table and the live stream.\n\n8. **Numeric ranges must be recorded.** Same as categoricals — for every numeric\n   column that isn't a key, record the realistic `(min, max)` range in Phase 2. The\n   streaming notebook re-uses these ranges via `random.uniform(min, max)`.\n\n9. **Avoid \"post-hoc only\" facts.** Do not design a fact table whose rows can only\n   be computed *after* the event (e.g. `customer_lifetime_value_snapshot`,\n   `daily_aggregate`). These have no streaming semantics.\n\nWhen presenting the schema to the user in Phase 2, annotate each fact column with\none of: **(key)**, **(FK → dim)**, **(creation)**, **(post-event)**, **(enum: a\u002Fb\u002Fc)**,\n**(range: min..max)**. This makes it trivial to produce a correct `RECORD_GENERATOR_BODY`\nlater without re-interviewing the user.\n\n### Primary Keys\n- Use sequential integers starting from 1: `1, 2, 3, ...`\n- Date dimension keys use `YYYYMMDD` format: `20240101, 20240102, ...`\n\n### Foreign Keys\n- Randomly sample from the referenced dimension's PK values\n- For time-series facts, distribute dates across the full date range (not uniform — use a slight recent-bias if realistic)\n\n### Realistic Values\n- **Names**: For Spanish locale, generate peninsular Spanish names with two surnames (paterno + materno), e.g., \"Antonio García López\". Use common first names and surnames from Spain (not Latin American). Do NOT use `faker` for Spanish names — it generates Latin American names.\n- **Emails**: Derive from names: `firstname.lastname@domain.com`\n- **Spanish DNIs**: Generate valid DNIs using the mod-23 algorithm (8 digits + computed letter)\n- **Phone numbers**: Spanish format `+34 6XX XXX XXX` (mobile) or `+34 9XX XXX XXX` (landline)\n- **Prices\u002Famounts**: Use `random.uniform()` with realistic ranges, round to 2 decimals\n- **Dates**: Use `pandas.date_range()` for date dimensions, `random.choice()` from date_id list for facts\n- **Categories**: Use realistic category lists (not \"Category A, B, C\")\n\n### Spanish DNI Generation (valid checksums)\n```python\nimport random\n\nDNI_LETTERS = \"TRWAGMYFPDXBNJZSQVHLCKE\"\n\ndef generate_valid_dni():\n    number = random.randint(10000000, 99999999)\n    letter = DNI_LETTERS[number % 23]\n    return f\"{number}{letter}\"\n```\n\n### Date Dimension Generation\n```python\nimport pandas as pd\n\ndef generate_date_dimension(start_date, end_date):\n    dates = pd.date_range(start=start_date, end=end_date, freq='D')\n    df = pd.DataFrame({\n        'date_id': dates.strftime('%Y%m%d').astype(int),\n        'date': dates,\n        'year': dates.year,\n        'quarter': dates.quarter,\n        'month': dates.month,\n        'month_name': dates.strftime('%B'),\n        'day': dates.day,\n        'day_of_week': dates.strftime('%A'),\n        'is_weekend': dates.weekday >= 5,\n    })\n    return df\n```\n\n## Output Format\n\nGenerate data as **Parquet files** (one per table). Save locally to:\n`.\u002Fsynthetic_data\u002F{LAKEHOUSE_NAME}\u002F{TIMESTAMP}\u002F{table_name}.parquet`\n\nUse `pandas` + `pyarrow` for Parquet generation:\n```python\ndf.to_parquet(f\"{output_dir}\u002F{table_name}.parquet\", index=False, engine=\"pyarrow\")\n```\n\n## Dirty Data Generation (Optional)\n\nWhen requested, inject realistic data quality issues into the generated dataset. The user specifies a **dirt percentage** (e.g., 5% = 5% of rows per table are affected). Apply the following contamination types randomly across eligible columns:\n\n### Contamination Types\n\n| Type | Applies To | What It Does |\n|------|-----------|-------------|\n| **Null injection** | Any column | Replace value with `None` \u002F `NaN` |\n| **Empty string** | String columns | Replace value with `\"\"` |\n| **Whitespace-only** | String columns | Replace value with `\"   \"` (spaces) |\n| **Exact duplicate rows** | Any table | Duplicate a random row exactly |\n| **Near-duplicate rows** | Fact tables | Duplicate a row but change one non-key column |\n| **Invalid DNI** | DNI columns | Wrong checksum letter, missing letter, wrong format (e.g., `1234567X` instead of `12345678X`) |\n| **Invalid email** | Email columns | Missing `@`, missing domain, spaces (e.g., `juan garcia@`, `noarroba.com`, `juan @mail .com`) |\n| **Invalid phone** | Phone columns | Wrong digit count, invalid prefix (e.g., `+34 1234`, `612345`, `+33 612345678`) |\n| **Comma decimal** | Numeric columns stored as string | Replace `.` with `,` as decimal separator (e.g., `\"1234,56\"` instead of `1234.56`) |\n| **String in numeric** | Numeric columns stored as string | Replace value with non-numeric text (e.g., `\"N\u002FA\"`, `\"pending\"`, `\"-\"`, `\"#REF!\"`) |\n| **Wrong date format** | Date columns stored as string | Mix formats: some `dd\u002FMM\u002Fyyyy`, some `MM\u002Fdd\u002Fyyyy`, some `yyyy-MM-dd` |\n| **Future\u002Fpast dates** | Date columns | Dates far in the future (2099) or before 1900 |\n| **Leading\u002Ftrailing spaces** | String columns | Add spaces around values (e.g., `\" Madrid \"`) |\n| **Case inconsistency** | String columns | Random uppercase\u002Flowercase (e.g., `\"MADRID\"`, `\"madrid\"`, `\"Madrid\"`) |\n\n### How to Apply Dirt\n\n1. Calculate the number of dirty rows: `dirty_count = int(len(df) * dirt_percentage \u002F 100)`\n2. For each contamination type, randomly select a subset of rows and eligible columns\n3. Distribute contamination types roughly evenly — don't apply all dirt to one column\n4. Exact duplicate injection: append `int(dirty_count * 0.1)` duplicated rows to the table\n5. For numeric columns that need comma decimals or string contamination: convert the column to string type first, then inject the dirty values\n6. Apply dirt AFTER generating clean data — never corrupt the primary keys or foreign keys (that would break referential integrity)\n\n## Real-Time Streaming (Optional Follow-Up)\n\nAfter the static dataset is loaded into the lakehouse, the user can optionally deploy a\n**real-time streaming notebook** that continuously emits synthetic fact records matching\nthe same schema and pushes them to a **Fabric Eventstream** custom endpoint (Event\nHub–compatible). This is useful for demoing real-time analytics, KQL databases,\nActivator alerts, or Power BI direct-lake-on-event.\n\n### Notebook template\n\nUse [.\u002Fnotebooks\u002Frealtime_stream.ipynb](.\u002Fnotebooks\u002Frealtime_stream.ipynb). It is a\ntemplated PySpark notebook with the following placeholders that the agent must fill\nin before deployment:\n\n| Placeholder | Filled by | Meaning |\n|-------------|-----------|---------|\n| `{{EVENTSTREAM_CONNECTION_STRING}}` | user | Full Event Hub connection string of the Eventstream custom endpoint |\n| `{{EVENTSTREAM_ENTITY_PATH}}` | user | Event hub name (e.g. `es_xxx`) |\n| `{{DURATION_MINUTES}}` | user | How long the notebook streams before stopping (e.g. `10`) |\n| `{{EVENTS_PER_SECOND}}` | user | Emission rate (e.g. `5`) |\n| `{{BATCH_SIZE}}` | user | Events per Event Hub batch (default `20`) |\n| `{{FACT_TABLE_NAME}}` | agent | The fact table whose schema is mirrored |\n| `{{LAKEHOUSE_NAME}}` | agent | Display-only label |\n| `{{DIMENSION_TABLES}}` | agent | Python list of dim tables the notebook will cache for FK sampling, e.g. `[\"passengers\",\"airports\"]` |\n| `{{PK_COLUMN}}` | agent | Primary key column of the fact table (e.g. `flight_id`) |\n| `{{RECORD_GENERATOR_BODY}}` | agent | Python dict body that builds one event from the fact schema (see rules below) |\n\n### How the notebook works\n\n1. Installs `azure-eventhub` via `%pip install`.\n2. Loads every dimension listed in `DIMENSION_TABLES` into an in-memory list of dicts\n   (`dim_cache[table_name]`) so FKs and categorical values can be sampled fast.\n3. Calls `generate_event()` (whose body the agent filled in) on each tick.\n4. Sends events in batches of `BATCH_SIZE` via `EventHubProducerClient` until\n   `DURATION_MINUTES` elapses.\n\n### Rules for `{{RECORD_GENERATOR_BODY}}`\n\nThe agent must generate Python `\"key\": value,` entries (comma-terminated, indented\nwith 8 spaces to match the surrounding dict) for every column in the fact schema\n**except** the PK and `event_timestamp` (those are emitted by the template itself).\n\n> **Note**: `event_timestamp` is an intentional streaming-only field added by the\n> template. It is NOT part of the fact table schema — it exists so downstream\n> Eventstream consumers (KQL DB, Activator, Power BI direct-lake-on-event) have a\n> reliable event time. Do not try to \"match\" the fact schema by removing it.\n\n- **FK columns**: sample from the matching dimension cache:\n  `\"airline_id\": random.choice(dim_cache[\"airlines\"])[\"airline_id\"],`\n- **Date FKs to a date dimension**: for a real-time stream the event is happening\n  **now**, so prefer `int(datetime.now(timezone.utc).strftime(\"%Y%m%d\"))` over sampling\n  from `dim_cache[\"dates\"]`. Only sample from the date dim if the column semantically\n  refers to a past date (e.g. `booking_date_id` on a flight that departs in the future).\n- **Numeric amounts**: `round(random.uniform(low, high), 2)` with realistic ranges.\n- **Categorical strings**: `random.choice([...realistic list...])`.\n- **Status \u002F enum columns**: match the exact value set used in the static data. For a\n  new event, default to the \"open \u002F in progress \u002F pending\" status rather than a\n  terminal one.\n- **\"Post-event\" columns must default to `None`.** Any column that is only populated\n  *after* the event completes — e.g. `resolution_date_id`, `resolution_time_hours`,\n  `citizen_satisfaction`, `cost`, `delay_minutes`, `actual_arrival`, `rating` — should\n  be `None` for a freshly-emitted event (or `None` ~80% of the time with a realistic\n  value ~20% of the time to simulate late-arriving completions). Do NOT fill these\n  with random values for new events — it breaks the \"live stream\" semantics.\n- **Free-form timestamps** inside the event (departure, resolution, etc.): derive from\n  `datetime.now(timezone.utc)` with small random offsets — never use static past dates.\n- **Type drift from dirty data is expected.** If Phase 4 injected nulls into a long\n  column, pandas converts it to `float64`\u002F`double` in the stored Delta table. The\n  streaming generator should still emit the **semantically correct** type (integer for\n  IDs, `None` for unknown) — Spark\u002FEventstream will coerce. Do not try to emit floats\n  just because the stored column is `double`.\n- Do NOT overwrite the template's `{{PK_COLUMN}}` entry or `event_timestamp`.\n\n### Fact table selection\n\n- If the dataset has exactly one fact table, use it.\n- If there are multiple, ask the user which one to stream. Pick the one with the most\n  time-oriented semantics (e.g. `orders`, `incidents`, `flights`, `bookings`).\n- Only one fact table per notebook. If the user wants multiple streams, deploy multiple\n  notebooks (one per fact).\n\n### Parameters to ask the user\n\n1. **Eventstream connection string** (paste from Fabric custom endpoint)\n2. **Event hub name** (from the same endpoint panel)\n3. **Duration in minutes** (default: 10)\n4. **Events per second** (default: 5; cap around 50 for a single notebook)\n5. **Batch size** (default: 20)\n6. **Fact table to stream** (if more than one fact exists)\n\n### Deployment\n\nReuse the existing script commands — no new commands are needed:\n\n1. Fill placeholders in a local copy of `realtime_stream.ipynb` under\n   `.\u002Fsynthetic_data\u002F{LAKEHOUSE_NAME}\u002F{TIMESTAMP}\u002Frealtime_stream.ipynb`\n2. `deploy-notebook \u003Cworkspace_id> \u003Clakehouse_id> \u003Cnotebook_name> \u003Cipynb_path>`\n3. Do **not** auto-run the notebook. The user may want to configure the Eventstream\n   side first, or run it manually from Fabric when ready. Report the notebook URL \u002F\n   id and let the user trigger it.\n4. The user runs the notebook from Fabric when their Eventstream is ready. It will\n   self-terminate after `DURATION_MINUTES`.\n\n## Upload Flow\n\nThe upload to Fabric is a two-step process per table. There are **two paths** depending on whether the lakehouse has schemas enabled.\n\n### Standard path (schemas NOT enabled)\n\n1. **Upload Parquet to OneLake `Files\u002F`**: Use the script's `upload` command\n2. **Load as Delta table**: Use the script's `load-table` command\n\n### Schemas-enabled path (Load Table API fails)\n\nWhen a lakehouse has schemas enabled, the Load Table API returns an error. Use the notebook-based approach instead:\n\n1. **Upload Parquet to OneLake `Files\u002F`**: Same `upload` command\n2. **Generate a load notebook**: Use `load-via-notebook` — creates a PySpark `.ipynb` that reads all Parquet files from `Files\u002Fsynthetic_data\u002F` and writes them as Delta tables via `spark.write`\n3. **Deploy the notebook**: Use `deploy-notebook` — uploads to Fabric with lakehouse binding\n4. **Run the notebook**: Use `run-notebook` — triggers execution on the Fabric Spark cluster\n5. **Poll status**: Use `status-notebook` — wait until completed or failed\n6. **Delete the notebook**: Use `delete-notebook` — clean up after successful run\n\n**How to detect schemas-enabled**: If `load-table` fails with an error mentioning schemas, switch to the notebook path. Do NOT improvise — use the script commands above.\n\n## Script — fabric_synthetic_data.py\n\nUse [.\u002Fscripts\u002Ffabric_synthetic_data.py](.\u002Fscripts\u002Ffabric_synthetic_data.py) to upload and load data. Uses `DefaultAzureCredential` (Azure CLI).\n\n**Install dependencies** (one-time):\n```bash\npip install azure-identity requests pandas pyarrow faker\n```\n\n### Upload a Parquet file to OneLake Files\u002F\n\n```bash\npython scripts\u002Ffabric_synthetic_data.py upload \u003Cworkspace_id> \u003Clakehouse_id> \u003Clocal_parquet_path> \u003Cremote_filename>\n```\n\nUploads to `Files\u002Fsynthetic_data\u002F{remote_filename}` in the lakehouse.\n\n### Load a file as a Delta table (standard path)\n\n```bash\npython scripts\u002Ffabric_synthetic_data.py load-table \u003Cworkspace_id> \u003Clakehouse_id> \u003Ctable_name> \u003Crelative_path>\n```\n\nCalls the Load Table API. If this fails due to schemas being enabled, switch to the notebook path below.\n\n### Generate a load notebook (schemas-enabled path)\n\n```bash\npython scripts\u002Ffabric_synthetic_data.py load-via-notebook \u003Cworkspace_id> \u003Clakehouse_id> \u003Cparquet_dir> \u003Coutput_notebook.ipynb>\n```\n\nScans `\u003Cparquet_dir>` for `.parquet` files and generates a single PySpark notebook that loads all of them as Delta tables. The notebook includes lakehouse binding metadata.\n\n### Deploy a load notebook to Fabric\n\n```bash\npython scripts\u002Ffabric_synthetic_data.py deploy-notebook \u003Cworkspace_id> \u003Clakehouse_id> \u003Cnotebook_name> \u003Cipynb_path>\n```\n\nUploads the notebook with lakehouse binding so `spark.write.saveAsTable()` works.\n\n### Run a notebook\n\n```bash\npython scripts\u002Ffabric_synthetic_data.py run-notebook \u003Cworkspace_id> \u003Cnotebook_id>\n```\n\n### Check notebook job status\n\n```bash\npython scripts\u002Ffabric_synthetic_data.py status-notebook \u003Cworkspace_id> \u003Cnotebook_id> \u003Cjob_instance_id>\n```\n\n### Delete a notebook\n\n```bash\npython scripts\u002Ffabric_synthetic_data.py delete-notebook \u003Cworkspace_id> \u003Cnotebook_id>\n```\n\n### List existing tables\n\n```bash\npython scripts\u002Ffabric_synthetic_data.py list-tables \u003Cworkspace_id> \u003Clakehouse_id>\n```\n\n### Delete a table\n\n```bash\npython scripts\u002Ffabric_synthetic_data.py delete-table \u003Cworkspace_id> \u003Clakehouse_id> \u003Ctable_name>\n```\n\n## Gotchas\n\n- **Schemas-enabled lakehouses break the Load Table API.** If `load-table` fails, the lakehouse likely has schemas enabled. Switch to the notebook path: `load-via-notebook` → `deploy-notebook` → `run-notebook` → `status-notebook` → `delete-notebook`. Do NOT try to improvise or create notebooks manually — use the script commands.\n- **`TIMESTAMP_NTZ` is not supported by Fabric Delta.** Pandas `datetime64` columns get written to Parquet as `TIMESTAMP_NTZ` which Fabric rejects with `Columns of the specified data types are not supported`. The `load-via-notebook` script handles this automatically by casting `TIMESTAMP_NTZ` columns to `DATE` before writing. If generating data manually, use `.dt.date` to convert datetime to date objects before saving Parquet.\n- **`list-tables` and `load-table` both fail on schemas-enabled lakehouses.** The entire Lakehouse Tables REST API is unsupported. Use MCP `onelake_list_tables` for listing and the notebook path for loading.\n- **Upload then load — two steps.** You cannot write directly to `Tables\u002F`. Upload Parquet to `Files\u002F` first, then load as Delta.\n- **Load Table `relativePath` must start with `Files\u002F`** and use the pattern `Files\u002Fpath\u002Fto\u002Ffile.parquet`. No leading slash.\n- **Table names must match `^[a-zA-Z_][a-zA-Z0-9_]{0,255}$`**. No spaces, no dashes, no special chars.\n- **`faker` locale for Spanish is `es_ES`**. Use `Faker('es_ES')` for Spanish names, addresses, etc.\n- **Generate dimensions before facts** so FK values can reference valid PKs.\n- **Date dimension should cover the full range** of dates in fact tables. Generate it first, then sample date_ids for facts.\n- **Parquet preserves types.** Use proper pandas dtypes: `int64` for IDs, `float64` for amounts, `datetime64` for dates, `object` for strings.\n- **Load Table API is async (202).** The script polls automatically.\n- **OneLake upload has a file size limit.** For large datasets (>100MB), consider splitting into multiple Parquet files and using `pathType: Folder`.\n- **Real-time notebook needs `%pip install azure-eventhub`.** Fabric Spark pools don't ship it by default. The template already installs it — do not remove the magic.\n- **Eventstream connection string must include an `EntityPath` or the event hub name must be passed separately.** The template passes both and uses `eventhub_name=EVENTSTREAM_ENTITY_PATH` explicitly; this works whether or not `EntityPath` is in the connection string.\n- **Don't auto-run the real-time notebook.** The user usually wants to configure consumers on the Eventstream side (KQL DB, Activator, Power BI) before events start flowing. Deploy only — let the user trigger it.\n\n## Global Rules\n\n- **Generate dimensions first, facts second.** Facts reference dimensions via FKs.\n- **Always maintain referential integrity.** Every FK value must exist in the referenced dimension.\n- **Use realistic data, not \"test1, test2\".** Use faker for names, realistic ranges for numbers, proper date distributions.\n- **Parquet format only.** No CSV — Parquet preserves types and is faster to load.\n- **Non-destructive by default.** Use `mode: Overwrite` for the specific table, but never delete unrelated tables.\n","# Fabric Synthetic Data Generator — Reference\n\nGenerates realistic synthetic data locally as Parquet files, then uploads them to a Fabric lakehouse as Delta tables. Designed for populating test\u002Fdev lakehouses with star-schema-compatible data.\n\n## Data Domain Templates\n\nThe agent should ask the user what domain they want. Common domains and their table structures:\n\n### Retail \u002F E-commerce\n| Table | Type | Key Columns | Sample Columns |\n|-------|------|-------------|----------------|\n| customers | dim | customer_id | name, email, phone, city, country, registration_date |\n| products | dim | product_id | name, category, brand, price, cost |\n| stores | dim | store_id | name, city, country, opening_date |\n| dates | dim | date_id | date, year, quarter, month, month_name, day, day_of_week, is_weekend |\n| orders | fact | order_id | customer_id, store_id, date_id, total_amount, discount, tax |\n| order_lines | fact | order_line_id | order_id, product_id, quantity, unit_price, line_total |\n\n### Healthcare\n| Table | Type | Key Columns | Sample Columns |\n|-------|------|-------------|----------------|\n| patients | dim | patient_id | name, dni, birth_date, gender, city, phone |\n| doctors | dim | doctor_id | name, speciality, hospital_id |\n| hospitals | dim | hospital_id | name, city, beds, founded_date |\n| visits | fact | visit_id | patient_id, doctor_id, hospital_id, visit_date, diagnosis_code, cost |\n\n### Airlines (like your existing data)\n| Table | Type | Key Columns | Sample Columns |\n|-------|------|-------------|----------------|\n| airlines | dim | airline_id | name, code, country |\n| airports | dim | airport_id | name, code, city, country, latitude, longitude |\n| aircraft | dim | aircraft_id | model, manufacturer, capacity, airline_id |\n| passengers | dim | passenger_id | name, email, phone, passport, nationality |\n| flights | fact | flight_id | airline_id, aircraft_id, origin_airport_id, dest_airport_id, departure_date, arrival_date, status, delay_minutes |\n| bookings | fact | booking_id | passenger_id, flight_id, booking_date, seat, class, price |\n\n### Citizen Incidents (Smart City \u002F Municipal)\n| Table | Type | Key Columns | Sample Columns |\n|-------|------|-------------|----------------|\n| citizens | dim | citizen_id | name, dni, email, phone, birth_date, address, city, postal_code, registration_date |\n| streets | dim | street_id | street_name, street_type, district, neighborhood, postal_code, city, latitude, longitude |\n| incident_types | dim | incident_type_id | name, category, default_priority_id, sla_hours |\n| priorities | dim | priority_id | name, level, max_resolution_hours, color |\n| statuses | dim | status_id | name, is_final, sort_order |\n| departments | dim | department_id | name, manager_name, phone, email |\n| technicians | dim | technician_id | name, dni, department_id, role, hire_date, phone |\n| dates | dim | date_id | date, year, quarter, month, month_name, day, day_of_week, is_weekend, is_holiday |\n| incidents | fact | incident_id | citizen_id, street_id, incident_type_id, priority_id, status_id, department_id, assigned_technician_id, report_date_id, resolution_date_id, description, latitude, longitude, channel, resolution_time_hours, citizen_satisfaction, cost |\n| incident_updates | fact | update_id | incident_id, technician_id, update_date_id, previous_status_id, new_status_id, comment |\n\n### Custom\nThe user describes their tables and the agent designs the schema.\n\n## Questions to Ask the User\n\nBefore generating data, the agent must gather:\n\n1. **Domain**: What kind of data? (retail, healthcare, airlines, HR, finance, or custom)\n2. **Tables**: Which tables to generate? (all from template, or pick specific ones)\n3. **Volume**: How many rows per table? Suggest defaults:\n   - Dimensions: 100-10,000 rows\n   - Facts: 10,000-1,000,000 rows\n   - Date dimension: auto-calculated from date range\n4. **Date range**: What time period? (e.g., 2020-2024). Affects date dimension and fact table timestamps.\n5. **Locale**: Spanish (DNIs, Spanish names, phone +34) or international?\n6. **Target lakehouse**: Which workspace and lakehouse to upload to?\n7. **Referential integrity**: Should FK values always reference valid PKs? (default: yes)\n\n## Data Generation Rules\n\n### Real-Time-Friendly Schema Design\n\nBecause the agent may later be asked to deploy a real-time streaming notebook (see\n\"Real-Time Streaming (Optional Follow-Up)\"), **every schema must be designed from\nthe start so it can be streamed event-by-event without rework.** Apply these rules\nduring Phase 2 (schema design), not as an afterthought:\n\n1. **Pick a clear \"stream-able\" fact.** At least one fact table must represent a\n   discrete event that could plausibly happen in real time (an order placed, an\n   incident reported, a flight departing, a sensor reading, a booking made). If the\n   domain has no such fact, add one. Facts that are periodic aggregates (e.g.\n   `monthly_sales_summary`) are NOT stream-able — do not pick those as the only fact.\n\n2. **Event timestamp column.** Every stream-able fact should have either:\n   - a `report_date_id` \u002F `event_date_id` FK to the date dimension, **and\u002For**\n   - a full-resolution `event_timestamp` (timestamp) column.\n\n   The runtime notebook always injects an `event_timestamp` field into the emitted\n   JSON, so having one in the fact schema too is natural and avoids surprising the\n   downstream consumer.\n\n3. **Separate \"event-creation\" columns from \"event-completion\" columns.** A real-time\n   event is emitted the moment it starts — completion data does not exist yet. Mark\n   the completion columns explicitly in the schema proposal with a **(post-event)**\n   tag so the user understands they will be `NULL` in the stream. Typical examples:\n\n   | Creation-time (always set) | Post-event (often NULL in stream) |\n   |----------------------------|-----------------------------------|\n   | citizen_id, incident_type_id, priority_id, report_date_id, channel, latitude, longitude, description | resolution_date_id, resolution_time_hours, citizen_satisfaction, cost |\n   | customer_id, product_id, store_id, order_date_id, quantity, unit_price | shipped_date_id, delivered_date_id, return_reason, rating |\n   | passenger_id, flight_id, booking_date_id, seat, class, price | check_in_time, boarding_time, satisfaction_score |\n\n   The fact should still include these columns (the static dataset fills them in), but\n   the real-time generator will emit them as `None` most of the time.\n\n4. **Status \u002F lifecycle columns.** If the fact has a status FK (`status_id`), the\n   `statuses` dimension must include at least one \"initial\" status (`open`,\n   `pending`, `scheduled`, `booked`) so new events have something valid to point to.\n   Avoid schemas where every status implies the event already finished.\n\n5. **Long-integer primary keys.** Stream-able fact PKs must be `int64` \u002F `long`. The\n   streaming template generates PKs as `int(time.time()*1000)*1000 + counter` which\n   overflows anything smaller. Do NOT use UUID strings or composite PKs for a fact\n   the user might want to stream.\n\n6. **Dimensions must be cacheable in memory.** Keep every dimension that a\n   stream-able fact references under ~50,000 rows. The streaming notebook loads each\n   dim with `.limit(50000).toPandas()`, so huge dims would get silently truncated.\n   If a \"dimension\" is naturally large (e.g. `citizens` = 10M), either (a) cap it at\n   50k for the demo, or (b) warn the user and tell them the stream will only sample\n   the first 50k PKs.\n\n7. **Categorical value lists must be explicit and reusable.** For every categorical\n   column (`channel`, `class`, `category`, `gender`, …), record the **exact** list of\n   allowed values in Phase 2. The streaming notebook's `generate_event()` re-uses\n   the same list via `random.choice([...])`. Ad-hoc categories break parity between\n   the static table and the live stream.\n\n8. **Numeric ranges must be recorded.** Same as categoricals — for every numeric\n   column that isn't a key, record the realistic `(min, max)` range in Phase 2. The\n   streaming notebook re-uses these ranges via `random.uniform(min, max)`.\n\n9. **Avoid \"post-hoc only\" facts.** Do not design a fact table whose rows can only\n   be computed *after* the event (e.g. `customer_lifetime_value_snapshot`,\n   `daily_aggregate`). These have no streaming semantics.\n\nWhen presenting the schema to the user in Phase 2, annotate each fact column with\none of: **(key)**, **(FK → dim)**, **(creation)**, **(post-event)**, **(enum: a\u002Fb\u002Fc)**,\n**(range: min..max)**. This makes it trivial to produce a correct `RECORD_GENERATOR_BODY`\nlater without re-interviewing the user.\n\n### Primary Keys\n- Use sequential integers starting from 1: `1, 2, 3, ...`\n- Date dimension keys use `YYYYMMDD` format: `20240101, 20240102, ...`\n\n### Foreign Keys\n- Randomly sample from the referenced dimension's PK values\n- For time-series facts, distribute dates across the full date range (not uniform — use a slight recent-bias if realistic)\n\n### Realistic Values\n- **Names**: For Spanish locale, generate peninsular Spanish names with two surnames (paterno + materno), e.g., \"Antonio García López\". Use common first names and surnames from Spain (not Latin American). Do NOT use `faker` for Spanish names — it generates Latin American names.\n- **Emails**: Derive from names: `firstname.lastname@domain.com`\n- **Spanish DNIs**: Generate valid DNIs using the mod-23 algorithm (8 digits + computed letter)\n- **Phone numbers**: Spanish format `+34 6XX XXX XXX` (mobile) or `+34 9XX XXX XXX` (landline)\n- **Prices\u002Famounts**: Use `random.uniform()` with realistic ranges, round to 2 decimals\n- **Dates**: Use `pandas.date_range()` for date dimensions, `random.choice()` from date_id list for facts\n- **Categories**: Use realistic category lists (not \"Category A, B, C\")\n\n### Spanish DNI Generation (valid checksums)\n```python\nimport random\n\nDNI_LETTERS = \"TRWAGMYFPDXBNJZSQVHLCKE\"\n\ndef generate_valid_dni():\n    number = random.randint(10000000, 99999999)\n    letter = DNI_LETTERS[number % 23]\n    return f\"{number}{letter}\"\n```\n\n### Date Dimension Generation\n```python\nimport pandas as pd\n\ndef generate_date_dimension(start_date, end_date):\n    dates = pd.date_range(start=start_date, end=end_date, freq='D')\n    df = pd.DataFrame({\n        'date_id': dates.strftime('%Y%m%d').astype(int),\n        'date': dates,\n        'year': dates.year,\n        'quarter': dates.quarter,\n        'month': dates.month,\n        'month_name': dates.strftime('%B'),\n        'day': dates.day,\n        'day_of_week': dates.strftime('%A'),\n        'is_weekend': dates.weekday >= 5,\n    })\n    return df\n```\n\n## Output Format\n\nGenerate data as **Parquet files** (one per table). Save locally to:\n`.\u002Fsynthetic_data\u002F{LAKEHOUSE_NAME}\u002F{TIMESTAMP}\u002F{table_name}.parquet`\n\nUse `pandas` + `pyarrow` for Parquet generation:\n```python\ndf.to_parquet(f\"{output_dir}\u002F{table_name}.parquet\", index=False, engine=\"pyarrow\")\n```\n\n## Dirty Data Generation (Optional)\n\nWhen requested, inject realistic data quality issues into the generated dataset. The user specifies a **dirt percentage** (e.g., 5% = 5% of rows per table are affected). Apply the following contamination types randomly across eligible columns:\n\n### Contamination Types\n\n| Type | Applies To | What It Does |\n|------|-----------|-------------|\n| **Null injection** | Any column | Replace value with `None` \u002F `NaN` |\n| **Empty string** | String columns | Replace value with `\"\"` |\n| **Whitespace-only** | String columns | Replace value with `\"   \"` (spaces) |\n| **Exact duplicate rows** | Any table | Duplicate a random row exactly |\n| **Near-duplicate rows** | Fact tables | Duplicate a row but change one non-key column |\n| **Invalid DNI** | DNI columns | Wrong checksum letter, missing letter, wrong format (e.g., `1234567X` instead of `12345678X`) |\n| **Invalid email** | Email columns | Missing `@`, missing domain, spaces (e.g., `juan garcia@`, `noarroba.com`, `juan @mail .com`) |\n| **Invalid phone** | Phone columns | Wrong digit count, invalid prefix (e.g., `+34 1234`, `612345`, `+33 612345678`) |\n| **Comma decimal** | Numeric columns stored as string | Replace `.` with `,` as decimal separator (e.g., `\"1234,56\"` instead of `1234.56`) |\n| **String in numeric** | Numeric columns stored as string | Replace value with non-numeric text (e.g., `\"N\u002FA\"`, `\"pending\"`, `\"-\"`, `\"#REF!\"`) |\n| **Wrong date format** | Date columns stored as string | Mix formats: some `dd\u002FMM\u002Fyyyy`, some `MM\u002Fdd\u002Fyyyy`, some `yyyy-MM-dd` |\n| **Future\u002Fpast dates** | Date columns | Dates far in the future (2099) or before 1900 |\n| **Leading\u002Ftrailing spaces** | String columns | Add spaces around values (e.g., `\" Madrid \"`) |\n| **Case inconsistency** | String columns | Random uppercase\u002Flowercase (e.g., `\"MADRID\"`, `\"madrid\"`, `\"Madrid\"`) |\n\n### How to Apply Dirt\n\n1. Calculate the number of dirty rows: `dirty_count = int(len(df) * dirt_percentage \u002F 100)`\n2. For each contamination type, randomly select a subset of rows and eligible columns\n3. Distribute contamination types roughly evenly — don't apply all dirt to one column\n4. Exact duplicate injection: append `int(dirty_count * 0.1)` duplicated rows to the table\n5. For numeric columns that need comma decimals or string contamination: convert the column to string type first, then inject the dirty values\n6. Apply dirt AFTER generating clean data — never corrupt the primary keys or foreign keys (that would break referential integrity)\n\n## Real-Time Streaming (Optional Follow-Up)\n\nAfter the static dataset is loaded into the lakehouse, the user can optionally deploy a\n**real-time streaming notebook** that continuously emits synthetic fact records matching\nthe same schema and pushes them to a **Fabric Eventstream** custom endpoint (Event\nHub–compatible). This is useful for demoing real-time analytics, KQL databases,\nActivator alerts, or Power BI direct-lake-on-event.\n\n### Notebook template\n\nUse [.\u002Fnotebooks\u002Frealtime_stream.ipynb](.\u002Fnotebooks\u002Frealtime_stream.ipynb). It is a\ntemplated PySpark notebook with the following placeholders that the agent must fill\nin before deployment:\n\n| Placeholder | Filled by | Meaning |\n|-------------|-----------|---------|\n| `{{EVENTSTREAM_CONNECTION_STRING}}` | user | Full Event Hub connection string of the Eventstream custom endpoint |\n| `{{EVENTSTREAM_ENTITY_PATH}}` | user | Event hub name (e.g. `es_xxx`) |\n| `{{DURATION_MINUTES}}` | user | How long the notebook streams before stopping (e.g. `10`) |\n| `{{EVENTS_PER_SECOND}}` | user | Emission rate (e.g. `5`) |\n| `{{BATCH_SIZE}}` | user | Events per Event Hub batch (default `20`) |\n| `{{FACT_TABLE_NAME}}` | agent | The fact table whose schema is mirrored |\n| `{{LAKEHOUSE_NAME}}` | agent | Display-only label |\n| `{{DIMENSION_TABLES}}` | agent | Python list of dim tables the notebook will cache for FK sampling, e.g. `[\"passengers\",\"airports\"]` |\n| `{{PK_COLUMN}}` | agent | Primary key column of the fact table (e.g. `flight_id`) |\n| `{{RECORD_GENERATOR_BODY}}` | agent | Python dict body that builds one event from the fact schema (see rules below) |\n\n### How the notebook works\n\n1. Installs `azure-eventhub` via `%pip install`.\n2. Loads every dimension listed in `DIMENSION_TABLES` into an in-memory list of dicts\n   (`dim_cache[table_name]`) so FKs and categorical values can be sampled fast.\n3. Calls `generate_event()` (whose body the agent filled in) on each tick.\n4. Sends events in batches of `BATCH_SIZE` via `EventHubProducerClient` until\n   `DURATION_MINUTES` elapses.\n\n### Rules for `{{RECORD_GENERATOR_BODY}}`\n\nThe agent must generate Python `\"key\": value,` entries (comma-terminated, indented\nwith 8 spaces to match the surrounding dict) for every column in the fact schema\n**except** the PK and `event_timestamp` (those are emitted by the template itself).\n\n> **Note**: `event_timestamp` is an intentional streaming-only field added by the\n> template. It is NOT part of the fact table schema — it exists so downstream\n> Eventstream consumers (KQL DB, Activator, Power BI direct-lake-on-event) have a\n> reliable event time. Do not try to \"match\" the fact schema by removing it.\n\n- **FK columns**: sample from the matching dimension cache:\n  `\"airline_id\": random.choice(dim_cache[\"airlines\"])[\"airline_id\"],`\n- **Date FKs to a date dimension**: for a real-time stream the event is happening\n  **now**, so prefer `int(datetime.now(timezone.utc).strftime(\"%Y%m%d\"))` over sampling\n  from `dim_cache[\"dates\"]`. Only sample from the date dim if the column semantically\n  refers to a past date (e.g. `booking_date_id` on a flight that departs in the future).\n- **Numeric amounts**: `round(random.uniform(low, high), 2)` with realistic ranges.\n- **Categorical strings**: `random.choice([...realistic list...])`.\n- **Status \u002F enum columns**: match the exact value set used in the static data. For a\n  new event, default to the \"open \u002F in progress \u002F pending\" status rather than a\n  terminal one.\n- **\"Post-event\" columns must default to `None`.** Any column that is only populated\n  *after* the event completes — e.g. `resolution_date_id`, `resolution_time_hours`,\n  `citizen_satisfaction`, `cost`, `delay_minutes`, `actual_arrival`, `rating` — should\n  be `None` for a freshly-emitted event (or `None` ~80% of the time with a realistic\n  value ~20% of the time to simulate late-arriving completions). Do NOT fill these\n  with random values for new events — it breaks the \"live stream\" semantics.\n- **Free-form timestamps** inside the event (departure, resolution, etc.): derive from\n  `datetime.now(timezone.utc)` with small random offsets — never use static past dates.\n- **Type drift from dirty data is expected.** If Phase 4 injected nulls into a long\n  column, pandas converts it to `float64`\u002F`double` in the stored Delta table. The\n  streaming generator should still emit the **semantically correct** type (integer for\n  IDs, `None` for unknown) — Spark\u002FEventstream will coerce. Do not try to emit floats\n  just because the stored column is `double`.\n- Do NOT overwrite the template's `{{PK_COLUMN}}` entry or `event_timestamp`.\n\n### Fact table selection\n\n- If the dataset has exactly one fact table, use it.\n- If there are multiple, ask the user which one to stream. Pick the one with the most\n  time-oriented semantics (e.g. `orders`, `incidents`, `flights`, `bookings`).\n- Only one fact table per notebook. If the user wants multiple streams, deploy multiple\n  notebooks (one per fact).\n\n### Parameters to ask the user\n\n1. **Eventstream connection string** (paste from Fabric custom endpoint)\n2. **Event hub name** (from the same endpoint panel)\n3. **Duration in minutes** (default: 10)\n4. **Events per second** (default: 5; cap around 50 for a single notebook)\n5. **Batch size** (default: 20)\n6. **Fact table to stream** (if more than one fact exists)\n\n### Deployment\n\nReuse the existing script commands — no new commands are needed:\n\n1. Fill placeholders in a local copy of `realtime_stream.ipynb` under\n   `.\u002Fsynthetic_data\u002F{LAKEHOUSE_NAME}\u002F{TIMESTAMP}\u002Frealtime_stream.ipynb`\n2. `deploy-notebook \u003Cworkspace_id> \u003Clakehouse_id> \u003Cnotebook_name> \u003Cipynb_path>`\n3. Do **not** auto-run the notebook. The user may want to configure the Eventstream\n   side first, or run it manually from Fabric when ready. Report the notebook URL \u002F\n   id and let the user trigger it.\n4. The user runs the notebook from Fabric when their Eventstream is ready. It will\n   self-terminate after `DURATION_MINUTES`.\n\n## Upload Flow\n\nThe upload to Fabric is a two-step process per table. There are **two paths** depending on whether the lakehouse has schemas enabled.\n\n### Standard path (schemas NOT enabled)\n\n1. **Upload Parquet to OneLake `Files\u002F`**: Use the script's `upload` command\n2. **Load as Delta table**: Use the script's `load-table` command\n\n### Schemas-enabled path (Load Table API fails)\n\nWhen a lakehouse has schemas enabled, the Load Table API returns an error. Use the notebook-based approach instead:\n\n1. **Upload Parquet to OneLake `Files\u002F`**: Same `upload` command\n2. **Generate a load notebook**: Use `load-via-notebook` — creates a PySpark `.ipynb` that reads all Parquet files from `Files\u002Fsynthetic_data\u002F` and writes them as Delta tables via `spark.write`\n3. **Deploy the notebook**: Use `deploy-notebook` — uploads to Fabric with lakehouse binding\n4. **Run the notebook**: Use `run-notebook` — triggers execution on the Fabric Spark cluster\n5. **Poll status**: Use `status-notebook` — wait until completed or failed\n6. **Delete the notebook**: Use `delete-notebook` — clean up after successful run\n\n**How to detect schemas-enabled**: If `load-table` fails with an error mentioning schemas, switch to the notebook path. Do NOT improvise — use the script commands above.\n\n## Script — fabric_synthetic_data.py\n\nUse [.\u002Fscripts\u002Ffabric_synthetic_data.py](.\u002Fscripts\u002Ffabric_synthetic_data.py) to upload and load data. Uses `DefaultAzureCredential` (Azure CLI).\n\n**Install dependencies** (one-time):\n```bash\npip install azure-identity requests pandas pyarrow faker\n```\n\n### Upload a Parquet file to OneLake Files\u002F\n\n```bash\npython scripts\u002Ffabric_synthetic_data.py upload \u003Cworkspace_id> \u003Clakehouse_id> \u003Clocal_parquet_path> \u003Cremote_filename>\n```\n\nUploads to `Files\u002Fsynthetic_data\u002F{remote_filename}` in the lakehouse.\n\n### Load a file as a Delta table (standard path)\n\n```bash\npython scripts\u002Ffabric_synthetic_data.py load-table \u003Cworkspace_id> \u003Clakehouse_id> \u003Ctable_name> \u003Crelative_path>\n```\n\nCalls the Load Table API. If this fails due to schemas being enabled, switch to the notebook path below.\n\n### Generate a load notebook (schemas-enabled path)\n\n```bash\npython scripts\u002Ffabric_synthetic_data.py load-via-notebook \u003Cworkspace_id> \u003Clakehouse_id> \u003Cparquet_dir> \u003Coutput_notebook.ipynb>\n```\n\nScans `\u003Cparquet_dir>` for `.parquet` files and generates a single PySpark notebook that loads all of them as Delta tables. The notebook includes lakehouse binding metadata.\n\n### Deploy a load notebook to Fabric\n\n```bash\npython scripts\u002Ffabric_synthetic_data.py deploy-notebook \u003Cworkspace_id> \u003Clakehouse_id> \u003Cnotebook_name> \u003Cipynb_path>\n```\n\nUploads the notebook with lakehouse binding so `spark.write.saveAsTable()` works.\n\n### Run a notebook\n\n```bash\npython scripts\u002Ffabric_synthetic_data.py run-notebook \u003Cworkspace_id> \u003Cnotebook_id>\n```\n\n### Check notebook job status\n\n```bash\npython scripts\u002Ffabric_synthetic_data.py status-notebook \u003Cworkspace_id> \u003Cnotebook_id> \u003Cjob_instance_id>\n```\n\n### Delete a notebook\n\n```bash\npython scripts\u002Ffabric_synthetic_data.py delete-notebook \u003Cworkspace_id> \u003Cnotebook_id>\n```\n\n### List existing tables\n\n```bash\npython scripts\u002Ffabric_synthetic_data.py list-tables \u003Cworkspace_id> \u003Clakehouse_id>\n```\n\n### Delete a table\n\n```bash\npython scripts\u002Ffabric_synthetic_data.py delete-table \u003Cworkspace_id> \u003Clakehouse_id> \u003Ctable_name>\n```\n\n## Gotchas\n\n- **Schemas-enabled lakehouses break the Load Table API.** If `load-table` fails, the lakehouse likely has schemas enabled. Switch to the notebook path: `load-via-notebook` → `deploy-notebook` → `run-notebook` → `status-notebook` → `delete-notebook`. Do NOT try to improvise or create notebooks manually — use the script commands.\n- **`TIMESTAMP_NTZ` is not supported by Fabric Delta.** Pandas `datetime64` columns get written to Parquet as `TIMESTAMP_NTZ` which Fabric rejects with `Columns of the specified data types are not supported`. The `load-via-notebook` script handles this automatically by casting `TIMESTAMP_NTZ` columns to `DATE` before writing. If generating data manually, use `.dt.date` to convert datetime to date objects before saving Parquet.\n- **`list-tables` and `load-table` both fail on schemas-enabled lakehouses.** The entire Lakehouse Tables REST API is unsupported. Use MCP `onelake_list_tables` for listing and the notebook path for loading.\n- **Upload then load — two steps.** You cannot write directly to `Tables\u002F`. Upload Parquet to `Files\u002F` first, then load as Delta.\n- **Load Table `relativePath` must start with `Files\u002F`** and use the pattern `Files\u002Fpath\u002Fto\u002Ffile.parquet`. No leading slash.\n- **Table names must match `^[a-zA-Z_][a-zA-Z0-9_]{0,255}$`**. No spaces, no dashes, no special chars.\n- **`faker` locale for Spanish is `es_ES`**. Use `Faker('es_ES')` for Spanish names, addresses, etc.\n- **Generate dimensions before facts** so FK values can reference valid PKs.\n- **Date dimension should cover the full range** of dates in fact tables. Generate it first, then sample date_ids for facts.\n- **Parquet preserves types.** Use proper pandas dtypes: `int64` for IDs, `float64` for amounts, `datetime64` for dates, `object` for strings.\n- **Load Table API is async (202).** The script polls automatically.\n- **OneLake upload has a file size limit.** For large datasets (>100MB), consider splitting into multiple Parquet files and using `pathType: Folder`.\n- **Real-time notebook needs `%pip install azure-eventhub`.** Fabric Spark pools don't ship it by default. The template already installs it — do not remove the magic.\n- **Eventstream connection string must include an `EntityPath` or the event hub name must be passed separately.** The template passes both and uses `eventhub_name=EVENTSTREAM_ENTITY_PATH` explicitly; this works whether or not `EntityPath` is in the connection string.\n- **Don't auto-run the real-time notebook.** The user usually wants to configure consumers on the Eventstream side (KQL DB, Activator, Power BI) before events start flowing. Deploy only — let the user trigger it.\n\n## Global Rules\n\n- **Generate dimensions first, facts second.** Facts reference dimensions via FKs.\n- **Always maintain referential integrity.** Every FK value must exist in the referenced dimension.\n- **Use realistic data, not \"test1, test2\".** Use faker for names, realistic ranges for numbers, proper date distributions.\n- **Parquet format only.** No CSV — Parquet preserves types and is faster to load.\n- **Non-destructive by default.** Use `mode: Overwrite` for the specific table, but never delete unrelated tables.\n",{"name":5,"description":7,"compatibility":51},"Requires the Fabric MCP Server VS Code extension for workspace discovery. Uses Python with pandas and pyarrow for local data generation. Upload via OneLake MCP + Fabric REST API.","main","a54dec65de5a1d2a62bd5cbd9e5003adca5f5a84",".github\u002Fskills\u002Ffabric-synthetic-data",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":62,"prompt":72,"zipAvailable":73},[63,66,69],{"tool":64,"command":65},"npx","npx skills add microsoft\u002Fgh-copilot-fabric-agents --skill fabric-synthetic-data",{"tool":67,"command":68},"bunx","bunx skills add microsoft\u002Fgh-copilot-fabric-agents --skill fabric-synthetic-data",{"tool":70,"command":71},"pnpm","pnpm dlx skills add microsoft\u002Fgh-copilot-fabric-agents --skill fabric-synthetic-data","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fgh-copilot-fabric-agents\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ffabric-synthetic-data\u002FSKILL.md",true,[75,81],{"path":76,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":79,"sourceHtmlUrl":80},"notebooks\u002Frealtime_stream.ipynb","OTHER","其他",7246,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fgh-copilot-fabric-agents\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ffabric-synthetic-data\u002Fnotebooks\u002Frealtime_stream.ipynb",{"path":82,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":85,"sourceHtmlUrl":86},"scripts\u002Ffabric_synthetic_data.py","SCRIPT","脚本",16002,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fgh-copilot-fabric-agents\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ffabric-synthetic-data\u002Fscripts\u002Ffabric_synthetic_data.py",[88,108,125,143],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":101,"publishedAt":46},"01M69BP1F17XK0TFKMDS23QNEV","fabric-semantic-model","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.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fgh-copilot-fabric-agents\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ffabric-semantic-model\u002FSKILL.md",[94,95,98,99,100],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":96,"categoryName":97,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000013","分析与可视化",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":27,"categoryName":28,"taxonomyType":29,"taxonomyTypeDesc":30},{"categoryNo":32,"categoryName":33,"taxonomyType":29,"taxonomyTypeDesc":30},[36,102,38,103,40,9,104,42,105,106,107,43,44,45],"fabric semantic model","inference","dax","deployment","power bi","create",{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":115,"publishedAt":46},"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",[114],{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},[36,116,117,40,118,9,119,104,120,121,42,122,38,44,123,124,39],"fabric optimization review","review","storage","performance","dax optimization","copilot","pattern detection","best practices","agentic",{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":135,"publishedAt":46},"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",[131,134],{"categoryNo":132,"categoryName":133,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000002","文档处理",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},[36,136,103,137,38,117,39,40,9,138,42,139,140,141,142,107,44,45],"fabric metadata creation","PDF","identity","governance","purview","azure","data catalog",{"skillNo":144,"name":145,"nameZh":6,"description":146,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":147,"categories":148,"keywords":151,"publishedAt":46},"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",[149,150],{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":32,"categoryName":33,"taxonomyType":29,"taxonomyTypeDesc":30},[152,153,36,40,9,154,42,155,156,44,45,157,38],"fabric data","fabric data cleaner","vscode","pyspark","run","validation"]