Skip to content
datastudyguides
Community DP-700

DP-700 Fabric 数据工程师 中英双语通关课 (Bilingual)

A bilingual English and Chinese study course for DP-700 Microsoft Fabric Data Engineer: one card per objective of the official skills outline, each with a diagram and five original practice questions that cite the Microsoft Learn page proving the answer. DP-700 中英双语备考课:按官方大纲一个知识点一张卡,每张卡配图表和 5 道原创练习题,答案均附微软官方文档出处。

Written by Eginn. Not reviewed by DataStudyGuides.

Microsoft · DP-700 · Microsoft Fabric Data Engineer Associate · 54 cards · 270 questions

1.1 Workspace settings 工作区设置

Spark workspace settings 工作区 Spark 设置

Workspace admins choose the default pool, environment and job rules for Spark. 工作区管理员决定 Spark 的默认池、默认环境和作业规则。

Every new workspace gets a starter pool. Switch to a custom pool only when a job needs specific node sizes, and expect slower session start.

  • Starter pool 入门池

    Session start 启动速度
    Seconds 几秒
    Node sizing 节点大小
    Handled for you 自动
    Autoscale 自动缩放
    Max nodes only 只调上限
    Needs 前提
    Nothing 无
  • Custom pool 自定义池

    Session start 启动速度
    About 3 minutes 约 3 分钟
    Node sizing 节点大小
    You choose 自己选
    Autoscale 自动缩放
    Optional 可开关
    Needs 前提
    Capacity allows custom pools 容量允许
Starter pool vs custom pool 入门池 vs 自定义池

The Jobs tab controls admission. Optimistic job admission is the default; turning on Reserve maximum cores switches it off. Session timeout sets when idle notebook sessions expire.

每个新工作区都自带入门池。只有作业需要特定节点规格时才换自定义池,代价是会话启动变慢。作业页控制准入:默认是乐观准入,打开“预留最大核心”就关掉它;会话超时决定空闲笔记本会话多久过期。

Key points

  • Starter pool: prehydrated, sessions start in seconds 入门池:预热好,几秒启动
  • Custom pool: you size nodes, autoscale and executors 自定义池:自己定节点、自动缩放和执行器
  • Default environment: runtime and libraries for all items 默认环境:统一的运行时和库
  • High concurrency: several notebooks share one session 高并发:多个笔记本共用一个会话
  • Max job lifetime: cancels user jobs that run too long 最长作业时长:超时自动取消用户作业

Exam trap

Only the workspace Admin role can change these settings, and custom pools also need the capacity admin to allow them. 只有工作区管理员能改;自定义池还要容量管理员放行。

Domain settings 域设置

Domains group workspaces by business area so people can find data and some governance can be delegated. 域按业务领域给工作区分组,方便找数据,也能下放部分治理。

When a workspace joins a domain, every item in it gets the domain as metadata. Users can then filter the OneLake catalog by domain. It changes discovery and delegated settings, never who can read the data. Workspace roles and item permissions still decide access.

Domain roles 域角色

  • Fabric adminFabric 管理员

    • Create, rename, delete domains 建、改名、删域
    • Name domain admins 指定域管理员
  • Domain admin域管理员

    • Assign workspaces 分配工作区
    • Set contributors and default domain 设贡献者和默认域
    • Override delegated tenant settings 覆盖下放的租户设置
  • Domain contributor域贡献者

    • Link a workspace they admin, in its settings 在工作区设置里挂域
Who does what 谁能做什么

工作区挂到域以后,里面所有项目都带上这个域标签,用户可以在 OneLake 目录里按域筛选。它只影响查找和下放的设置,不影响谁能读数据。子域没有自己的管理员,沿用父域的。

Key points

  • Fabric admin: creates domains and names domain admins Fabric 管理员:建域、指定域管理员
  • Domain admin: assigns workspaces, edits contributors and delegated settings 域管理员:分配工作区、管贡献者
  • Domain contributor: workspace admin who links own workspace 域贡献者:给自己的工作区挂域
  • Default domain: auto assigns new workspaces of chosen users 默认域:指定人新建的工作区自动归入
  • Access: domain membership grants no item access 权限:挂域不会给任何数据权限

Exam trap

Assign by workspace name, admin or capacity only touches existing workspaces; use a default domain for future ones. 按名称、管理员、容量分配只影响现有工作区,以后新建的要靠默认域。

OneLake shortcut cache 快捷方式缓存

The OneLake tab of workspace settings turns on a shortcut cache that cuts cross cloud egress costs. 工作区设置的 OneLake 页可以打开快捷方式缓存,减少跨云流出费用。

Reading through an external shortcut copies each file into a workspace cache. Later reads come from the cache instead of the remote cloud, so you pay egress once. Turn it on in the OneLake tab of workspace settings, pick a retention period, and use Reset cache when you need a clean start.

  1. 1Request 请求A notebook or query reads a file 笔记本或查询读文件
  2. 2Check 检查Is a fresh copy in the cache? 缓存里有最新副本吗
  3. 3Serve 返回Cached copy if current, otherwise the source file, which then refreshes the cache 有最新副本用缓存,否则读源并刷新
  4. 4Expire 过期Files not read within the retention period are purged 保留期内没读过就清掉
One read through a cached shortcut 一次带缓存的读取

通过外部快捷方式读文件时,文件会存进工作区缓存,之后再读就直接从缓存拿,不再从外部云下载,流出费只付一次。保留期 1 到 28 天,每次读取都重新计时;源端有更新时会重新拉取并刷新缓存。

Key points

  • Where: Workspace settings, OneLake tab 位置:工作区设置的 OneLake 页
  • Covers: GCS, S3, S3 compatible, on premises gateway shortcuts 支持:GCS、S3、S3 兼容、本地网关
  • Retention: 1 to 28 days, reset on each read 保留:1 到 28 天,每读一次重新计时
  • Size: files over 1 GB are never cached 大小:超过 1 GB 的文件不缓存
  • Reset cache: empties the whole workspace cache 重置缓存:清空整个工作区缓存

Exam trap

ADLS Gen2 shortcuts are not cached; the cache helps other clouds and gateway sources only. ADLS Gen2 快捷方式不走缓存,缓存只管其他云和网关来源。

Apache Airflow pools Airflow 运行池

Apache Airflow jobs run on a starter pool for development or an always on custom pool for production. Airflow 作业开发用入门池,生产用常开的自定义池。

An Apache Airflow job runs DAGs (directed acyclic graphs, 有向无环图) on a pool set at workspace level. If customizing compute for items is off, every environment uses the starter pool. Pick the pool by how long the runtime must stay available and how many DAGs must run together.

  • Developing and testing DAGs 开发测试Starter pool 入门池Large node, shuts down when idle 大节点,闲置就关
  • Production DAGs that must stay available 生产环境要常在线Custom pool 自定义池Choose node size, autoscale, extra nodes 自选节点、自动缩放、额外节点
  • Many DAGs must run at the same time 大量 DAG 同时跑Custom pool with extra nodes 自定义池加额外节点
Pick the Airflow pool 选哪个运行池

Airflow 作业在工作区级别设定的运行池上跑 DAG。如果关闭了“为项目自定义计算”,所有环境都用入门池。入门池适合开发,自定义池适合生产,需要更多并发就加额外节点。

Key points

  • Starter pool: instant start, stops after 20 idle minutes 入门池:即开即用,闲置 20 分钟关闭
  • Custom pool: always on until you pause it 自定义池:一直开着,直到手动暂停
  • Node size: Large for complex DAGs, Small for simple 节点:复杂 DAG 用大,简单用小
  • Extra nodes: each adds room for three more workers 额外节点:每个多容纳三个工作进程
  • Where: Workspace settings, Data Factory, Airflow runtime 位置:工作区设置的数据工厂页

Exam trap

A new custom pool starts in a stopped state, so it is not running the moment you create it. 新建的自定义池是停止状态,建好并不会马上运行。

1.2 Lifecycle management 生命周期管理

Git integration 版本控制

A workspace syncs item definitions with one Git branch, so you commit and update instead of copying items by hand. 工作区和一个 Git 分支同步项目定义,靠提交和更新代替手工复制。

A workspace connects to exactly one branch and folder. Admins connect and disconnect it. Contributors can commit and update when they have write access to every item. The Source control panel shows which items are new, modified, deleted or in conflict.

  1. 1Connect 连接Admin picks provider, repo, branch and folder 管理员选仓库、分支、文件夹
  2. 2Edit 编辑Changed items show as uncommitted 改过的项目显示未提交
  3. 3Commit 提交Pick items, add a comment, push to the branch 选项目、写说明、推送
  4. 4Update 更新Pull changes others merged into the branch 拉取别人合并的改动
  5. 5Resolve 解决冲突Same item changed in both places 两边都改了同一项目
Everyday Git loop 日常 Git 循环

For isolated work, branch out to another workspace. You get a new branch and a linked workspace while the shared one stays untouched.

一个工作区只连一个分支和文件夹。连接和断开只有管理员能做;对所有项目有写权限的参与者可以提交和更新。要隔离开发就用“分支到另一个工作区”,会新建分支和关联工作区,原工作区不受影响。冲突时可以接受传入更改、保留当前内容,或在 Git 里合并解决。

Key points

  • Providers: Azure DevOps, GitHub and GitHub Enterprise, cloud only 提供方:Azure DevOps、GitHub、GitHub 企业版,仅云端
  • Connect: only a workspace Admin links the workspace to a branch 连接:只有工作区管理员能连分支
  • Commit: sends workspace changes to the branch 提交:把工作区改动推到分支
  • Update: pulls branch changes into the workspace 更新:把分支改动拉回工作区
  • Definitions only: item data is never stored in Git 只存定义:数据不进 Git

Exam trap

Git keeps item definitions, not data. Updating a lakehouse from Git rebuilds its definition but never brings its tables back. Git 只存定义不存数据,从 Git 更新湖仓不会把表数据带回来。

SQL database projects 数据库项目

A SQL database project keeps schema as code, builds a dacpac and publishes only the difference. 数据库项目把架构存成代码,编译成 dacpac 再发布差异。

Database projects let you treat schema like application code. You can start empty or extract a project from an existing warehouse, edit the files, build, and then publish. Fabric Git integration also stores a SQL database as a SQL project, so the same files work in Git, pipelines and SqlPackage.

  1. 1Create or extract 新建或提取Start empty or pull schema from a warehouse 空项目或从仓库提取
  2. 2Edit 编辑One .sql file per table, view or procedure 每个对象一个文件
  3. 3Build 编译Validate and produce the dacpac 校验并生成 dacpac
  4. 4Review 审查Generate Script and read the T-SQL 生成脚本先看
  5. 5Publish 发布Apply changes with VS Code or SqlPackage 用 VS Code 或 SqlPackage 发布
Project to warehouse 从项目到仓库

Two publish settings matter most. BlockOnPossibleDataLoss stops a deployment that would drop data. DropObjectsNotInSource removes target objects missing from the project.

数据库项目让架构像代码一样管理:可以新建,也可以从现有仓库提取,改文件、编译、发布。Fabric 的 Git 集成也把 SQL 数据库存成 SQL 项目。BlockOnPossibleDataLoss 会阻止可能丢数据的部署,生产环境建议开;DropObjectsNotInSource 会删掉项目里没有的目标对象,要慎用。

Key points

  • Project: SDK-style .sqlproj with one file per object SDK 风格项目,每个对象一个文件
  • Tools: VS Code with SQL Database Projects and mssql extensions VS Code 加两个扩展
  • Build: validates objects and outputs a dacpac file 编译:校验对象并生成 dacpac
  • Generate Script: shows the T-SQL, target unchanged 生成脚本:只看 T-SQL 不改目标
  • Publish: applies the difference to the target 发布:把差异应用到目标

Exam trap

A dacpac holds schema only. Publishing it changes tables and views but never copies rows, so data moves by pipelines or other loads. dacpac 只含架构,发布不会复制行数据。

Deployment pipelines 部署管道

A deployment pipeline moves item definitions between stage workspaces, such as development, test and production, with rules for stage values. 部署管道在各阶段工作区之间搬运项目定义,并用规则替换各阶段的值。

Create the pipeline, name its stages, then assign a workspace to each stage. Paired items in the target are overwritten when you deploy, while their ID, URL and permissions stay. Compare first to see what will change.

  1. Development 开发Creators build and change content 创作者开发修改
  2. Test 测试Validate with test data sources 用测试数据源验证
  3. Production 生产Shared with business users, usually public 给业务用户,通常公开
Default three stages 默认三阶段

Deployment rules swap stage specific values. A semantic model can point to a production database, and a notebook can bind to a production lakehouse through a default lakehouse rule. Rules take effect on the next deployment.

先建管道、命名阶段,再给每个阶段分配工作区。部署时目标阶段里配对的项目被覆盖,但 ID、URL 和权限不变;部署前先对比。部署规则用来替换各阶段的值,比如语义模型指向生产数据库、笔记本绑定生产湖仓,下次部署才生效。

Key points

  • Stages: two to ten, count fixed once the pipeline exists 阶段:2 到 10 个,创建后不能改数量
  • Assign: one workspace per stage, on Fabric capacity 分配:每阶段一个工作区,需在容量上
  • Deploy: needs pipeline admin plus Contributor on both workspaces 部署:管道管理员加两边参与者
  • Rules: set on the target stage, never in development 规则:设在目标阶段,开发阶段不能设
  • Compare: shows different, only in source, not in source 对比:显示不同、仅源端、源端没有

Exam trap

Deployment copies metadata, not data. Item permissions and workspace settings stay as they are in the target, and lakehouse tables must be loaded there. 部署只复制元数据,不复制数据、权限和工作区设置。

1.3 Security and governance 安全与治理

Workspace roles 工作区角色

Four workspace roles, Admin, Member, Contributor and Viewer, grant access to every item in the workspace at once. 四个工作区角色一次性授予工作区内所有项目的访问权限。

Workspace roles are the broadest access control in Fabric. A role applies to all items, current and future, so give the lowest role that does the job and use item permissions for single items. Assign roles to groups to keep membership manageable.

  • Admin 管理员

    Manage people 管理人员
    All roles 所有角色
    Create and edit items 建改项目
    Yes 是
    Run pipelines and notebooks 运行
    Yes 是
    Read data with T-SQL 用 T-SQL 读
    Yes 是
    Read data with Spark 用 Spark 读
    Yes 是
  • Member 成员

    Manage people 管理人员
    Member or lower 成员及以下
    Create and edit items 建改项目
    Yes 是
    Run pipelines and notebooks 运行
    Yes 是
    Read data with T-SQL 用 T-SQL 读
    Yes 是
    Read data with Spark 用 Spark 读
    Yes 是
  • Contributor 参与者

    Manage people 管理人员
    No 否
    Create and edit items 建改项目
    Yes 是
    Run pipelines and notebooks 运行
    Yes 是
    Read data with T-SQL 用 T-SQL 读
    Yes 是
    Read data with Spark 用 Spark 读
    Yes 是
  • Viewer 查看者

    Manage people 管理人员
    No 否
    Create and edit items 建改项目
    No 否
    Run pipelines and notebooks 运行
    No 否
    Read data with T-SQL 用 T-SQL 读
    Yes 是
    Read data with Spark 用 Spark 读
    No 否
What each role adds 每个角色多了什么

工作区角色是最粗粒度的权限,作用于工作区里现在和以后的所有项目,所以按最低够用原则分配,单个项目用项目权限。查看者能连 SQL 分析端点用 T-SQL 读数据,但不能用 Spark 或湖仓浏览器读。

Key points

  • Admin: everything, including deleting the workspace and adding admins 管理员:全部权限,含删工作区
  • Member: adds people at Member or lower, allows resharing 成员:可加成员及以下角色
  • Contributor: creates, edits, runs and deletes items 参与者:建、改、运行、删项目
  • Viewer: reads items and queries data through SQL only 查看者:只读,可用 SQL 查数据
  • Git: only Admin connects a workspace to a repository Git:只有管理员能连仓库

Exam trap

Viewers can query lakehouse and warehouse data with T-SQL, but they cannot read it through Spark, OneLake APIs or the Lakehouse explorer. 查看者能用 T-SQL 查数据,但不能用 Spark 或湖仓浏览器读。

Item permissions 项目权限

Sharing gives one item to a user without a workspace role, starting with Read and adding only the extra permissions needed. 共享只把单个项目给用户,从读取开始,按需加额外权限。

Item permissions are for people who need one item, not the whole workspace. Only workspace Admins and Members can share, and each recipient always gets Read. Pick the extra permissions by how the person will read the data.

  • Query every table with T-SQL 用 T-SQL 查所有表ReadData 用 SQL 读所有数据
  • Read files with Spark or OneLake APIs 用 Spark 或 OneLake 读文件ReadAll 用 Spark 读所有数据
  • Query only a few tables or views 只查几张表或视图Read only, plus T-SQL GRANT 只给读取,再 GRANT
  • Build reports on the semantic model 基于语义模型做报表Build
Which extra permission 加哪个额外权限

项目权限给只需要单个项目的人。只有工作区管理员和成员能共享,收件人总会得到读取权限。用 T-SQL 查全部表加 ReadData,用 Spark 读文件加 ReadAll,只查少数对象就只给读取再用 GRANT 授权。

Key points

  • Read: open the item and connect to its SQL endpoint 读取:打开项目、连 SQL 端点
  • ReadData: read all tables and views with T-SQL ReadData:用 T-SQL 读所有表和视图
  • ReadAll: read files through Spark, OneLake APIs and explorer ReadAll:用 Spark、OneLake 读文件
  • Build: create new content on the semantic model Build:基于语义模型做新内容
  • Share: reshare with permissions no higher than your own 共享:转授不超过自己的权限

Exam trap

Read alone on a warehouse is only CONNECT. The user cannot query any table until you add ReadData or GRANT access with T-SQL. 只给读取等于只能连接,查不了表。

Row, column, object security 行列对象级安全

Inside a warehouse or SQL analytics endpoint, T-SQL limits which objects, columns and rows each user can read. 在仓库或 SQL 分析端点里,用 T-SQL 限制用户能读的对象、列和行。

Start from the minimum. Share the warehouse with Read only, which is just CONNECT, then grant the objects a user needs. Fabric creates the database user on the first GRANT, so there is no CREATE USER. Add column and row rules on top.

  • User may query some tables or views only 只能查部分表或视图Object level GRANT 对象级 GRANT
  • Hide sensitive columns completely 完全隐藏敏感列Column level GRANT SELECT 列级授权SELECT star then fails with an error 查星号会报错
  • Each user sees only their rows 每人只看自己的行Row level security policy 行级安全策略
  • Limit lakehouse folders or files 限制湖仓文件夹或文件OneLake security role OneLake 安全角色
Pick the control 选哪种控制

先给最小权限:只共享读取,再按需 GRANT 对象。第一次 GRANT 时 Fabric 自动建数据库用户,不能 CREATE USER。列级安全用列清单授权,查 SELECT * 会报错;行级安全用安全策略和内联表值函数,对 dbo 也生效。

Key points

  • Object level: GRANT, DENY, REVOKE on tables, views, procedures 对象级:对表视图过程授权
  • Column level: GRANT SELECT on a listed set of columns 列级:只对列出的列授 SELECT
  • Row level: security policy with an inline table-valued function 行级:安全策略加内联表值函数
  • Filter predicate: silently hides rows from reads 筛选谓词:悄悄隐藏行
  • Folders and files: secured with OneLake security roles 文件夹文件:用 OneLake 安全角色

Exam trap

Row-level security applies to everyone, even dbo and workspace Admins. Write the predicate to let them through if they must see all rows. 行级安全对所有人生效,管理员要看全部行得在谓词里放行。

Dynamic data masking 动态数据掩码

Dynamic data masking hides sensitive column values in query results for users without UNMASK, while stored data stays unchanged. 动态数据掩码对没有 UNMASK 的用户隐藏列值,存储的数据不变。

You add a mask with ALTER TABLE and ALTER COLUMN, or define it when the table is created. Users with SELECT see masked values. Workspace Admins, Members and Contributors have CONTROL, so they always see real data.

  • Function 函数

    Text column 文本列
    default()
    Email column 邮箱列
    email()
    Numeric column 数值列
    random(1, 100)
    Phone column 电话列
    partial(3,"XXXX",0)
  • Example output 示例输出

    Text column 文本列
    XXXX
    Email column 邮箱列
    [email protected]
    Numeric column 数值列
    A number from 1 to 100 1 到 100 的数
    Phone column 电话列
    555XXXX
Mask functions 掩码函数

Adding or changing a mask needs ALTER ANY MASK and ALTER on the table.

用 ALTER TABLE ... ALTER COLUMN ... ADD MASKED WITH 加掩码,也可以建表时定义。有 SELECT 的用户看到的是遮住的值;工作区管理员、成员、参与者有 CONTROL,看到的是真实值。添加或修改掩码需要 ALTER ANY MASK 和表的 ALTER 权限。

Key points

  • default(): XXXX for text, zero for numbers, 1900-01-01 for dates 默认:文本 XXXX、数字 0
  • email(): first letter, then [email protected] 邮箱:保留首字母
  • random(a,b): random number inside the range 随机:区间内随机数
  • partial(p,"pad",s): keeps prefix and suffix, pads the middle 部分:保留前后缀
  • UNMASK: per column, or via CONTROL on the database UNMASK:按列或靠 CONTROL

Exam trap

Masking is not a security boundary. A user who can filter with WHERE can still infer real values, so pair it with column and row security. 掩码不是安全边界,可用 WHERE 推断真实值。

Sensitivity labels 敏感度标签

Microsoft Purview sensitivity labels classify Fabric items, flow to downstream items and travel with supported exports. Purview 敏感度标签给项目分级,会传给下游并随支持的导出带走。

Labels come from Microsoft Purview Information Protection, so admins publish them there first. A user with edit rights picks a label on the item. Fabric then helps keep it consistent: downstream inheritance, inheritance when you create an item from another, and default or mandatory labeling.

  1. 1Publish 发布Admins publish labels in Purview 管理员在 Purview 发布标签
  2. 2Apply 应用User labels a lakehouse 用户给湖仓打标签
  3. 3Inherit 继承Notebook created from it gets the label 由它创建的笔记本继承
  4. 4Downstream 下游Dependent items receive the label 依赖项目收到标签
  5. 5Export 导出Excel or PDF output keeps it Excel、PDF 带走标签
How a label spreads 标签怎么传播

标签来自 Microsoft Purview 信息保护,管理员先在 Purview 发布。有编辑权限的用户给项目打标签后,Fabric 会通过下游继承、由项目新建时继承,以及默认或强制标签保持一致。下游继承不支持从 Power BI 项目到 Fabric 项目。

Key points

  • Apply: from the header flyout or the item settings 应用:标题弹出菜单或项目设置
  • Needs: Pro or PPU license and edit permission 需要:Pro 或 PPU 许可证和编辑权限
  • Downstream: label flows to dependent items through lineage 下游:沿世系传给依赖项目
  • Create from item: new item inherits the source label 由项目新建:继承源标签
  • Export: Excel, PDF and PowerPoint keep the label 导出:Excel、PDF、PPT 保留标签

Exam trap

Labels do not follow every path. Export to CSV or TXT, and cross tenant sharing, are not protected by the label. 导出 CSV、TXT 或跨租户共享时标签不保护。

Endorse items 项目背书

Endorsement badges, Promoted, Certified and Master data, tell users which Fabric items are trusted and ready to reuse. 背书徽章告诉用户哪些项目可信、可复用。

Endorsement helps people find reliable content in the OneLake catalog and in item lists. You set it in the item settings under Endorsement. If you are not authorized, Certified and Master data appear greyed out and a link explains how to request it.

Endorsement 背书

  • Promoted 推广

    • Any user with write permission 任何有写权限的人
    • All items except Power BI dashboards 除仪表板外都行
  • Certified 认证

    • Reviewers named by a Fabric admin 管理员指定审阅者
    • Can be delegated to domain admins 可下放到域管理员
  • Master data 主数据

    • Users named by a Fabric admin 管理员指定的人
    • Data items such as lakehouses 只限湖仓等数据项目
Endorsement badges 背书徽章

背书帮助用户在 OneLake 目录和列表里找到可靠内容,在项目设置的“背书”里设置。没有授权时,“认证”和“主数据”是灰的,旁边有申请说明的链接。认证和主数据要 Fabric 管理员先在租户里启用。

Key points

  • Promoted: creator says ready to share, any writer can apply 推广:有写权限即可
  • Certified: authorized reviewer confirms quality standards 认证:授权审阅者确认质量
  • Master data: core organizational data, data items only 主数据:核心数据,只限数据项目
  • Who certifies: users named by a Fabric admin 谁能认证:Fabric 管理员指定的人
  • Where: badge shows and endorsed items list first 显示徽章,列表中靠前

Exam trap

Writing to an item lets you promote it, but not certify it. Certified and Master data need users a Fabric admin has authorized. 有写权限只能推广,认证和主数据要管理员授权的人。

Fabric audit logs 审核日志

Fabric activity lands in the Purview audit log, and Fabric admins can export it with the Activity Events API. 活动记入 Purview 审核日志,管理员也能用 API 导出。

Use the Purview audit log when compliance staff need to search activity without being Fabric admins. Use the Activity Events API or Get-PowerBIActivityEvent when a Fabric admin wants to export events into their own store on a schedule.

  • Compliance team searches who did what 合规团队查谁做了什么Purview audit search Purview 审核搜索Needs the Audit Logs role 需审核日志角色
  • Fabric admin exports events daily 管理员每天导出事件Activity Events API or Get-PowerBIActivityEvent 活动事件 API
  • Track queries inside one warehouse 跟踪单个仓库里的查询Warehouse SQL audit logs 仓库 SQL 审核日志
Pick the audit source 选审核来源

合规人员不是 Fabric 管理员时用 Purview 审核日志搜索;Fabric 管理员要定期导出就用活动事件 API 或 Get-PowerBIActivityEvent,后者会自动处理延续令牌。仓库 SQL 审核日志默认关闭,写在仓库的 OneLake 里,删仓库日志也会没。

Key points

  • Purview audit: search in the Purview portal by date, user, activity Purview:按日期用户活动搜
  • Access: needs the Audit Logs role, not a Fabric role 权限:需审核日志角色
  • Activity Events API: Fabric admin or service principal only API:仅 Fabric 管理员或服务主体
  • Date range: one UTC day per call, then use continuation tokens 每次只查一天
  • Warehouse SQL audit: off by default, stored in OneLake 仓库 SQL 审核:默认关,存 OneLake

Exam trap

The Activity Events API rejects a range that crosses days. Start and end must fall on the same UTC day. 活动事件 API 不接受跨天区间,开始结束必须同一个 UTC 日。

OneLake security roles OneLake 安全

OneLake security roles grant read or read write access to chosen tables or folders, with optional row and column rules, across engines. OneLake 安全角色授予指定表或文件夹的访问,可加行列规则,各引擎统一生效。

Admins and Members create the roles. They restrict users who only have Read, such as Viewers, while Admins, Members and Contributors keep full access. Folder access flows down to subfolders, and users can traverse parents without seeing siblings.

  1. 1Create role 建角色Pick tables or folders, permission Read 选表或文件夹,读权限
  2. 2Add rules 加规则Optional RLS predicate and visible columns 可选行规则和可见列
  3. 3Add members 加成员Users or groups who need it 需要的用户或组
  4. 4Trim DefaultReader 收紧默认角色Remove ReadAll or the role 移除 ReadAll 或该角色
  5. 5Switch SQL endpoint 切换端点User's identity mode 用户身份模式
Lock a lakehouse to one region 把湖仓限制到一个区域

A ReadWrite role cannot carry row or column rules.

管理员和成员建角色。角色限制只有读取权限的用户,比如查看者;管理员、成员、参与者仍有完全访问。文件夹权限向下继承,用户能穿过父文件夹但看不到兄弟文件夹。多个角色取并集,行规则用 OR 合并。读写角色不能带行列规则。

Key points

  • Deny by default: no role, no data for readers 默认拒绝:不在角色里就看不到
  • Scope: tables, schemas or folders in a lakehouse 范围:表、架构或文件夹
  • DefaultReader: includes everyone with ReadAll, remove to restrict DefaultReader:含所有 ReadAll 用户
  • Several roles: access is the union of the roles 多个角色:取并集
  • SQL analytics endpoint: switch to User's identity mode SQL 端点:切到用户身份模式

Exam trap

Adding a user to a narrow role does nothing while DefaultReader still includes them. Remove ReadAll or the DefaultReader role, or they keep full access. 只加窄角色没用,要从 DefaultReader 移出。

1.4 Orchestrate processes 流程编排

Dataflow, pipeline or notebook 数据流、管道还是笔记本

Use Dataflow Gen2 for low code shaping, a pipeline to orchestrate and copy, and a notebook for code. 低代码整形用 Dataflow Gen2,编排和搬运用管道,写代码用笔记本。

Pick the tool by who builds it and what the job needs. A pipeline orchestrates: it copies data at scale with no code and wraps other work in control flow such as ForEach, If condition and Until. Dataflow Gen2 is low code Power Query with more than 300 transformations. A notebook is code first Spark for complex logic and open source libraries.

  • Move large volumes as is, no code 大批量原样搬运,不写代码Pipeline copy activity 管道复制活动Lightweight transforms only 只做轻量转换
  • Analysts reshape data with Power Query 分析师用 Power Query 整形Dataflow Gen2Many transforms, several destinations 转换多,可写多个目标
  • Complex logic in code, any library 复杂逻辑写代码,可用任意库Notebook 笔记本
  • Chain steps, loop, branch, retry 串联、循环、分支、重试Pipeline 管道Calls dataflows and notebooks as activities 把数据流和笔记本当活动调用
Which tool for the job 选哪个工具

The three usually work together: a pipeline runs a copy, then a dataflow or a notebook, in one schedule.

按“谁来做、要做什么”选工具。管道负责编排:不写代码就能大规模复制数据,还能用 ForEach、If 条件、Until 把其他工作串起来。Dataflow Gen2 是低代码的 Power Query,有 300 多种转换。笔记本是写代码的 Spark,适合复杂逻辑和开源库。三者常常组合使用:一个管道先复制,再调数据流或笔记本。

Key points

  • Dataflow Gen2: Power Query, 300+ transformations, low code Power Query 低代码,300 多种转换
  • Pipeline: orchestrates activities with ForEach, If condition and Until 管道:用循环和分支编排活动
  • Copy activity: moves large volumes, only lightweight transformations 复制活动:大批量搬运,只做轻量转换
  • Notebook: Spark code in Python, Scala, Spark SQL or R 笔记本:写 Spark 代码
  • Together: a pipeline can run dataflows and notebooks as activities 组合:管道可以调用数据流和笔记本

Exam trap

A pipeline copy activity is not a transformation engine. Complex reshaping belongs in Dataflow Gen2 or a notebook. 管道复制活动不是转换引擎,复杂整形交给 Dataflow Gen2 或笔记本。

Schedules and event triggers 计划与事件触发

Start pipelines on demand, on a schedule or from an event, and let Activator run items when events arrive. 管道可以手动、按计划或由事件启动,事件来时由 Activator 运行项。

A pipeline runs in three ways: on demand, on a schedule or from an event. A schedule needs a start and an end date, a pipeline can hold several schedules, and each can pass parameter values. Event triggers are built on eventstreams and Activator, so OneLake, Azure Blob, job and workspace events can start a run. Copy jobs, dataflows and notebooks have their own schedules too.

  1. 1Event 事件A file lands in OneLake or Blob Storage 文件落到 OneLake 或 Blob
  2. 2Eventstream 事件流Captures and filters the event 捕获并筛选事件
  3. 3Activator rule 规则The condition matches 条件命中
  4. 4Action 动作Runs a pipeline, notebook, dataflow or copy job 运行管道、笔记本、数据流或复制作业
From event to run 从事件到运行

Inside the triggered pipeline, @pipeline()?.TriggerEvent?.FileName returns the file that fired the run.

管道有三种启动方式:手动、按计划、由事件触发。计划必须设开始和结束日期,一个管道可以有多个计划,每个计划都能传参数值。事件触发建立在事件流和 Activator 之上,OneLake、Blob、作业和工作区项事件都能启动运行。复制作业、数据流和笔记本也有自己的计划。被触发的管道里可以用 @pipeline()?.TriggerEvent?.FileName 拿到触发它的文件名。

Key points

  • Schedule: needs a start and an end date, no open-ended option 计划:必须有开始和结束日期
  • Multiple schedules: one pipeline can have several, each with parameter values 一个管道可设多个计划,各带参数值
  • Failure email: sent for scheduled runs, not on-demand runs 失败邮件只针对计划运行
  • Event trigger: built on eventstreams and Activator, saved as a Reflex item 事件触发基于事件流和 Activator
  • Event sources: OneLake, Azure Blob, job and workspace item events 事件源:OneLake、Blob、作业、工作区项

Exam trap

Polling with a short schedule is not an event trigger. When a run must start as a file arrives, use a storage event trigger. 用很密的计划轮询不等于事件触发,文件一到就要跑应该用存储事件触发。

Parameters and expressions 参数与动态表达式

Parameters pass values into runs, variables change during runs, and notebookutils chains notebooks from code. 参数把值传进运行,变量在运行中可变,notebookutils 用代码串联笔记本。

Parameters carry values into a run and stay fixed until it ends. Variables can change during the run through the Set variable activity. Reference values with expressions such as @pipeline().parameters.Region, or embed them in text with @{...}, which always returns a string. A notebook receives values through a cell marked as the parameter cell, and notebookutils lets one notebook run others.

  • run()

    Notebooks 笔记本数
    One child per call 每次一个
    Order 顺序
    Waits for the child 等子笔记本跑完
    Returns 返回
    The exit value as a string 退出值,字符串
    Compute 计算
    The caller's Spark pool 调用方的 Spark 池
  • runMultiple()

    Notebooks 笔记本数
    Many in one call 一次多个
    Order 顺序
    Parallel, or a DAG with dependencies 并行或按依赖 DAG
    Returns 返回
    A result for each activity 每个活动一个结果
    Compute 计算
    Shared inside one Spark session 同一会话内共享
notebookutils.notebook run vs runMultiple

In a pipeline, the Notebook activity sends base parameters that replace the defaults in the parameter cell.

参数把值带进一次运行,直到结束都不变;变量可以在运行中用“设置变量”活动修改。用 @pipeline().parameters.Region 这样的表达式引用参数,或用 @{...} 嵌进文本,结果总是字符串。笔记本通过标记为参数单元格的那一格接收值,notebookutils 让一个笔记本去运行其他笔记本。在管道里,笔记本活动的基本参数会替换参数单元格里的默认值。

Key points

  • Parameter: set at start, constant for the whole run 参数:开始时给定,整次运行不变
  • Variable: changed during the run by Set variable 变量:运行中可用设置变量活动修改
  • Interpolation: @{...} inside text always returns a string 字符串插值总是返回字符串
  • Parameter cell: holds notebook defaults, pipeline values override them 参数单元格放默认值,管道传值覆盖
  • runMultiple: runs notebooks in parallel or as a DAG runMultiple 并行或按 DAG 跑笔记本

Exam trap

A pipeline parameter cannot be changed during a run. Use a variable and the Set variable activity for values that change. 管道参数在运行中改不了,会变的值要用变量和设置变量活动。

2.1 Loading patterns 加载模式

Full and incremental loads 全量与增量加载

Full loads copy everything each run, incremental loads copy only new or changed rows using a watermark or CDC. 全量每次复制全部,增量只用水位或 CDC 复制新增和变更的行。

A full load copies everything each run, which is simple but slow and costly on big tables. An incremental load copies only new or changed rows after a first full run. A watermark tracks the highest value of a column such as a modified date. Change data capture (CDC) reads inserts, updates and deletes recorded by the source. Copy job supports both and remembers its own state.

  1. 1Lookup old 查旧水位Read the watermark saved by the last run 读上次保存的水位
  2. 2Lookup new 查新水位Get the current maximum of the column 取该列当前最大值
  3. 3Copy 复制Rows above the old value, up to the new one 复制旧值之后到新值为止的行
  4. 4Save 保存A stored procedure writes the new watermark 存储过程写回新水位
Watermark pattern in a pipeline 管道里的水位模式

In Copy job, pick an update method too: append is the default, merge updates rows by key, and SCD Type 2 keeps history.

全量加载每次复制全部数据,简单但大表又慢又贵。增量加载在第一次全量之后只复制新增或变更的行。水位记录某列(如修改时间)的最大值;CDC 读取源端记录的增删改。复制作业两种都支持,并自动记住状态。复制作业还要选写入方式:默认追加,合并按键更新,SCD 类型 2 保留历史。

Key points

  • Full copy: copies all source data on every run 全量:每次都复制全部数据
  • Incremental copy: first run is full, later runs copy changes 增量:首次全量,之后只拷变更
  • Watermark: highest value of a column such as a modified date 水位:比如修改时间列的最大值
  • CDC: captures inserts, updates and deletes from the source CDC:捕获增删改
  • Copy job: tracks state and resumes from the last successful run 复制作业:自动记录状态,失败后从上次成功处继续

Exam trap

A watermark only sees inserts and updates. If deleted source rows must disappear from the destination, you need CDC. 水位只能看到新增和更新,源端删除要同步就得用 CDC。

Load a dimensional model 加载维度模型

Stage data, load dimensions before facts, use surrogate keys, and track changes with SCD type 1 or 2. 先暂存,先维度后事实,用代理键,用 SCD 1 或 2 处理变化。

Load staging tables first, then dimensions, then facts. Dimensions go first so every member exists before facts look up keys. Give each dimension an integer surrogate key and keep the business key from the source for matching. SCD type 1 overwrites an attribute. SCD type 2 expires the current row and inserts a new version, so history survives. A fact whose lookup fails still loads, pointing to an Unknown member.

  • SCD type 1

    On change 变更时
    Update the row 更新原行
    History 历史
    Lost 不保留
    Extra columns 额外列
    None needed 不需要
    Fact lookup 事实查找
    The single row 唯一一行
  • SCD type 2

    On change 变更时
    Expire old row, insert new row 旧行过期,插入新行
    History 历史
    Kept as versions 按版本保留
    Extra columns 额外列
    Start date, end date, current flag 起止日期和当前标记
    Fact lookup 事实查找
    The current version 当前版本
SCD type 1 vs type 2 缓慢变化维 1 型 vs 2 型

先加载暂存表,再处理维度,最后处理事实。维度要先处理,保证事实查键时成员都已存在。每个维度用整数代理键,同时保留源系统的业务键用于匹配。SCD 1 直接覆盖属性;SCD 2 让当前行过期并插入新版本,历史得以保留。查不到维度的事实行照样加载,指向“未知”成员。

Key points

  • Order: staging, then dimensions, then facts 顺序:暂存,维度,再事实
  • Surrogate key: small integer generated in the dimension 代理键:维度表里生成的小整数
  • Business key: the source system key used for matching 业务键:源系统的键,用来匹配
  • SCD type 1: overwrite the attribute, no history SCD 1:直接覆盖,不留历史
  • SCD type 2: expire current row, insert a new version SCD 2:旧行过期,插入新版本

Exam trap

Never truncate and reload a dimension with generated surrogate keys. Fact rows would point to wrong members and SCD history is lost. 带生成代理键的维度千万别清空重载,事实会指错成员,历史也丢了。

Streaming load pattern 流式加载模式

Use an eventstream for no code streaming to an eventhouse or lakehouse, or Spark Structured Streaming for code. 无代码用事件流写入事件库或湖仓,写代码用 Spark 结构化流。

Streaming data arrives all the time, so the load never ends. An eventstream is the no code path: add a source such as Azure Event Hubs, apply transformations like Filter or Group by, and route to an eventhouse, a lakehouse, Activator or several destinations at once. Spark Structured Streaming is the code path that writes to a Delta table with a checkpoint.

  • No code, real time queries in KQL 无代码,用 KQL 实时查询Eventstream to eventhouse 事件流到事件库
  • No code, land events as Delta tables 无代码,落成 Delta 表Eventstream to lakehouse 事件流到湖仓
  • Act when a value crosses a threshold 数值越线就行动Eventstream to Activator 事件流到 Activator
  • Custom code and complex logic 自定义代码和复杂逻辑Spark Structured Streaming Spark 结构化流Run it as a Spark job definition with retries 用带重试的 Spark 作业定义运行
Pick a streaming path 选流式路径

Set a trigger interval on the stream to write fewer, larger files.

流数据源源不断,加载永不结束。事件流是无代码路线:加一个源(如 Azure 事件中心),做筛选、分组等转换,再路由到事件库、湖仓、Activator,或同时写多个目标。Spark 结构化流是代码路线,带检查点写入 Delta 表。给流设置触发间隔,可以写出更少、更大的文件。

Key points

  • Eventstream: no code sources, transformations and destinations 事件流:无代码的源、转换、目标
  • Destinations: eventhouse, lakehouse, Activator, custom endpoint, derived stream 目标:事件库、湖仓、Activator 等
  • Many destinations: one stream can feed several at once 一个流可同时写多个目标
  • Structured Streaming: writeStream to Delta with a checkpoint location 结构化流:带检查点写 Delta
  • Production: Spark job definition with a retry policy 生产环境:Spark 作业定义加重试策略

Exam trap

A notebook is for building streaming logic. For a job that must run continuously and restart itself, use a Spark job definition with retries. 笔记本用来开发流逻辑,要长期运行且自动重启得用带重试的 Spark 作业定义。

2.2 Batch data 批处理数据

Choose a data store 选择数据存储

Lakehouse for Spark and any data shape, warehouse for T-SQL and transactions, eventhouse for events, SQL database for OLTP. 湖仓配 Spark,仓库配 T-SQL,事件库配事件,SQL 数据库配 OLTP。

All Fabric data stores keep their data in OneLake, so the choice is about workload and skills. A lakehouse suits Spark users and data of any shape. A warehouse suits T-SQL teams that need multi-table transactions. An eventhouse suits streaming, time series and log data queried with KQL. A SQL database in Fabric suits operational apps that need OLTP.

  • Spark, files of any shape, machine learning Spark、任意格式文件、机器学习Lakehouse 湖仓SQL analytics endpoint reads only SQL 分析端点只读
  • T-SQL, multi-table transactions, star schema T-SQL、多表事务、星型模型Warehouse 仓库
  • Events, telemetry, time series in KQL 事件、遥测、时序Eventhouse 事件库
  • Operational app, OLTP, foreign keys 业务应用、OLTP、外键SQL database in Fabric Fabric SQL 数据库
Which store 选哪个存储

The eventhouse is the one exception for open format: its OneLake availability is opt in.

Fabric 的所有数据存储都把数据放在 OneLake,所以选择看工作负载和技能。湖仓适合 Spark 用户和各种格式的数据;仓库适合需要多表事务的 T-SQL 团队;事件库适合用 KQL 查询的流、时序和日志数据;Fabric SQL 数据库适合需要 OLTP 的业务应用。事件库是例外:它在 OneLake 中的开放格式副本需要手动开启。

Key points

  • Lakehouse: Spark, structured and unstructured data, read-only SQL endpoint 湖仓:Spark,任意数据,SQL 端点只读
  • Warehouse: full T-SQL with multi-table transactions 仓库:完整 T-SQL,多表事务
  • Eventhouse: streaming, time series and logs with KQL 事件库:流、时序、日志,用 KQL
  • SQL database: operational OLTP apps, foreign keys SQL 数据库:业务 OLTP 应用
  • OneLake: all stores use it, eventhouse availability is opt-in 都在 OneLake,事件库需手动开启

Exam trap

The SQL analytics endpoint of a lakehouse is read only. If T-SQL users must INSERT or UPDATE data, choose a warehouse. 湖仓的 SQL 分析端点只读,T-SQL 用户要改数据就选仓库。

Pick a transformation tool 选择转换工具

Use Dataflow Gen2 for low code, notebooks for Spark, T-SQL in warehouses and KQL in eventhouses. 低代码用 Dataflow Gen2,Spark 用笔记本,仓库用 T-SQL,事件库用 KQL。

Choose the transformation language that matches where the data lives and who writes the logic. Dataflow Gen2 gives analysts low code Power Query. Notebooks give engineers Spark for large volumes and complex code. T-SQL transforms tables inside a warehouse with set based statements. KQL shapes event data in an eventhouse, for example with an update policy as rows arrive.

  • Dataflow Gen2

    Language 语言
    Power Query M
    Usual home 常见位置
    Many destinations 多种目标
    Style 风格
    Low code 低代码
  • Notebook

    Language 语言
    PySpark, Scala, Spark SQL, R
    Usual home 常见位置
    Lakehouse 湖仓
    Style 风格
    Code 代码
  • T-SQL

    Language 语言
    T-SQL
    Usual home 常见位置
    Warehouse 仓库
    Style 风格
    Set based SQL 集合式 SQL
  • KQL

    Language 语言
    KQL
    Usual home 常见位置
    Eventhouse 事件库
    Style 风格
    Piped queries 管道式查询
Four ways to transform 四种转换方式

T-SQL in a warehouse can read lakehouse and mirrored tables in the same workspace with three-part names.

按数据在哪、谁写逻辑来选转换语言。Dataflow Gen2 给分析师低代码的 Power Query;笔记本给工程师 Spark,处理大数据量和复杂代码;T-SQL 在仓库里用集合式语句转换表;KQL 在事件库里整形事件数据,比如用更新策略在数据到达时转换。仓库里的 T-SQL 可以用三段式名称读取同一工作区的湖仓和镜像表。

Key points

  • Dataflow Gen2: Power Query M, low code, 300+ transformations 数据流:Power Query M,低代码
  • Notebook: PySpark, Scala, Spark SQL or R for big, complex work 笔记本:大而复杂的工作
  • T-SQL: CTAS and INSERT...SELECT inside a warehouse T-SQL:仓库内集合式转换
  • KQL: update policy reshapes rows as they arrive KQL:更新策略在入库时整形
  • Rule: transform where the data lives, in the team's language 原则:在数据所在处、用团队熟悉的语言转换

Exam trap

A KQL query only reads data. To transform rows as they are ingested into an eventhouse, use a table update policy. KQL 查询只读,入库时转换要用表更新策略。

Create and manage shortcuts 创建与管理快捷方式

Shortcuts are pointers that show internal or external data as OneLake folders without copying it. 快捷方式是指针,把内部或外部数据显示成 OneLake 文件夹,不复制数据。

A shortcut is a pointer, like a symbolic link, that makes data stored elsewhere appear as a folder in OneLake. Internal shortcuts point to Fabric items. External shortcuts point to storage such as ADLS Gen2, Amazon S3 or Google Cloud Storage. Same tenant shortcuts pass the user's identity by default, while external ones use a connection.

  • Tables

    Where 位置
    Top level only 只能在顶层
    Data 数据
    Table formats such as Delta 表格式,如 Delta
    Table discovery 表发现
    Automatic 自动识别
    Delete the shortcut 删除快捷方式
    Target stays 目标不变
  • Files

    Where 位置
    Any level 任意层级
    Data 数据
    Any format 任意格式
    Table discovery 表发现
    None 没有
    Delete the shortcut 删除快捷方式
    Target stays 目标不变
Tables folder vs Files folder Tables 与 Files 文件夹

In a KQL database a shortcut behaves like an external table and is queried with external_table().

快捷方式是一个指针,类似符号链接,让存在别处的数据在 OneLake 里显示成文件夹。内部快捷方式指向 Fabric 项,外部快捷方式指向 ADLS Gen2、Amazon S3、Google Cloud Storage 等存储。同租户快捷方式默认传递用户身份,外部快捷方式使用连接。在 KQL 数据库里,快捷方式相当于外部表,用 external_table() 查询。

Key points

  • Hosts: create shortcuts in lakehouses and KQL databases 宿主:湖仓和 KQL 数据库
  • Internal: points to Fabric items such as lakehouses or warehouses 内部:指向 Fabric 项
  • External: ADLS Gen2, Amazon S3, Google Cloud Storage and more 外部:ADLS、S3、GCS 等
  • Tables folder: top level only, Delta becomes a table Tables:只能顶层,Delta 自动成表
  • Access: the more restrictive of shortcut and target permissions wins 权限:取两边更严格的

Exam trap

Deleting a shortcut leaves the target intact, but deleting a file inside a shortcut deletes it at the target if you have write access. 删快捷方式不影响目标,但删快捷方式里的文件,有写权限就会真删目标文件。

Mirroring 镜像

Mirroring continuously replicates source databases into OneLake as Delta tables, with no ETL to build. 镜像把源数据库持续复制成 OneLake 的 Delta 表,无需自建 ETL。

Mirroring continuously replicates data from operational sources into OneLake as Delta tables, with no pipelines to build. Each mirrored database comes with a SQL analytics endpoint, so you can query it with T-SQL, join it to warehouses with three-part names, or use it in Spark and Direct Lake reports. Background replication compute is free and does not use capacity.

Mirroring 镜像

  • Database mirroring数据库镜像

    • Replicates data and metadata 复制数据和元数据
    • Azure SQL Database, Snowflake, Cosmos DB and more 多种数据源
  • Metadata mirroring元数据镜像

    • Syncs catalogs, schemas and tables 同步目录和表结构
    • Data stays at the source through shortcuts 数据通过快捷方式留在源端
  • Open mirroring开放镜像

    • Your app lands change data in a landing zone 应用把变更写进落地区
    • Uses public APIs 使用公开 API
Three kinds of mirroring 三种镜像

镜像把业务系统的数据持续复制到 OneLake,成为 Delta 表,不用自己建管道。每个镜像数据库自带 SQL 分析端点,可以用 T-SQL 查询,用三段式名称和仓库联接,也能给 Spark 和 Direct Lake 报表用。后台复制计算免费,不占容量。

Key points

  • Database mirroring: replicates whole databases or chosen tables 数据库镜像:复制整个库或选定表
  • Metadata mirroring: syncs catalog only, data stays via shortcuts 元数据镜像:只同步目录,数据靠快捷方式
  • Open mirroring: your app writes change data to a landing zone 开放镜像:应用写变更到落地区
  • SQL analytics endpoint: query with T-SQL and three-part names SQL 端点:用三段式名称查询
  • Cost: replication compute is free, queries are charged normally 成本:复制免费,查询照常计费

Exam trap

Mirroring needs a running capacity. If the capacity is paused, nothing is replicated, even though replication itself does not consume capacity units. 镜像需要容量在运行;容量暂停就不复制,虽然复制本身不消耗容量单位。

Ingest with pipelines 用管道摄取数据

Use a Copy activity when the copy is one step of a pipeline, and a Copy job for simple full or incremental copies. 复制只是管道中的一步时用复制活动,单纯全量或增量复制用复制作业。

Choose the tool by what happens around the copy. A Copy activity lives inside a pipeline, so it can run after a Lookup, before a notebook, or inside a loop. A Copy job stands alone, keeps its own schedules and tracks incremental progress, resuming from the end of the last successful run after a failure.

  • The copy is one step in a larger workflow 复制只是大流程中的一步Copy activity in a pipeline 管道中的复制活动Chain with notebooks, stored procedures, loops 可串联笔记本、存储过程、循环
  • Only new or changed rows, no orchestration 只要新增或变更行,无需编排Copy job 复制作业Watermark or CDC, built-in schedules 水印或 CDC,自带计划
  • The source sits on a private on-premises network 源在本地私有网络Connection through an on-premises data gateway 通过本地数据网关的连接Install the gateway first, then add the connection 先装网关,再建连接
Which copy tool 选哪种复制工具

For an on-premises source, install the gateway inside your network, create an on-premises connection that points to the gateway cluster, and pick that connection in the Copy assistant or the Copy job wizard.

复制前后还要做别的事,就把复制活动放进管道,与查找、笔记本、循环串起来;只需要搬数据,就用复制作业,它自带计划,能自动记录增量进度,失败后从上次成功处继续。访问本地数据要先在内网装网关,再在“管理连接和网关”里建本地连接,然后在复制助手或复制作业里选它。

Key points

  • Copy activity: pipeline step that moves data before other activities transform it 复制活动:管道里的搬运步骤,之后再由其他活动转换
  • Copy job: no pipeline needed, own schedules, full or incremental copy 复制作业:无需管道,自带计划,全量或增量
  • Incremental copy: watermark or CDC, only CDC replicates deletes 增量复制:水印或 CDC,只有 CDC 同步删除
  • Connections: created in Manage connections and gateways, then reused 连接:在“管理连接和网关”中创建后复用
  • On-premises data gateway: reaches sources behind a firewall 本地数据网关:访问防火墙后面的数据源

Exam trap

One Copy activity can use only one on-premises data gateway, so an on-premises source and destination must share it. 一个复制活动只能用一个本地数据网关,本地源和本地目标必须共用。

Transform with PySpark, SQL, KQL 用 PySpark、SQL、KQL 转换

Match the language to the store: Spark for lakehouses, T-SQL for warehouses, KQL for eventhouses. 按存储选语言:湖仓用 Spark,仓库用 T-SQL,事件屋用 KQL。

Every Fabric store has a native transformation language. In a lakehouse, a notebook reads files or tables into a DataFrame, reshapes them with PySpark or Spark SQL, and writes Delta tables. In a warehouse, T-SQL statements such as CTAS and INSERT...SELECT build new tables, and they can read lakehouse tables with three-part names. In an eventhouse, KQL reshapes events as they arrive.

  • Lakehouse 湖仓

    Language 语言
    PySpark, Spark SQL
    Writes with 写入方式
    DataFrame write in Delta format
    Typical tool 常用工具
    Notebook or Spark job definition 笔记本
  • Warehouse 仓库

    Language 语言
    T-SQL
    Writes with 写入方式
    CTAS, INSERT...SELECT, MERGE
    Typical tool 常用工具
    SQL query editor 查询编辑器
  • Eventhouse 事件屋

    Language 语言
    KQL
    Writes with 写入方式
    Update policy 更新策略
    Typical tool 常用工具
    KQL queryset 查询集
Where each language writes 各语言在哪写数据

每种 Fabric 存储都有自己的转换语言。湖仓里用笔记本把文件或表读成 DataFrame,用 PySpark 或 Spark SQL 处理后写成 Delta 表;仓库里用 CTAS、INSERT...SELECT 等 T-SQL 建新表,还能用三段式名称读取湖仓表;事件屋里用 KQL 在数据到达时重塑事件。湖仓的 SQL 分析终结点只能读,不能写。

Key points

  • PySpark: withColumn, join, groupBy, then write Delta tables PySpark:withColumn、join、groupBy 后写成 Delta 表
  • Spark SQL: spark.sql() queries lakehouse tables from a notebook 在笔记本里用 spark.sql() 查湖仓表
  • T-SQL: CTAS and INSERT...SELECT build warehouse tables, even from lakehouses T-SQL:用 CTAS、INSERT...SELECT 建仓库表,可读湖仓表
  • SQL analytics endpoint: read-only, change lakehouse data with Spark SQL 分析终结点只读,改湖仓数据要用 Spark
  • KQL: extend, parse, mv-expand, summarize reshape events in an eventhouse KQL:用这些运算符在事件屋里重塑事件

Exam trap

You cannot INSERT, UPDATE or DELETE lakehouse Delta tables through the SQL analytics endpoint, because it is read-only. 不能通过 SQL 分析终结点对湖仓 Delta 表增删改,它是只读的。

Denormalize data 反规范化数据

Join related tables into wide dimension tables and keep facts narrow, so the model forms a star schema. 把相关表连接成宽维度表,事实表保持精简,组成星型架构。

Denormalizing trades some storage for simpler and faster queries. Join a chain of normalized tables, such as product, subcategory and category, into one dimension table, and keep keys and measures in the fact table. Reports then filter and group on dimension columns and summarize fact columns. Keep a snowflake only when a dimension is huge or facts relate to it at a higher grain.

  • Star, denormalized 星型

    Tables per entity 每个实体的表
    One wide table 一张宽表
    Filter path 过滤路径
    Short 短
    Storage 存储
    Some redundant values 有冗余
    Hierarchies 层次结构
    Built in one table 一张表内即可
  • Snowflake 雪花

    Tables per entity 每个实体的表
    Several linked tables 多张关联表
    Filter path 过滤路径
    Longer relationship chains 关系链更长
    Storage 存储
    Less redundancy 冗余少
    Hierarchies 层次结构
    Need a view that joins the tables 需连接视图
Star vs snowflake 星型 vs 雪花

反规范化用一点存储换来更简单、更快的查询:把产品、子类别、类别这类规范化链条连接成一张维度表,事实表只留键和度量。报表在维度列上筛选分组,在事实列上汇总。只有维度特别大,或事实表在更粗粒度上关联时才考虑雪花结构。

Key points

  • Denormalized dimension: one wide table holding product, subcategory and category 反规范化维度:一张宽表含产品、子类别、类别
  • Snowflake dimension: a normalized chain of tables for one entity 雪花维度:一个实体拆成多张规范化表
  • Star schema: fact table in the center, dimensions around it 星型架构:事实表居中,维度表环绕
  • Hierarchy: semantic model hierarchies use columns from one table only 层次结构:只能用同一张表的列
  • Flatten arrays: KQL mv-expand turns array elements into rows 展平数组:KQL mv-expand 把数组元素变成行

Exam trap

Keeping a snowflake just to save storage is usually wrong; dimensions are small, so denormalizing wins on speed and usability. 只为省存储而保留雪花结构通常是错的:维度表小,反规范化在速度和易用性上更划算。

Group and aggregate data 分组与聚合

Group rows by keys, then aggregate: groupBy in PySpark, GROUP BY in SQL, summarize in KQL. 按键分组再聚合:PySpark 用 groupBy,SQL 用 GROUP BY,KQL 用 summarize。

All three engines follow one idea: choose grouping keys, then apply aggregate functions to each group. Filter rows before grouping to cut work, and filter groups afterwards with HAVING in SQL or with a where after summarize in KQL. In T-SQL all null values in a grouping column form a single group, and most aggregate functions ignore nulls.

  • PySpark

    Group keys 分组键
    groupBy("Region")
    Aggregate 聚合
    .agg(sum("Amount"))
    Filter groups 过滤分组
    .filter() after agg
  • T-SQL

    Group keys 分组键
    GROUP BY Region
    Aggregate 聚合
    SUM(Amount)
    Filter groups 过滤分组
    HAVING
  • KQL

    Group keys 分组键
    by Region
    Aggregate 聚合
    summarize sum(Amount)
    Filter groups 过滤分组
    where after summarize
Same aggregation, three languages 同一聚合,三种语言

三种引擎思路一样:先选分组键,再对每组套聚合函数。分组前先过滤行能少算很多;分组后要过滤,SQL 用 HAVING,KQL 在 summarize 后面接 where。T-SQL 中分组列的所有空值归为一组,大多数聚合函数会忽略空值。

Key points

  • PySpark: df.groupBy(keys).agg(sum(...), avg(...)) PySpark:groupBy 之后接 agg
  • GROUP BY rule: every non-aggregated SELECT column must be grouped 规则:非聚合列都必须在 GROUP BY 中
  • HAVING: filters groups after aggregation, WHERE filters rows before HAVING 聚合后过滤分组,WHERE 先过滤行
  • ROLLUP and CUBE: subtotals and grand totals in one query ROLLUP 和 CUBE:一次查询出小计和总计
  • KQL summarize: aggregates by keys, bin() buckets time values KQL summarize:按键聚合,bin() 按时间分桶

Exam trap

KQL no longer bins datetime keys by hour automatically, so write bin(Timestamp, 1h) in the by clause yourself. KQL 不再自动按小时给时间分桶,要自己在 by 里写 bin(Timestamp, 1h)。

Duplicate, missing and late data 重复、缺失和迟到数据

Remove duplicates before loading, replace or flag missing values, and use MERGE and inferred members for late data. 加载前去重,补齐或标记缺失值,用 MERGE 和推断成员处理迟到数据。

Clean incoming data in a fixed order. First remove duplicates inside the batch, because an insert-only merge still inserts duplicates that exist within the new data. Next handle missing values: drop the row, fill a default, or point a failed dimension lookup to an Unknown member. Then upsert with MERGE. When a fact arrives before its dimension row, insert an inferred member.

  1. 1Deduplicate 去重dropDuplicates or ROW_NUMBER keeps one row per key 每个键留一行
  2. 2Fill gaps 补缺失na.fill, COALESCE, or the Unknown member key 默认值或未知成员
  3. 3Upsert 合并写入MERGE updates matches and inserts new rows 更新匹配、插入新行
  4. 4Late dimension 迟到维度Inferred member now, real attributes later 先插推断成员,后补属性
Cleaning a batch before it lands 批次落地前的清洗

按固定顺序清洗:先在批次内去重,因为只插入的 MERGE 遇到新数据内部的重复仍会插进去;再处理缺失值,删行、填默认值,或让查找失败的维度键指向“未知”成员;然后用 MERGE 更新插入。事实先到、维度后到时,先插一个推断成员,等详情到了再更新。

Key points

  • distinct or dropDuplicates: removes repeated rows from a Spark DataFrame 去掉 Spark DataFrame 中的重复行
  • ROW_NUMBER: number rows per key, then keep only row 1 每个键编号,只保留第 1 行
  • na.fill or COALESCE: substitute a default value for nulls 用默认值替换空值
  • MERGE: updates matched rows and inserts new rows in one statement 一条语句更新已匹配行、插入新行
  • Inferred member: placeholder dimension row flagged IsInferredMember, completed later 推断成员:先建占位维度行,之后补全

Exam trap

MERGE fails when several source rows match the same target row, so deduplicate the source before merging. 多个源行匹配同一目标行时 MERGE 会失败,所以合并前要先给源去重。

2.3 Streaming data 流数据

Choose a streaming engine 选择流处理引擎

Use Eventstream for no-code routing, Spark structured streaming for code-first lakehouse pipelines, and KQL for processing inside an eventhouse. 无代码路由用事件流,代码优先写湖仓用 Spark 结构化流,事件屋内处理用 KQL。

Start from the team's skills and where the data must land. Eventstream suits low-code teams that filter, aggregate and route events to several destinations at once. Spark structured streaming suits engineers who write PySpark and want durable Delta tables in a lakehouse. KQL fits when events already land in an eventhouse and must be reshaped or summarized there.

  • No-code ingestion and routing to many destinations 无代码摄取并路由到多个目标Eventstream 事件流Operators, windows, derived streams 运算符、窗口、派生流
  • Code-first processing into lakehouse Delta tables 代码优先写入湖仓 Delta 表Spark structured streaming Spark 结构化流Checkpoints, triggers, watermarks 检查点、触发器、水印
  • Reshape rows as they land in an eventhouse 数据进事件屋时重塑KQL update policy KQL 更新策略Runs at ingestion time 摄取时运行
  • Always fresh aggregates in an eventhouse 事件屋内始终最新的聚合KQL materialized view KQL 物化视图
Pick the streaming engine 选流处理引擎

先看团队技能和数据最终落在哪。事件流适合低代码团队,一边筛选聚合一边把事件同时发往多个目标;Spark 结构化流适合会写 PySpark、要在湖仓里落持久 Delta 表的工程师;事件已经进了事件屋、要在里面重塑或汇总时,用 KQL。

Key points

  • Eventstream: no-code capture, transform and routing to many destinations 事件流:无代码采集、转换、多目标路由
  • Spark structured streaming: PySpark code, Delta sink, stateful logic Spark 结构化流:写代码、输出 Delta、支持有状态逻辑
  • KQL update policy: transforms each ingestion batch inside an eventhouse KQL 更新策略:在事件屋中按摄取批次转换
  • KQL materialized view: keeps aggregations fresh in the background KQL 物化视图:后台保持聚合结果最新
  • Combine them: Eventstream can feed Eventhouse, Lakehouse or a Spark notebook 可组合:事件流可接事件屋、湖仓或 Spark 笔记本

Exam trap

An update policy runs per ingestion batch, so it cannot aggregate across batches; use a materialized view for aggregations. 更新策略按每个摄取批次运行,不能跨批聚合,聚合要用物化视图。

Native tables vs shortcuts 原生表与快捷方式

Ingest into native eventhouse tables for the fastest queries; use OneLake shortcuts to query data where it already lives. 想要最快查询就摄取到事件屋原生表;数据留在原处查询就用 OneLake 快捷方式。

A native table is the default home for streaming data. Eventstream or another connector ingests events, the eventhouse organizes them by arrival time, and every KQL feature applies. A OneLake shortcut leaves the data in a lakehouse, warehouse or external storage and queries it as an external table. Choose a shortcut when another item owns the data and copying it is not worth it.

  • Native table 原生表

    Data location 数据位置
    Inside the eventhouse 事件屋内
    Query syntax 查询写法
    Table name 直接用表名
    Speed 速度
    Fastest, indexed 最快,有索引
    Copy of data 数据副本
    Yes, ingested 有,已摄取
  • OneLake shortcut 快捷方式

    Data location 数据位置
    Stays at the source 留在源端
    Query syntax 查询写法
    external_table('name')
    Speed 速度
    Slower, remote reads 较慢,远程读取
    Copy of data 数据副本
    No 没有
Native table vs OneLake shortcut 原生表 vs 快捷方式

原生表是流数据的默认归宿:事件流等连接器把事件摄取进来,事件屋按到达时间组织数据,所有 KQL 功能都能用。OneLake 快捷方式把数据留在湖仓、仓库或外部存储,以外部表方式查询。数据归别的项目管、又不值得复制时,用快捷方式。反过来,打开 OneLake 可用性能让其他引擎读原生表。

Key points

  • Native table: data ingested and indexed by the eventhouse 原生表:数据被摄取进事件屋并建索引
  • OneLake shortcut: reference to internal or external data, nothing copied 快捷方式:引用内部或外部数据,不复制
  • Query a shortcut: use external_table() with the shortcut name 查询快捷方式:用 external_table() 加名称
  • Shortcut speed: network reads and no indexes make queries slower 快捷方式速度:网络读取、无索引,较慢
  • OneLake availability: exposes native tables as Delta to other engines OneLake 可用性:把原生表以 Delta 提供给其他引擎

Exam trap

A shortcut copies nothing into the eventhouse, so its queries read remote files and run slower than queries on native, indexed tables. 快捷方式不把数据复制进事件屋,查询要读远端文件,比原生索引表慢。

Accelerated vs standard shortcuts 加速与标准快捷方式

Turn on query acceleration when shortcut data needs near-native query speed; it caches recent data at extra storage and compute cost. 快捷方式数据需要接近原生的速度时开启查询加速,它缓存近期数据,但要付存储和计算成本。

Query acceleration closes most of the speed gap between a shortcut and an ingested table. The eventhouse caches and indexes data as it lands in OneLake, so new files are picked up without an ingestion pipeline or a duplicate copy to manage. It fits history joined with live streams, or small dimension data mirrored into OneLake. Keep a shortcut standard when it is queried rarely.

  • Shortcut data is queried often by dashboards 仪表板频繁查询快捷方式数据Accelerated shortcut 加速快捷方式Cache only the days queries need 只缓存查询需要的天数
  • Occasional exploration or archive lookups 偶尔探索或查归档Standard shortcut 标准快捷方式No cache storage cost 无缓存存储成本
  • Join live eventhouse streams with history in OneLake 实时流与 OneLake 历史数据联查Accelerated shortcut 加速快捷方式
  • You need materialized views on the data 需要在数据上建物化视图Ingest into a native table 摄取到原生表
Accelerate or not 要不要加速

查询加速把快捷方式和摄取表之间的速度差距补上大半:事件屋在数据落到 OneLake 时就缓存并建索引,新文件自动跟上,不用维护摄取管道或重复副本。适合历史数据与实时流联查,或镜像进 OneLake 的小维度数据。很少查询的快捷方式保持标准即可。

Key points

  • Standard shortcut: reads remote files on every query, no cache cost 标准快捷方式:每次查询读远端,无缓存成本
  • Query acceleration: caches and indexes shortcut data in the eventhouse 查询加速:在事件屋中缓存并索引快捷方式数据
  • Caching period: number of days kept, based on Delta modification time 缓存期:保留天数,按 Delta 修改时间算
  • Turn on: Accelerate toggle at creation, or Data policies later 开启:创建时打开加速,或之后在数据策略中打开
  • Cost: cached data counts toward eventhouse storage like native tables 成本:缓存数据像原生表一样计入存储

Exam trap

An accelerated shortcut still behaves like an external table, so features such as materialized views are not supported on it. 加速后的快捷方式仍然像外部表,不支持物化视图等功能。

Process data with Eventstream 用事件流处理数据

An eventstream connects sources to destinations, transforms events with no-code operators or a SQL operator, and publishes derived streams. 事件流把源接到目标,用无代码运算符或 SQL 运算符转换事件,并发布派生流。

Build an eventstream from left to right. Add one or more sources, which flow into the default stream. Insert operators to clean or reshape events, then attach destinations. Several destinations can read the same stream without interfering with each other. When other items should reuse a transformed stream, publish it as a derived stream so it appears in Real-Time hub.

  1. 1Sources 源Event Hubs, IoT Hub, CDC or a custom endpoint
  2. 2Default stream 默认流Events from the sources in one stream 源事件汇成一个流
  3. 3Operators 运算符Filter, Manage fields, Group by, Join or SQL 筛选、分组、联接等
  4. 4Derived stream 派生流Reusable output listed in Real-Time hub 在实时中心可复用
  5. 5Destinations 目标Eventhouse, Lakehouse, Activator, custom endpoint 事件屋、湖仓等
Inside an eventstream 事件流内部

事件流从左往右搭:先加一个或多个源,汇入默认流;中间插入运算符清洗或重塑事件;最后接目标。多个目标可以读同一个流,互不干扰。转换后的流要给别的项目复用时,发布成派生流,它会出现在实时中心。

Key points

  • Sources: Event Hubs, IoT Hub, Kafka, database CDC, custom endpoint 源:Event Hubs、IoT Hub、Kafka、数据库 CDC、自定义终结点
  • Operators: Filter, Manage fields, Aggregate, Group by, Union, Expand, Join 运算符:筛选、管理字段、聚合、分组、合并、展开、联接
  • Eventhouse destination: direct ingestion or event processing before ingestion 事件屋目标:直接摄取或摄取前处理
  • Derived stream: transformed stream listed in Real-Time hub for reuse 派生流:转换后的流,在实时中心可复用
  • SQL operator: Stream Analytics query language, can write several outputs SQL 运算符:Stream Analytics 查询语言,可多输出

Exam trap

Only Lakehouse, Eventhouse with processing, Derived stream and Activator accept operators before them; other destinations need a derived stream first. 只有这几类目标前面能接运算符,其他目标要先接派生流。

Spark structured streaming Spark 结构化流

Read with readStream, transform with DataFrames, then writeStream to Delta with a checkpoint and trigger. 用 readStream 读、DataFrame 转换,再用 writeStream 加检查点和触发器写入 Delta。

A structured streaming query treats its input as a table that keeps growing. You describe the source, the transformations and the sink, and Spark reruns the plan as new data arrives. The checkpoint makes the query restartable, so Spark resumes from the last committed progress. With a replayable source and a Delta sink, results are written exactly once.

  1. 1readStreamKafka, an eventstream or a Delta table 读取源
  2. 2Transform 转换select, filter, join, groupBy with a watermark 转换逻辑
  3. 3writeStreamDelta format and an output mode 格式和输出模式
  4. 4checkpointLocationProgress and state for restarts 重启所需进度和状态
  5. 5triggerprocessingTime, availableNow or real-time mode 触发方式
Anatomy of a streaming query 流查询的组成

结构化流把输入看成一张不断增长的表:你描述源、转换和输出,Spark 在新数据到来时反复执行。检查点让查询可以重启,从上次提交的进度继续。源可重放、输出是 Delta 时,结果恰好写入一次。按计划跑增量用 availableNow,常驻运行用 processingTime。

Key points

  • readStream: files, Delta tables, Kafka, Event Hubs or an eventstream readStream 源:文件、Delta 表、Kafka、Event Hubs、事件流
  • checkpointLocation: stores progress and state, one per query checkpointLocation:保存进度和状态,每个查询独用
  • availableNow trigger: processes available data, then stops availableNow 触发器:处理完现有数据就停止
  • processingTime trigger: micro-batches at a fixed interval or as fast as possible processingTime:按固定间隔或尽快跑微批
  • Output modes: append by default, update, or complete 输出模式:默认 append,另有 update、complete

Exam trap

start() and toTable() return immediately, so a scheduled job must call awaitTermination() or it can end while the stream should run. start() 和 toTable() 立即返回,计划作业要调用 awaitTermination(),否则可能提前结束。

Process data with KQL 用 KQL 处理数据

In an eventhouse, update policies transform rows at ingestion, materialized views keep aggregates fresh, and KQL operators shape results. 在事件屋中,更新策略在摄取时转换数据,物化视图保持聚合最新,KQL 运算符塑造结果。

Use KQL processing when events already land in an eventhouse. A raw table receives everything, and an update policy parses, filters or enriches each new batch into a clean table. On top of that, a materialized view keeps aggregates such as the latest record per device or daily counts. Query the view by name for full freshness, or with materialized_view() for speed.

  1. 1Raw table 原始表Eventstream or another connector lands raw events 原始事件落地
  2. 2Update policy 更新策略A KQL query parses and filters each batch 解析、过滤每批数据
  3. 3Clean table 清洗表Typed columns ready for queries 类型化的列
  4. 4Materialized view 物化视图summarize by key, refreshed in the background 后台更新聚合
A typical eventhouse pipeline 典型的事件屋处理链

事件已经进了事件屋时就用 KQL 处理:原始表接收所有数据,更新策略把每批新数据解析、过滤或丰富后写进清洗表;再在上面建物化视图,维护每台设备最新记录、每日计数等聚合。按名称查视图结果最新,用 materialized_view() 查更快。

Key points

  • Update policy: query runs on new source rows, writes a target table 更新策略:对新摄取行运行查询并写入目标表
  • IsTransactional true: if the policy fails, the source table isn't updated 事务性:策略失败时源表也不写入
  • Materialized view: aggregation over a table that always returns fresh results 物化视图:表上的聚合,结果始终最新
  • materialized_view(): queries only the materialized part, faster but maybe stale 只查已物化部分,更快但可能不是最新
  • Deduplicate: summarize take_any(*) or arg_max() by key in a view 去重:在视图中按键用 take_any 或 arg_max

Exam trap

The source and target tables of an update policy must be in the same database, with matching column types and order. 更新策略的源表和目标表必须在同一数据库,且列类型和顺序一致。

Windowing functions 窗口函数

Windows group streaming events by time: five window types in Eventstream, bin() in KQL, and window() in Spark. 窗口按时间给流事件分组:事件流有五种窗口,KQL 用 bin(),Spark 用 window()。

Pick the window by how results should be emitted. Eventstream uses the Stream Analytics query language, so its SQL operator supports all five types, and the Group by operator sets a window in its settings. In KQL, summarize by bin(Timestamp, 5m) builds tumbling style buckets. In Spark, groupBy(window(col, "5 minutes")) does the same, a slide duration makes windows overlap, and session_window() groups bursts.

  • Fixed, non-overlapping totals such as per minute counts 固定不重叠的统计,如每分钟计数Tumbling 翻转窗口
  • A 10 minute view refreshed every minute 每分钟刷新的 10 分钟视图Hopping 跳跃窗口
  • Output only when window content changes 只在窗口内容变化时输出Sliding 滑动窗口
  • Activity bursts separated by idle gaps 被空闲分隔的活动段Session 会话窗口
  • Events that share the exact same timestamp 时间戳完全相同的事件Snapshot 快照窗口
Pick a window 选窗口

按结果怎么输出来选窗口。事件流使用 Stream Analytics 查询语言,SQL 运算符支持全部五种窗口,分组运算符在设置里选窗口。KQL 里 summarize by bin(Timestamp, 5m) 形成翻转式的时间桶;Spark 里 groupBy(window(col, "5 minutes")) 效果相同,加上滑动间隔就会重叠,session_window() 则按活动段分组。

Key points

  • Tumbling: fixed size, no overlap, each event in one window 翻转:固定大小、不重叠,事件只属一个窗口
  • Hopping: fixed size that hops forward, windows overlap 跳跃:固定大小按步长前移,窗口重叠
  • Sliding: emits output only when an event enters or leaves 滑动:只在事件进出窗口时输出
  • Session: groups bursts, closes after a timeout or maximum duration 会话:聚集连续活动,超时或到最大时长关闭
  • Snapshot: groups events that share the same timestamp 快照:时间戳相同的事件归为一组

Exam trap

A hopping window whose hop size equals its window size behaves exactly like a tumbling window, not like a sliding one. 跳跃步长等于窗口大小时,就等同翻转窗口,而不是滑动窗口。

3.1 Monitor Fabric items 监控

Monitor data ingestion 监控数据摄取

Use the Monitor hub and pipeline run details to see what loaded, what failed, and where time went. 用监控中心和管道运行详情查看加载结果、失败位置和耗时分布。

Start broad, then drill down. The Monitor hub lists job runs across workspaces, with filters for status, item type and time. Opening a pipeline run shows its activities, inputs, outputs and errors. For a copy activity, the performance view splits the duration into phases, which tells you whether the source, the sink or queuing is slow.

  1. 1Find 查找Filter the hub by status, item type or time 按状态、类型、时间筛选
  2. 2Open run 打开运行Pipeline diagram, run ID and errors 流程图、运行 ID、错误
  3. 3Inspect activity 看活动Input, output, Duration breakdown 输入、输出、耗时分解
  4. 4Compare 对比Gantt view shows overlaps and delays 甘特图看重叠和延迟
  5. 5Act 处理Rerun all, from the failed activity, or from a chosen one 全部重跑或从失败处重跑
From the hub to one copy activity 从监控中心到单个复制活动

Export activity runs to CSV when you need to share or analyze them outside Fabric.

先在监控中心按状态、类型、时间筛选,再打开某次管道运行查看每个活动的输入、输出和错误。复制活动的性能视图会把耗时拆开,帮你判断慢在源端、目标端还是排队。甘特图适合比较多次运行的时长和重叠,活动运行可以导出 CSV。

Key points

  • Monitor hub: one list of job runs for items you can view 监控中心:汇总你有权查看的所有作业运行
  • View run history: workspace item menu shows recent pipeline runs 查看运行历史:工作区里直接看管道最近运行
  • Run detail view: diagram, run ID, errors and every activity run 运行详情:流程图、运行 ID、错误和每个活动
  • Copy activity details: Duration breakdown shows where the time went 复制活动详情:耗时分解看时间花在哪
  • Gantt view: one bar per run, length equals duration 甘特图:每次运行一根条,长度即时长

Exam trap

You only see runs for items you have permission to view, and a narrow time range hides older runs. An empty list is not proof that nothing ran. 只能看到有权限的项目,时间范围太窄也会漏掉旧运行,列表为空不代表没跑。

Monitor data transformation 监控数据转换

Track Spark notebooks and job definitions in the Monitor hub, and Dataflow Gen2 runs in refresh history. 在监控中心跟踪 Spark 笔记本和作业定义,在刷新历史里跟踪数据流 Gen2。

Spark work shows up as applications. Open one from the Monitor hub or from the item's Recent runs pane to reach the application detail page. Dataflow Gen2 has its own refresh history: each refresh lists the tables it loaded and the activities it ran, with rows and bytes read and written. Pick the view that answers your question.

  • Which pipeline started this notebook run 哪个管道触发了笔记本Monitor hub with the Upstream run column 监控中心加上游运行列
  • Driver, Livy or prelaunch logs 驱动、Livy、预启动日志Application detail, Logs tab 应用详情的日志页
  • Code and parameters used in that run 当次使用的代码和参数Item snapshots tab 项目快照页
  • Executor allocation over time 执行器随时间的分配Resources tab 资源页
  • Rows written by a dataflow destination 数据流写入目标的行数Refresh history, then the activity 刷新历史再点活动
Where to look 去哪里看

Spark 作业以应用的形式出现,可从监控中心或项目的“最近运行”进入应用详情页。数据流 Gen2 有自己的刷新历史,每次刷新都列出加载的表和执行的活动,以及读写的行数和字节数。按你要回答的问题选对视图。

Key points

  • Monitor hub: Spark apps from notebooks, job definitions and pipelines 监控中心:来自笔记本、作业定义和管道的 Spark 应用
  • Recent runs: item menu lists runs with status and duration 最近运行:项目菜单里列出状态和时长
  • Application detail: Jobs, Resources, Logs, Data and Item snapshots tabs 应用详情:作业、资源、日志、数据、快照
  • Item snapshots: notebook code and parameter values at run time 项目快照:运行时的代码和参数值
  • Dataflow refresh history: drill into tables and activities per refresh 数据流刷新历史:逐次查看表和活动

Exam trap

An empty Logs tab does not mean the code ran cleanly. Logs are missing when the job stayed queued or the cluster failed to start. 日志为空不代表代码没问题,作业一直排队或集群没启动时本来就没有日志。

Monitor semantic model refresh 监控语义模型刷新

Refresh history explains each attempt, Direct Lake refresh means framing, and the Capacity Metrics app shows the capacity cost. 刷新历史解释每次尝试,Direct Lake 刷新就是框架化,容量指标应用显示容量开销。

An Import refresh copies data, so it can be long and expensive. A Direct Lake refresh, called framing, reads Delta metadata and points the model at the newest Parquet files, so it usually takes seconds. Both report into refresh history, and both consume capacity as background operations you can review in the Capacity Metrics app.

  • Import 导入

    What it copies 复制什么
    All the data 全部数据
    Typical time 典型耗时
    Minutes or more 几分钟以上
    Automatic 自动
    Only on a schedule 靠计划
    Failures listed 失败记录
    Refresh history 刷新历史
  • Direct Lake

    What it copies 复制什么
    Metadata only 只有元数据
    Typical time 典型耗时
    Seconds 几秒
    Automatic 自动
    Keep your Direct Lake data up to date 自动更新开关
    Failures listed 失败记录
    Direct Lake tab in refresh history 刷新历史里的 Direct Lake 页
Import refresh vs Direct Lake framing 导入刷新 vs Direct Lake 框架化

导入刷新会复制全部数据,耗时长、成本高;Direct Lake 刷新叫框架化,只读 Delta 元数据并指向最新文件,通常几秒完成。两者都写入刷新历史,也都作为后台操作消耗容量,可以在容量指标应用里查看。

Key points

  • Refresh history: every attempt, automatic retries, Show link for details 刷新历史:每次尝试、自动重试、点“显示”看详情
  • Two phases: query cache refresh runs only after data succeeds 两个阶段:数据成功后才刷新查询缓存
  • Completed with warnings: data loaded, some calculations may break 带警告完成:数据已加载,部分计算可能出错
  • Framing: Direct Lake refresh points to newest Delta files 框架化:指向最新 Delta 文件
  • Capacity Metrics app: CU usage and throttling over 14 days 容量指标应用:14 天的 CU 使用和限流

Exam trap

A Direct Lake model answers from its last successful framing. If automatic updates are off or suspended after errors, new Delta data stays invisible. Direct Lake 模型只显示最近一次成功框架化的数据,自动更新关闭或因错误暂停时,新数据看不到。

Configure alerts 配置告警

Pick free failure emails, Activator rules, or Outlook and Teams activities based on which events and actions you need. 按需要的事件和动作,在免费失败邮件、Activator 规则、Outlook 和 Teams 活动之间选择。

Fabric offers several alert paths. Schedule failure emails are free and simple, but cover only scheduled runs. Activator rules react to job events such as Started, Succeeded or Failed and can post to Teams or run another item. Inside a pipeline, an Outlook or Teams activity on a failure path sends a custom message with run details.

  • Free email when a scheduled job fails 计划作业失败时免费邮件Schedule failure emails 计划失败邮件
  • Alert on Started or Succeeded, or trigger an action 启动、成功时告警或触发动作Activator rule on job events 作业事件上的 Activator 规则
  • Custom message right after one activity fails 某个活动失败后立刻发自定义消息Outlook or Teams activity on the failure path 失败分支上的 Outlook 或 Teams 活动
  • One rule for failures across a whole workspace 一条规则覆盖整个工作区的失败Workspace monitoring, KQL Queryset and Activator 工作区监控加 KQL 查询集和 Activator
Pick an alert path 选择告警方式

计划失败邮件免费、简单,但只覆盖计划运行;Activator 规则能对启动、成功、失败等作业事件告警,还能发 Teams 消息或运行其他项目。在管道内部,把 Outlook 或 Teams 活动接在失败分支上,可以发带运行详情的自定义消息。

Key points

  • Schedule failure emails: free, scheduled runs only, tenant users or groups 计划失败邮件:免费,只管计划运行,收件人限租户内
  • Activator rules: more job events, Teams messages and automated actions Activator 规则:更多事件、Teams 消息、自动动作
  • Real-Time hub: Job events, then Set alert 实时中心:作业事件,再设置告警
  • Outlook or Teams activity: notify from inside the pipeline flow Outlook 或 Teams 活动:在管道内部发通知
  • Workspace monitoring: needed for Activator job alerts in the Monitor hub 工作区监控:监控中心的 Activator 告警需要它

Exam trap

One Outlook activity wired to two activities on failure fires only when both fail. Use a separate notification activity for each activity you watch. 一个 Outlook 活动同时接两个活动的失败分支时,两个都失败才会发;每个被监控的活动要单独接一个通知。

3.2 Identify and resolve errors 排查错误

Resolve pipeline errors 排查管道错误

Read the failed activity's error, then fix the cause, retry transient faults, or fail on purpose with a clear message. 先读失败活动的错误,再修正原因、对瞬时故障重试,或用清晰消息主动失败。

Start with the failed activity in the run detail view. Its error message and input usually tell you whether the fault is transient, such as a network blip, or an authoring problem, such as a wrong parameter type. Transient faults call for retries; authoring problems call for a fix and a rerun from the failed activity.

  • Short network or service outage 短暂的网络或服务中断Enable retries with a retry interval 开启重试并设置间隔
  • Token error after the author's password changed 作者改密码后报令牌错误Edit and save the pipeline again 重新编辑并保存管道
  • Child pipeline says an array parameter is a String 子管道说数组参数是字符串Wrap the value with the create array function 用创建数组函数包装
  • Payload too large 负载过大Stop passing large values between activities 不要在活动间传大值
  • A business rule is broken 违反业务规则If Condition plus a Fail activity 条件判断加失败活动
Match the symptom to the fix 症状对应的处理

先在运行详情里看失败活动的错误和输入,判断是网络抖动这类瞬时故障,还是参数类型写错这类设计问题。瞬时故障靠重试,设计问题要修正后从失败的活动重跑。

Key points

  • Run detail view: error, input and output for each activity 运行详情:每个活动的错误、输入和输出
  • Retry and retry interval: absorb transient network or service faults 重试和重试间隔:吸收瞬时网络或服务故障
  • Timeout: default 12 hours per activity, lower it to fail fast 超时:每个活动默认 12 小时,调小可尽快失败
  • Fail activity: custom error message and code for rule violations 失败活动:自定义错误消息和代码
  • Deactivate: skip an activity and mark it Succeeded, Failed or Skipped 停用:跳过活动并标记成功、失败或跳过

Exam trap

When the pipeline author's password changes or credentials are revoked, saved pipelines can fail on token errors. Edit and save each affected pipeline to refresh its auth context. 作者改密码或凭据被吊销后,已保存的管道会出现令牌错误;逐个编辑并保存受影响的管道即可刷新认证。

Resolve Dataflow Gen2 errors 排查数据流 Gen2 错误

Separate publish errors from refresh errors, then use refresh details, detailed logs and gateway checks to find the cause. 先区分发布错误和刷新错误,再用刷新详情、详细日志和网关检查找原因。

A Dataflow Gen2 problem shows up in one of two places. A publish problem appears as an indicator next to the dataflow name after you publish your draft. A refresh problem appears in refresh history, where each failed table or activity carries its own error details. Some failures have well known causes and fixes.

  • Gateway refresh fails reading staged data 网关刷新读取暂存数据失败Allow outbound TCP 1433, or disable staging and fast copy 放行出站 1433,或关闭暂存和快速复制
  • Downstream model fails with key didn't match any rows 下游模型报键不匹配任何行Write to a Lakehouse or Warehouse and read it there 写到湖仓或仓库再从那里读
  • Insufficient permissions for staging artifacts 暂存项目权限不足First dataflow creator in the workspace signs in again 工作区首个数据流创建者重新登录
  • Need engine level detail 需要引擎级细节Download detailed logs 下载详细日志
Common failures and fixes 常见失败与处理

数据流 Gen2 的问题出现在两个地方:发布草稿后,发布错误会以名称旁的提示出现;刷新错误出现在刷新历史中,每个失败的表或活动都有自己的错误详情。上面列出几类常见失败及其处理方法。

Key points

  • Publish errors: icon next to the name, edit from the last draft 发布错误:名称旁的图标,从最后草稿继续编辑
  • Refresh details: open the failed table or activity for the error 刷新详情:打开失败的表或活动看错误
  • Detailed logs: Mashup engine records, kept up to 28 days 详细日志:混合引擎记录,最多保留 28 天
  • Gateway and staging: reading staged data needs outbound TCP 1433 网关与暂存:读取暂存数据需出站 TCP 1433
  • Repeated failures: the refresh schedule pauses and the owner gets email 连续失败:计划刷新暂停并邮件通知所有者

Exam trap

Tables can show Succeeded while the destination write activity failed. Check the Activities section too before you call a refresh healthy. 表可能显示成功,而写入目标的活动却失败了;判断刷新正常前还要看活动部分。

Resolve notebook errors 排查笔记本错误

Match the error to its layer: session, access, capacity, or Spark code and memory, then apply that layer's fix. 先判断错误属于会话、权限、容量还是 Spark 代码和内存,再用对应办法处理。

Notebook failures fall into layers. Session and access errors stop you before code runs. Capacity errors such as HTTP 430 mean the capacity has no room for another Spark job. Code errors surface in the cell output and the Spark UI, where the Executors and Stages tabs reveal memory pressure and data skew.

  • Session timed out after inactivity 会话因闲置超时Rerun, or raise the timeout in notebook or workspace settings 重跑,或在笔记本或工作区调大超时
  • Capacity is paused 容量已暂停Fabric admin resumes the capacity 管理员恢复容量
  • HTTP 430 too many requests for capacity HTTP 430 容量请求过多Fewer concurrent jobs, Autoscale Billing, or larger SKU 减少并发、自动缩放计费或更大 SKU
  • Executors killed with exit code 137 执行器以退出码 137 被杀More memory via %%configure, repartition, fix skew 用 %%configure 加内存、重新分区、处理倾斜
  • Excessive query complexity 查询过于复杂Break the query into staged steps 拆成分阶段的查询
Symptom to fix 症状到处理

笔记本故障分层:会话和权限错误让代码根本跑不起来;HTTP 430 这类容量错误说明容量已经放不下新的 Spark 作业;代码错误出现在单元格输出和 Spark UI 里,执行器页和阶段页能看出内存压力和数据倾斜。

Key points

  • Session timeout: idle sessions stop after 20 minutes by default 会话超时:默认空闲 20 分钟停止
  • Paused capacity: an admin resumes it in the admin portal 容量已暂停:管理员在管理门户恢复
  • HTTP 430: capacity Spark limit reached, reduce concurrency or scale HTTP 430:容量 Spark 上限,降并发或扩容
  • Exit code 137: executor out of memory, check skew and partitions 退出码 137:执行器内存不足,查倾斜和分区
  • Fix with Copilot: summary, root cause and suggested code fix 用 Copilot 修复:摘要、根因和建议改法

Exam trap

spark.conf.set cannot change executor or driver memory in a running session. Put those settings in a %%configure first cell or in the environment. spark.conf.set 改不了运行中会话的执行器或驱动内存,要放进第一个 %%configure 单元格或环境里。

Resolve Eventhouse errors 排查 Eventhouse 错误

Query ingestion failures, check whether an update policy caused them, then fix the schema or query and reingest. 查询摄取失败,确认是否由更新策略引起,再修正架构或查询并重新摄取。

Most Eventhouse ingestion problems are found with management commands. The .show ingestion failures command lists failures from ingestion commands with the table, details and whether the failure is permanent or transient. Update policies add a second place to fail, because their query runs on every new batch and must return the target table's exact schema.

  1. 1Notice 发现Target table has fewer rows than the source 目标表行数比源表少
  2. 2Query 查询.show ingestion failures filtered on OriginatesFromUpdatePolicy 按来自更新策略筛选
  3. 3Read 阅读Details and FailureKind, such as a schema mismatch 详情和失败类型,比如架构不匹配
  4. 4Fix 修复Align the function output with the target columns 让函数输出与目标列一致
  5. 5Reload 重载Reingest the affected data 重新摄取受影响的数据
Tracing missing rows in a target table 追查目标表缺失的行

For trends over time, workspace monitoring stores ingestion results in the EventhouseIngestionResultsLogs table.

Eventhouse 摄取问题大多用管理命令排查。.show ingestion failures 列出摄取命令的失败,含表名、详情和永久或瞬时类型。更新策略多了一个失败点:它对每批新数据运行查询,输出必须与目标表架构完全一致。要看长期趋势,可用工作区监控的摄取结果日志表。

Key points

  • .show ingestion failures: command failures, kept 14 days 摄取失败命令:保留 14 天
  • FailureKind: Permanent or Transient, check before retrying 失败类型:永久或瞬时,重试前先看
  • OriginatesFromUpdatePolicy: true when an update policy raised it 来自更新策略:为 true 表示由策略引起
  • IsTransactional true: a policy failure blocks source and target 事务性为 true:策略失败则源和目标都不写
  • Schema match: function output must match target column types and order 架构匹配:函数输出须与目标列类型和顺序一致

Exam trap

With the default non-transactional update policy, a failed transformation still loads the source table. Ingestion reports success while the target table silently misses rows. 默认非事务性更新策略下,转换失败时源表照样写入,摄取显示成功,目标表却悄悄缺数据。

Resolve Eventstream errors 排查事件流错误

Use Data insights to spot where events stall or fail, Runtime logs for the error text, and schema tools for mismatches. 用数据洞察找事件卡住或失败的位置,用运行时日志看错误原文,用架构工具处理不匹配。

Select a node on the editor canvas, then read the lower pane. Data insights charts show whether events arrive, back up or fail at that node. Runtime logs list the engine's messages by severity. Schema problems show up as conversion errors at a destination, so compare the inferred schema with the target table.

  • Events arrive but pile up 事件到达但堆积Backlogged input events and watermark delay 积压输入事件和水印延迟
  • Events can't be parsed 事件无法解析Deserialization errors, confirm JSON, CSV or Avro 反序列化错误,确认格式
  • Output doesn't fit the destination 输出不符合目标Data conversion errors, fix with Manage fields 数据转换错误,用管理字段修正
  • Need the exact error text 需要错误原文Runtime logs filtered by severity 按级别筛选运行时日志
Symptom to check 症状与检查点

在编辑器画布上选中节点,再看下方窗格。数据洞察图表显示事件在该节点是否到达、积压或失败;运行时日志按级别列出引擎消息。架构问题通常在目标处表现为数据转换错误,要把推断的架构和目标表对比。

Key points

  • Data insights: per node metrics such as input, output and backlog 数据洞察:每个节点的输入、输出、积压
  • Runtime logs: warning, error and information entries from the engine 运行时日志:引擎的警告、错误、信息
  • Deserialization errors: input events the engine can't read 反序列化错误:引擎读不了的输入事件
  • Data conversion errors: output events that don't fit the expected schema 数据转换错误:不符合预期架构的输出事件
  • Input schema: guides operator design but doesn't filter events 输入架构:指导算子设计但不过滤事件

Exam trap

Editing an inferred schema changes how the eventstream interprets fields, not the data itself. Use the Manage fields operator to rename fields or convert types. 编辑推断的架构只改变事件流对字段的理解,不改数据;要改名或转类型请用“管理字段”算子。

Resolve T-SQL errors 排查 T-SQL 错误

Check whether a statement is supported, handle snapshot isolation conflicts with retries, and use query insights to find slow or failed queries. 先确认语句是否支持,用重试处理快照隔离冲突,用查询洞察找慢查询和失败查询。

Fabric Data Warehouse speaks T-SQL, but not every SQL Server statement. When a script fails, first check the surface area list, then the transaction rules. Locks are taken per table, so concurrent updates and long DDL can block or abort each other. For history, the queryinsights views keep completed queries for 30 days.

  • Statement isn't supported 语句不受支持Rewrite with a supported pattern 改用受支持的写法
  • Snapshot isolation update conflict 快照隔离更新冲突Retry with backoff, avoid concurrent writes to the table 带退避重试,避免同表并发写
  • Queries wait behind DDL 查询被 DDL 阻塞Check sys.dm_tran_locks, run DDL in a maintenance window 查锁,维护窗口执行 DDL
  • INSERT fails on a lakehouse SQL analytics endpoint 湖仓 SQL 终结点插入失败Write with Spark, or use a Warehouse 用 Spark 写或改用仓库
  • Need slow or failed queries from last week 需要上周的慢查询或失败查询queryinsights views queryinsights 视图
Error to action 错误与处理

Fabric 数据仓库使用 T-SQL,但不支持 SQL Server 的全部语句。脚本失败时先查表面区域列表,再看事务规则。锁按表获取,并发更新和长时间 DDL 会互相阻塞或中止。查历史用 queryinsights 视图,已完成查询保留 30 天。

Key points

  • Unsupported commands: triggers, synonyms, recursive queries, SET ROWCOUNT 不支持:触发器、同义词、递归查询、SET ROWCOUNT
  • SQL analytics endpoint: read only, table DDL and DML need a Warehouse SQL 分析终结点只读,建表和改数据要用仓库
  • Snapshot isolation: always applied, isolation level changes are ignored 快照隔离:始终生效,改隔离级别会被忽略
  • Write-write conflicts: checked per table, retry the failed transaction 写写冲突:按表检查,重试失败的事务
  • Query insights: 30 days of history, failed and long running queries 查询洞察:30 天历史,含失败和长时间查询

Exam trap

Two transactions updating different rows of the same table can still conflict, because Fabric Data Warehouse checks conflicts at the table level, not the row level. 两个事务更新同一张表的不同行也会冲突,因为冲突按表检查,不按行。

Resolve OneLake shortcut errors 排查 OneLake 快捷方式错误

Most shortcut failures come from a moved target, missing permissions on either side, or a broken cloud connection. 快捷方式故障多半来自目标被移动、任一侧权限不足或云连接失效。

A shortcut behaves like a symbolic link, so it depends on three things outside itself: the target path must still exist, the user needs permission on both the shortcut path and the target, and external shortcuts need a working cloud connection. Check them in that order.

  • Shortcut fails after the source folder was renamed 源文件夹改名后快捷方式失效Manage shortcut and update the target location 管理快捷方式,更新目标位置
  • Many shortcuts fail after the connection owner left 连接创建者离职后大量快捷方式失效Replace the connection once in Shortcut connections 在快捷方式连接中一次性替换
  • User can read but not write through the shortcut 能读不能写Grant write on both the shortcut path and the target 两侧都授予写权限
  • ADLS account sits behind a storage firewall ADLS 账户在防火墙后Configure trusted workspace access 配置受信任的工作区访问
Symptom to fix 症状与处理

快捷方式类似符号链接,依赖三件事:目标路径仍然存在,用户对快捷方式路径和目标都有权限,外部快捷方式的云连接可用。按这个顺序检查。

Key points

  • Broken target: moving, renaming or deleting the target breaks the shortcut 目标失效:移动、改名、删除目标会断开
  • Most restrictive wins: access uses the tighter of shortcut and target 最严格者生效:取两侧更严的权限
  • Cloud connections: ADLS and S3 shortcuts authorize through a connection 云连接:ADLS 和 S3 快捷方式靠连接授权
  • Replace connection: lakehouse Settings, Shortcut connections, then Replace 替换连接:湖仓设置 > 快捷方式连接 > 替换
  • Cross-tenant ADLS: use a service principal or SAS token 跨租户 ADLS:用服务主体或 SAS 令牌

Exam trap

Deleting a shortcut never deletes target data, but deleting a file or folder inside the shortcut does, if you have write permission on the target. 删除快捷方式不会删目标数据,但在快捷方式里删文件或文件夹会删到目标,前提是你对目标有写权限。

3.3 Optimize performance 性能优化

Optimize Lakehouse tables 优化湖仓表

OPTIMIZE compacts small files, V-Order or Z-Order shapes the layout, and VACUUM reclaims storage. OPTIMIZE 合并小文件,V-Order 或 Z-Order 调布局,VACUUM 回收存储。

Streaming and frequent small writes leave a Delta table with many small files, and every reader pays for them. OPTIMIZE rewrites them into right sized files. Add ZORDER BY for columns you often filter on together, and VORDER when Power BI or other read heavy consumers matter. New workspaces write without V-Order by default.

  • OPTIMIZE

    Goal 目标
    Faster reads 读得更快
    Acts on 作用对象
    Small active files 小的活动文件
    Options 选项
    ZORDER BY, VORDER
    Runs in 在哪运行
    Spark or lakehouse Maintenance Spark 或湖仓维护
  • VACUUM

    Goal 目标
    Less storage 更省存储
    Acts on 作用对象
    Old unreferenced files 无引用的旧文件
    Options 选项
    RETAIN, DRY RUN, LITE
    Runs in 在哪运行
    Spark or lakehouse Maintenance Spark 或湖仓维护
OPTIMIZE vs VACUUM 两个命令的区别

When you combine them, Spark compacts first, then applies Z-Order, then V-Order. Run VACUUM after compaction to drop the replaced files. It is a Spark command, so it fails in the SQL analytics endpoint.

流式写入和频繁的小批写入会让 Delta 表堆积大量小文件,拖慢所有读取。OPTIMIZE 把它们合并成大小合适的文件;经常一起筛选的列加 ZORDER BY,给 Power BI 等读多场景用时加 VORDER。新工作区默认写入时不开 V-Order。两者一起用时顺序是:先装箱压缩,再 Z-Order,最后 V-Order。压缩后运行 VACUUM 删掉被替换的旧文件;它是 Spark 命令,在 SQL 分析终结点里跑不了。

Key points

  • OPTIMIZE: bin compaction merges many small Parquet files into fewer large ones OPTIMIZE:把大量小文件合并成少量大文件
  • V-Order: write-time Parquet layout tuned for reads, writes take longer V-Order:写入时为读取优化布局,写入变慢
  • Z-Order: colocates rows on filter columns, named again on every OPTIMIZE Z-Order:按筛选列聚集数据,每次 OPTIMIZE 都要重写列名
  • VACUUM: deletes unreferenced files older than retention, seven days by default VACUUM:删除超过保留期的无引用文件,默认 7 天
  • Auto compaction: compacts right after writes when small files pile up 自动压缩:写入后小文件过多就自动合并

Exam trap

VACUUM only cleans up storage and does not speed up queries, and a short retention removes the files that time travel needs. VACUUM 只清理存储、本身不提速;保留期太短会删掉时间旅行要用的文件。

Optimize pipelines 优化管道

Speed up copies with more throughput, more threads per copy, parallel ForEach iterations and partitioned source reads. 通过提高吞吐、单次复制线程数、ForEach 并行迭代和分区读取来加速复制。

Copy speed is capped by the slowest of the source, the destination and the network between them. Scale at two levels. Inside one Copy activity, raise intelligent throughput optimization and let the degree of copy parallelism add threads. Across many tables, run copies at the same time from a ForEach with Sequential cleared.

  • One big copy is slow 单个大复制太慢Intelligent throughput optimization 智能吞吐优化Let the service add compute 让服务加算力
  • The source database is overloaded 源库压力太大Lower degree of copy parallelism 调低复制并行度
  • A large SQL table loads slowly 大 SQL 表加载慢Partition option 分区选项Physical partitions or dynamic range 物理分区或动态范围
  • Many tables load one by one 很多表逐个加载ForEach with Sequential off and a batch count ForEach 关闭顺序并设批次数
  • Warehouse COPY cannot read the source format 仓库 COPY 读不了源格式Enable staging 启用暂存
Pick the lever 选哪个开关

With a partition option set, the copy runs as many partition queries in parallel as the degree of copy parallelism allows.

复制速度取决于源、目标和两者之间网络中最慢的一环。可以在两个层面扩展:单个复制活动内,提高智能吞吐优化,让复制并行度增加线程;多张表时,用 ForEach 并取消勾选 Sequential,让多个复制同时跑。设置了分区选项后,并行运行的分区查询数由复制并行度决定。

Key points

  • Intelligent throughput optimization: service sizes CPU, memory and network per copy run 智能吞吐优化:服务按次分配 CPU、内存和网络
  • Degree of copy parallelism: maximum threads reading or writing inside one copy 复制并行度:单个复制活动内的最大线程数
  • ForEach batch count: items that run at once when Sequential is off ForEach 批次数:非顺序模式下同时运行的项数
  • Partition option: physical partitions or dynamic range split large SQL reads 分区选项:按物理分区或动态范围拆分大表读取
  • Staging: interim store converts data into a COPY friendly format 暂存:用临时存储把数据转成 COPY 能读的格式

Exam trap

Partition upper and lower bounds only set the partition stride. They never filter rows, so every row is still copied. 分区上下界只决定拆分步长,不会过滤数据,所有行仍会被复制。

Optimize a warehouse 优化数据仓库

Keep statistics fresh, let result set caching serve repeat queries, cluster big tables, and find slow queries with query insights. 保持统计信息新鲜,让结果集缓存服务重复查询,给大表做数据聚类,用查询见解找慢查询。

The warehouse compacts files and creates statistics for you, but your design still matters. Use the smallest data types that fit, keep join columns on the same type, and load in batches with COPY INTO instead of many single row inserts. When a load changes data a lot, update statistics before users arrive so their first queries do not pay for the refresh.

Fabric Warehouse

  • Statistics统计信息

    • Auto created when a query needs them 查询需要时自动创建
    • CREATE or UPDATE STATISTICS, single column only 手动只支持单列
  • Result set caching结果集缓存

    • On by default for warehouses and SQL endpoints 默认开启
    • Invalidated when referenced tables change 表变化后失效
  • Data clustering数据聚类(预览)

    • Defined with CLUSTER BY, up to four columns 用 CLUSTER BY 定义
    • Best for large tables and mid to high cardinality filters 适合大表和中高基数筛选
  • Query insights查询见解

    • Long running and frequently run queries 长时间和高频查询
    • CPU time and cache hits per request 每个请求的 CPU 时间和缓存命中
Warehouse tuning tools 仓库调优工具

仓库会自动压缩文件、创建统计信息,但设计仍然重要:用够用的最小数据类型,连接列类型保持一致,用 COPY INTO 批量加载而不是逐行插入。大批数据变化后,在用户来之前先更新统计信息,免得早上的第一批查询替你等统计刷新。

Key points

  • Statistics: created automatically at query time, update manually after big loads 统计信息:查询时自动创建,大批加载后可手动更新
  • Result set caching: on by default, reuses results of repeated queries 结果集缓存:默认开启,重复查询直接用缓存
  • Data clustering: CLUSTER BY at creation, skips files on filters 数据聚类:建表时指定,按筛选跳过文件
  • Query insights: views keep 30 days of completed query history 查询见解:保留 30 天查询历史
  • Batch writes: avoid trickle inserts that create many small Parquet files 批量写入:避免零碎插入产生大量小文件

Exam trap

Data clustering cannot be added to an existing table with ALTER TABLE. Recreate the table with CTAS and CLUSTER BY instead. 已有表不能用 ALTER TABLE 加数据聚类,要用 CTAS 加 CLUSTER BY 重建。

Optimize Eventstream and Eventhouse 优化事件流和事件屋

Tune Eventhouse with batching, caching, retention and partitioning policies, and size an eventstream with its throughput level. 用批处理、缓存、保留和分区策略调优事件屋,用吞吐级别调整事件流。

Queued ingestion waits to build bigger batches, so data shows up later but costs less. If data arrives too late and volume is low, shorten the batching time on that table. Keep the data people query most in the hot cache, and let the retention policy drop old data automatically. Data that is outside the hot cache but inside retention stays queryable, only slower.

  1. 1Eventstream 事件流Throughput level sized for the incoming rate 按流量选吞吐级别
  2. 2Batching 批处理Sealed by time, count or size 按时间、数量或大小封批
  3. 3Extents 数据分片Optional partitioning policy regroups by key 可选分区策略按键重组
  4. 4Hot cache 热缓存Recent data on SSD for fast queries 近期数据放 SSD
  5. 5Retention 保留Older data removed after the period 超期数据被删除
From event to query 从事件到查询

排队引入会先攒成大批次再写入,数据出现得晚一点但更省钱。数据量小又嫌延迟高时,缩短该表的批处理时间。常查的数据放进热缓存,旧数据交给保留策略自动删除;在保留期内但不在热缓存的数据照样能查,只是慢一些。

Key points

  • Ingestion batching policy: seals a batch on time, item count or size 引入批处理策略:按时间、文件数或大小封批
  • Caching policy: hot data on local SSD, never longer than retention 缓存策略:热数据放本地 SSD,不能超过保留期
  • Retention policy: removes data older than the soft delete period 保留策略:自动删除超过软删除期的数据
  • Partitioning policy: mainly for frequent filters on high cardinality string keys 分区策略:主要用于高基数字符串列的频繁筛选
  • Eventstream throughput: Low, Medium or High level in eventstream settings 事件流吞吐:在设置里选低、中、高

Exam trap

Setting the batching time very low can raise cost and even increase end to end latency, so lower it only to your real latency need. 批处理时间设得太低会更贵,甚至更慢,只按实际延迟需求下调。

Optimize Spark performance 优化 Spark 性能

Turn on the native execution engine, pick a resource profile that matches the workload, then fix skew and small files. 打开原生执行引擎,按负载选资源配置文件,再处理数据倾斜和小文件。

Start with the engine. The native execution engine runs supported Spark operators in vectorized C++ and falls back to the JVM for anything it cannot handle, such as JSON or XML reads. Turn it on in the environment Acceleration tab, or per session with spark.native.enabled. Then match the resource profile to the workload.

  • Ingestion and ETL with frequent writes 频繁写入的引入和 ETLwriteHeavyDefault for new workspaces, V-Order off 新工作区默认,V-Order 关闭
  • Spark jobs that mostly read 以读为主的 Spark 作业readHeavyForSpark
  • Delta tables served to Power BI 供 Power BI 使用的 Delta 表readHeavyForPBIV-Order and optimize write on 开启 V-Order 和优化写入
  • None of these fit 都不合适custom
Pick a resource profile 选资源配置文件

For a slow stage, look for skew in the Spark UI, keep adaptive query execution on, and tune shuffle partitions.

先从引擎入手:原生执行引擎用向量化 C++ 执行支持的算子,遇到不支持的(比如读 JSON、XML)自动回退到 JVM。在环境的 Acceleration 页打开,或在会话里设 spark.native.enabled。然后按负载选资源配置文件。某个阶段慢时,在 Spark UI 里查倾斜,保持自适应查询执行开启,再调整洗牌分区数。

Key points

  • Native execution engine: vectorized C++, no code changes, automatic fallback 原生执行引擎:向量化 C++,不改代码,自动回退
  • Resource profiles: writeHeavy default, readHeavyForSpark, readHeavyForPBI or custom 资源配置文件:默认 writeHeavy,可选读多型或自定义
  • Optimize write: bins data before writing, so fewer small files 优化写入:写前装箱,减少小文件
  • AQE: coalesces partitions, switches to broadcast joins, handles skew AQE:合并分区、改用广播连接、处理倾斜
  • Autotune: learns shuffle partitions, broadcast threshold and partition bytes per query 自动调优:按查询学习三个 Spark 参数

Exam trap

Repartition rebalances data with a shuffle. Coalesce only reduces partitions without a shuffle, so it does not even out skewed partitions. repartition 通过洗牌重新均衡;coalesce 只减少分区不洗牌,不能均衡倾斜。

Optimize query performance 优化查询性能

Process less data. Filter early, return only the columns you need, and choose the cheapest operator for the job. 少处理数据:尽早筛选,只返回需要的列,选最省资源的运算符。

Every engine runs faster when it touches less data. In T-SQL against a warehouse or SQL analytics endpoint, name the columns you need, filter before joins, and keep join columns on the same data type to avoid conversions. Lakehouse tables read through the endpoint also need healthy files, so compact them and avoid high cardinality partitions.

  • T-SQL

    Cut columns 减少列
    Avoid SELECT * 别用 SELECT *
    Filter early 尽早筛选
    WHERE before JOIN 先 WHERE 后 JOIN
    Comparisons 比较
    Matching data types 类型一致
    Big joins 大表连接
    Read the plan with SHOWPLAN_XML 看执行计划
  • KQL

    Cut columns 减少列
    project only what you need 只 project 需要的列
    Filter early 尽早筛选
    where right after the table 表后立即 where
    Comparisons 比较
    has, ==, case sensitive 用 has 和 ==
    Big joins 大表连接
    Broadcast or shufflekey hints 用连接提示
Same rules, two languages 同样的原则,两种语言

In KQL, put datetime filters first, then term filters on strings, then numeric filters, and leave column scans such as contains for last.

任何引擎都是处理的数据越少越快。对仓库或 SQL 分析终结点写 T-SQL 时,只列需要的列,先筛选再连接,连接列类型保持一致以免转换。通过终结点读取的湖仓表也要文件健康:定期压缩,避免高基数分区。KQL 里先放时间筛选,再放字符串整词筛选,然后数值筛选,contains 这类扫描放最后。

Key points

  • Column list: avoid SELECT *, return only the columns you need 列清单:别用 SELECT *,只返回需要的列
  • Filter before join: shrink rows early in the engine, not the client 先筛后连:在引擎里尽早减少行,别在客户端过滤
  • KQL where first: put datetime filters right after the table reference KQL 先 where:表名后先按时间列筛选
  • has vs contains: has matches whole terms, contains finds substrings has 匹配整词,contains 找子串
  • Join hints: broadcast a small left side, shufflekey two big sides 连接提示:左小广播,两边大用 shufflekey

Exam trap

has matches whole terms only, so it misses text buried inside a longer word. Use contains only when you truly need a substring. has 只匹配整词,藏在长单词里的文本会漏掉;确实要子串时才用 contains。