@metabase/cli 0.3.1 → 0.3.2-alpha.fix-transform-test-ee-path.8ac2a7a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-collection-CYDUm_XO.mjs → add-collection-B_-eMU_k.mjs} +6 -9
- package/dist/{alert-ClyhtxIz.mjs → alert-Dalin_DD.mjs} +7 -7
- package/dist/{alerts-Dt3D1gcz.mjs → alerts-DpBgrjPI.mjs} +7 -7
- package/dist/{append-Bl_Ensmr.mjs → append-C1JNVALm.mjs} +5 -5
- package/dist/{archive-BOyKhNOz.mjs → archive-52ZHbFDm2.mjs} +6 -6
- package/dist/{archive-DiGxCojL.mjs → archive-B51prFgS.mjs} +4 -4
- package/dist/{archive-CWceyy8x.mjs → archive-BkITQyWW.mjs} +5 -5
- package/dist/{archive-BJZ7Dace.mjs → archive-CISXgZAI.mjs} +6 -6
- package/dist/{archive-D3a3Wgz0.mjs → archive-CdKf_Eqq.mjs} +4 -4
- package/dist/{archive-DVGDg8mP.mjs → archive-CicPYX27.mjs} +6 -6
- package/dist/{archive-CNblz55j.mjs → archive-CwITzj_j.mjs} +6 -6
- package/dist/{archive-DSMqHRr1.mjs → archive-DA3OiLEE.mjs} +4 -4
- package/dist/{archive-nKD3mOB8.mjs → archive-DVHxeDKS.mjs} +6 -6
- package/dist/{archive-BdHXQg4I.mjs → archive-DckxlWBt.mjs} +4 -4
- package/dist/{archive-DDru3vdy.mjs → archive-cAdUa1-2.mjs} +4 -4
- package/dist/{auth-aCksg8q2.mjs → auth-A96JOCQx.mjs} +5 -5
- package/dist/{body-DxRSAMNC.mjs → body-CshgcV6U.mjs} +3 -3
- package/dist/{branches-_0VWR2Zm.mjs → branches-CbcwWYL9.mjs} +4 -7
- package/dist/{cancel-ctpVE8uC.mjs → cancel-DpDcVY7M.mjs} +4 -4
- package/dist/{cancel-task-FtxBka-M.mjs → cancel-task-B4RDvIYb.mjs} +5 -8
- package/dist/{card-zyUkr2nS.mjs → card-CEkp1mcI.mjs} +1 -1
- package/dist/card-CefVYtF7.mjs +24 -0
- package/dist/{card-DZxRmver.mjs → card-voh1k4hl.mjs} +14 -11
- package/dist/{cards-DHOWAvfv.mjs → cards-BC0JX8Yg.mjs} +7 -7
- package/dist/cli.mjs +582 -69
- package/dist/client-ClL6gf7G.mjs +3783 -0
- package/dist/collection-Be5AHVWP.mjs +20 -0
- package/dist/{collection-CfulNRBG.mjs → collection-BxdPxD38.mjs} +1 -1
- package/dist/{collection-CGoVLvcD.mjs → collection-DYM0p3Xl.mjs} +1 -1
- package/dist/{collection-namespace-CEoQ7G08.mjs → collection-namespace-Dv0l-V9K.mjs} +2 -2
- package/dist/{content-translation-DNKerjS3.mjs → content-translation-BXIXL4eW.mjs} +3 -3
- package/dist/{create-DmvoibX8.mjs → create--fiwuTWc.mjs} +4 -4
- package/dist/{create-CLG2-bso.mjs → create-B9qXQ_wV.mjs} +6 -6
- package/dist/{create-CEydRMWS.mjs → create-BVNhtAgF.mjs} +7 -7
- package/dist/{create-C9vy4ZG6.mjs → create-BbjSOTN-.mjs} +5 -5
- package/dist/{create-BdPVWYSi.mjs → create-BcsVwXgS2.mjs} +6 -6
- package/dist/{create-CcLchJAN.mjs → create-Bryrkb9g.mjs} +7 -7
- package/dist/{create-7ddYK4TA.mjs → create-CHr8MPPq.mjs} +6 -6
- package/dist/{create-DaYRnK5P.mjs → create-D--Z1S3p2.mjs} +8 -8
- package/dist/{create-F4Lf09xq.mjs → create-DWFJdyIr.mjs} +4 -4
- package/dist/{create-vlrlY-2E.mjs → create-Dhai9zAt.mjs} +4 -4
- package/dist/create-DiJ8bUb-.mjs +34 -0
- package/dist/{create-C78g8Crb.mjs → create-DmN2gFc4.mjs} +5 -5
- package/dist/{create-wJR4CxHA.mjs → create-NCKHHdov.mjs} +5 -8
- package/dist/{create-C3IaXXty.mjs → create-YetX69Re.mjs} +4 -4
- package/dist/{create-e650zxzX.mjs → create-Za1EskpV.mjs} +5 -5
- package/dist/{create-branch-B8C7jl-J.mjs → create-branch-CseVn3lp.mjs} +5 -9
- package/dist/{create-DIVhBIyE.mjs → create-kZIIEN2Y.mjs} +11 -7
- package/dist/{csv-BLPJtlSC.mjs → csv-DNzesu8y.mjs} +5 -5
- package/dist/{current-task-C-ldJbWE.mjs → current-task-DRTKZcP9.mjs} +5 -8
- package/dist/{dashboard-CtO_3EfC.mjs → dashboard-CMw13KXM.mjs} +10 -10
- package/dist/{dashboard-CKUR8ZpQ.mjs → dashboard-D0hwTC-f.mjs} +11 -2
- package/dist/{dashboard-BlbNszi8.mjs → dashboard-DgK81azj.mjs} +1 -1
- package/dist/{database-B19qlLKZ.mjs → database-C3E9PZSx.mjs} +1 -1
- package/dist/{database-C8G6ZKG0.mjs → database-JtHTqSpq.mjs} +1 -1
- package/dist/{db-xXselnBq.mjs → db-BDijt81U.mjs} +7 -7
- package/dist/{delete-BZZHw6pm.mjs → delete--15it-A8.mjs} +5 -5
- package/dist/delete-Bsdwqh7H.mjs +44 -0
- package/dist/{delete-ZJJyqsRh.mjs → delete-BudvZkvK.mjs} +5 -5
- package/dist/{delete-BwSPQy7m.mjs → delete-BxjJ66BS.mjs} +5 -5
- package/dist/{delete-BZwAOQxG.mjs → delete-Dc8E5YwZ.mjs} +5 -5
- package/dist/{delete-runtime-D74s6vhu.mjs → delete-runtime-BKEzJn22.mjs} +1 -2
- package/dist/{delete-table-CJktZE3w.mjs → delete-table-5AQpn8OB.mjs} +5 -5
- package/dist/{delete-D6WxgWRp.mjs → delete-wFsy80db.mjs} +5 -5
- package/dist/{dependencies-BdqIqEIy.mjs → dependencies-C1ogC3BV.mjs} +7 -7
- package/dist/{dirty-BW2As2wS.mjs → dirty-CSLDYO-K.mjs} +6 -9
- package/dist/document-BGzVip5_.mjs +19 -0
- package/dist/{document-Cd2mmqCp.mjs → document-BHpLJbKU.mjs} +5 -0
- package/dist/{document-D6OybtP2.mjs → document-CA0Q6lqu.mjs} +1 -1
- package/dist/{download-mfFJ9oRS.mjs → download-Ddap1OAo.mjs} +3 -6
- package/dist/{eid-DZ-4t2xe.mjs → eid-HnrWhPoe.mjs} +4 -5
- package/dist/{events-D6yFmXP1.mjs → events-CXqetjcS.mjs} +5 -5
- package/dist/{export-DYZjz1WP.mjs → export-IFZdgYZ2.mjs} +7 -10
- package/dist/{field-BJ54wmIX.mjs → field-BJ6HoLRd.mjs} +5 -5
- package/dist/{field-Cr2DPUG9.mjs → field-CcN4oZy6.mjs} +16 -1
- package/dist/{field-BPsNa-TO.mjs → field-fDtIrY6D.mjs} +1 -1
- package/dist/{fields-FUWCgPOa.mjs → fields-DxHxuxwO.mjs} +7 -7
- package/dist/{get-ByZJf9nO.mjs → get-B2pj2q3X.mjs} +5 -5
- package/dist/{get-C_5AbfpO.mjs → get-BF2vdF3W.mjs} +4 -4
- package/dist/{get-DAOSGt5Z.mjs → get-BGLvyOO3.mjs} +6 -6
- package/dist/{get-DMECsioX.mjs → get-BcoJ9Aha.mjs} +4 -4
- package/dist/{get-CsN7NBI0.mjs → get-BiPclcIP.mjs} +4 -4
- package/dist/{get-DCutQeiV.mjs → get-C3cuZNeW.mjs} +4 -4
- package/dist/{get-CQ0-fFWP.mjs → get-CDnmpfHQ.mjs} +5 -8
- package/dist/{get-DRJtsS1_.mjs → get-CE9_4Q7E.mjs} +4 -4
- package/dist/{get-C5q49Dgx.mjs → get-C_tdSMwW2.mjs} +6 -6
- package/dist/{get-CWnriw33.mjs → get-CxUQyhte.mjs} +6 -6
- package/dist/{get-DVyesErX.mjs → get-DW7mCaGe.mjs} +6 -6
- package/dist/{get-DYaQpixt.mjs → get-D_x-ENFe.mjs} +6 -6
- package/dist/{get-Ba2HRdrx.mjs → get-DjlQhgD4.mjs} +6 -6
- package/dist/{get-DhkltKIV.mjs → get-DmKtPNOy.mjs} +4 -4
- package/dist/{get-BWl3vzsf.mjs → get-Dtre5jzh.mjs} +6 -6
- package/dist/get-H6kInHIx.mjs +93 -0
- package/dist/{get-BraVQ1FJ.mjs → get-b0CoPz5B.mjs} +6 -6
- package/dist/{get-LAew34ID.mjs → get-eJilYnHk.mjs} +6 -6
- package/dist/get-i0KInCw9.mjs +32 -0
- package/dist/{get-_ggLr1tY.mjs → get-jofVjU6e.mjs} +6 -6
- package/dist/{get-run-oH4dRCBx.mjs → get-run-BE1HtJDW.mjs} +6 -6
- package/dist/{git-sync-BDnxPrqU.mjs → git-sync-BwBRmEhE.mjs} +18 -1
- package/dist/{git-sync-DxD_ng48.mjs → git-sync-TjX1r_wF.mjs} +1 -1
- package/dist/git-sync-xKC1sqC4.mjs +28 -0
- package/dist/{group-DBM87IgC.mjs → group-YQQ5GIcP.mjs} +2 -2
- package/dist/{has-remote-changes-CnmyIw_7.mjs → has-remote-changes-Cj1KhBOT.mjs} +5 -8
- package/dist/{import-B7Si-bSI.mjs → import-DLb9VN4l.mjs} +7 -10
- package/dist/{input-DH9i67x_.mjs → input-D5tQEfqN.mjs} +1 -1
- package/dist/{is-dirty-BOH_VEA8.mjs → is-dirty-BxtgV2xF.mjs} +3 -6
- package/dist/{items-DouHkWev.mjs → items-DLUYc5-z.mjs} +7 -7
- package/dist/{key-BEhqIzIQ.mjs → key-PYetuQ13.mjs} +1 -1
- package/dist/{library-1J_4Dicw.mjs → library-BNSxXOpc.mjs} +5 -5
- package/dist/library-BPIzb3K_.mjs +81 -0
- package/dist/{library-DfYAT2Ep.mjs → library-PGCfm0UA.mjs} +1 -1
- package/dist/{list-D25ofn4v.mjs → list-B1soS8QW.mjs} +7 -7
- package/dist/{list-Cy0w4Fap.mjs → list-BQnOEB3W.mjs} +4 -4
- package/dist/{list-BeMYIeiI.mjs → list-BUz6KOfw.mjs} +7 -7
- package/dist/{list-C1bAtgO1.mjs → list-BcP1DTJH.mjs} +4 -4
- package/dist/{list-DJK9_BEF.mjs → list-C5mS_ehX.mjs} +14 -13
- package/dist/{list-qs9wAtC3.mjs → list-CBLxhaNZ.mjs} +4 -4
- package/dist/{list-aKUk-a1Y.mjs → list-CERbeLbQ.mjs} +7 -7
- package/dist/{list-B2Ddf4W0.mjs → list-COLpwXW4.mjs} +5 -5
- package/dist/{list-sDpy4nDU.mjs → list-CQbiSx26.mjs} +6 -6
- package/dist/{list-C0zJ2ehz.mjs → list-CX9qZ-bx.mjs} +6 -6
- package/dist/{list-DhViDVx_.mjs → list-CehE6KBV.mjs} +6 -6
- package/dist/list-Cuhf2lKL.mjs +35 -0
- package/dist/{list-D2IYZ6lk.mjs → list-CzRzCbCY.mjs} +6 -6
- package/dist/{list-DWLGpMvr.mjs → list-D-SyhKFw.mjs} +7 -7
- package/dist/{list-DptEWB5Y.mjs → list-Dat8QNcf.mjs} +4 -4
- package/dist/{list-C7UvO3Uw.mjs → list-M8J10Ozk.mjs} +6 -6
- package/dist/{list-BXlTYsYA.mjs → list-Sd7jGZoX.mjs} +4 -4
- package/dist/list-cIMww2Me.mjs +60 -0
- package/dist/{list-BK_6VNm_.mjs → list-jhQSgh6i.mjs} +4 -4
- package/dist/{login-BmyCAfRV.mjs → login-BfLqBfCd.mjs} +18 -15
- package/dist/{logout-DUR32q0V.mjs → logout-BpRXB3Ze.mjs} +3 -4
- package/dist/{measure-DdVp-8jw.mjs → measure-Ds8O5Evr.mjs} +6 -6
- package/dist/{notification-Fcq1fIPw.mjs → notification-DVrLkjFT.mjs} +1 -1
- package/dist/{parameter-DUKR8NXo.mjs → parameter-Celg0wZa.mjs} +1 -1
- package/dist/{parameter-values-CBR-cBev.mjs → parameter-values-DhrkLXoN.mjs} +5 -6
- package/dist/{parse-enum-D0Jfm_Bz.mjs → parse-enum-Dc0dMZ3P.mjs} +1 -1
- package/dist/{parse-id-B3YwNojT.mjs → parse-id-DtM6q9HU.mjs} +1 -1
- package/dist/{parse-ref-ibKVB0J4.mjs → parse-ref-DTDld_LJ.mjs} +1 -1
- package/dist/{path-D8BQmEhL.mjs → path-_GHFrTLx.mjs} +5 -5
- package/dist/{poll-75SvT7Zv.mjs → poll-KLl4Eq8Y.mjs} +2 -2
- package/dist/{preflight-CoF1Em99.mjs → preflight-BpYtF0IU.mjs} +3 -4
- package/dist/{process-DBOOrmET.mjs → process-CLtOWKBn.mjs} +1 -1
- package/dist/{publish-Cb7XrQ3X.mjs → publish-D-7Zlmuk.mjs} +9 -9
- package/dist/{pulse-BmsDenXm.mjs → pulse-Dz0ocv0l.mjs} +1 -1
- package/dist/{pulse-DhG6I9mI.mjs → pulse-x0gFxWfG.mjs} +2 -2
- package/dist/{query-D35B588l.mjs → query-B1CZztxs.mjs} +10 -12
- package/dist/query-CxESKMve.mjs +114 -0
- package/dist/{query-result-DBDwk8TS.mjs → query-result-E4Q-Gra6.mjs} +1 -1
- package/dist/{remove-collection-DJem6V26.mjs → remove-collection-C4saCFxz.mjs} +6 -9
- package/dist/{render-CI93iP0I.mjs → render-6O_eF-P1.mjs} +13 -2
- package/dist/{replace-CtsWICrD.mjs → replace-BuR4f2Ai.mjs} +5 -5
- package/dist/{rescan-values-CaXUL6z5.mjs → rescan-values-CNOiiWQ5.mjs} +6 -6
- package/dist/{run-CM-Amtbf.mjs → run-DijA_BXt.mjs} +26 -14
- package/dist/run-FmRruANb.mjs +64 -0
- package/dist/{run-BeLm17F4.mjs → run-QEUbWNm7.mjs} +9 -9
- package/dist/{runs-DFG63zgr.mjs → runs-BSlhVeDO.mjs} +7 -7
- package/dist/{runtime-z8rra6-I.mjs → runtime-Dtb93zKy.mjs} +994 -252
- package/dist/{schema-tables-COAHkIcy.mjs → schema-tables-BE3rEb6I.mjs} +7 -7
- package/dist/{schemas-BX5BATiV.mjs → schemas-yDjBiwlH.mjs} +5 -5
- package/dist/{search-DFBwUc6d.mjs → search-BAXg-EJw.mjs} +2 -1
- package/dist/{search-CPvvmhdt.mjs → search-CR_xNArA.mjs} +6 -6
- package/dist/{segment-C62L6BI3.mjs → segment-Cm6zQjJW.mjs} +6 -6
- package/dist/{selectors-P4QnrORk.mjs → selectors-C-vgMcGK.mjs} +3 -3
- package/dist/{send-PZh5IKF8.mjs → send-kC8oerkT.mjs} +4 -4
- package/dist/{set-active-DL4QzWDO.mjs → set-active-lDKhAlij.mjs} +5 -5
- package/dist/{set-DbCtUoFd.mjs → set-tFhPkxrL.mjs} +5 -5
- package/dist/{setting-BlRcZbhC.mjs → setting-DrJXCaFE.mjs} +4 -4
- package/dist/{setup-D_SLaC-3.mjs → setup-BWY9M0iR.mjs} +4 -4
- package/dist/{signal-CMd0EFUa.mjs → signal-Csom0mt5.mjs} +11 -2
- package/dist/skill-list-CCes8pKe.mjs +76 -0
- package/dist/skills-DE9ej5Rg.mjs +351 -0
- package/dist/{skills-D991LB1M.mjs → skills-DPRN2384.mjs} +3 -3
- package/dist/snippet-DWHTSo9c.mjs +19 -0
- package/dist/{stash-DyBxFoP6.mjs → stash-C9oDvQ9P.mjs} +7 -11
- package/dist/{status-DUsiogz5.mjs → status-CkpujA26.mjs} +11 -9
- package/dist/{status-cfDHqK2Q.mjs → status-DSdXmNC3.mjs} +12 -11
- package/dist/{subscription-Bn0AU7GN.mjs → subscription-DKOKoHRG.mjs} +6 -6
- package/dist/{subscriptions-DwqjCVlc.mjs → subscriptions-C5SyJL4B.mjs} +7 -7
- package/dist/{summary-BGwSNzf4.mjs → summary-DTPgXsc0.mjs} +6 -6
- package/dist/{sync-schema-dtkDOAKe.mjs → sync-schema-DKKkNSR7.mjs} +7 -7
- package/dist/{sync-task-BACcrs0i.mjs → sync-task-BtDnTXCP.mjs} +3 -2
- package/dist/{table-CsIJNPFf.mjs → table-C6h4tIRw.mjs} +1 -1
- package/dist/{table-CeeTJgQb.mjs → table-DfuY0N8e.mjs} +51 -4
- package/dist/{table-BJoEAoCU.mjs → table-I8NXSdUC.mjs} +5 -5
- package/dist/timeline-B_ESH-6W.mjs +21 -0
- package/dist/{timeline-event-BsF7YqzZ.mjs → timeline-event-n4Lzet7l.mjs} +6 -6
- package/dist/transform-BNuNiH9d.mjs +28 -0
- package/dist/{transform-DoTyyXAu.mjs → transform-CtqB1WYo.mjs} +2 -2
- package/dist/{transform-D3QX0jxA.mjs → transform-DiW7bREn.mjs} +68 -5
- package/dist/{transform-job-50GZHhKH.mjs → transform-job-AaMZRxAq.mjs} +1 -1
- package/dist/transform-job-B7yc6dfH.mjs +22 -0
- package/dist/{transform-job-DRrK28IH.mjs → transform-job-CCguL6LP.mjs} +41 -4
- package/dist/{transform-tag-VM9R7Q_M.mjs → transform-tag-D6NXqWaX.mjs} +5 -5
- package/dist/transform-test-BjjCQ2xm.mjs +169 -0
- package/dist/transform-test-C1Oqtfb-.mjs +16 -0
- package/dist/transform-test-gzDcbypy.mjs +25 -0
- package/dist/{transforms-BjACGbBp.mjs → transforms-O4NtXqFz.mjs} +7 -7
- package/dist/transport-CyVo29u7.mjs +313 -0
- package/dist/{tree-BwS6JAmk.mjs → tree-CuyF116R.mjs} +4 -5
- package/dist/{unpublish-DWdPnENY.mjs → unpublish-DvWefKJi.mjs} +4 -7
- package/dist/{update-DkviXwSg.mjs → update-2KIpYgyj.mjs} +7 -7
- package/dist/{update-DKEHY-gt.mjs → update-76nzOc71.mjs} +7 -7
- package/dist/{update-B2CF2DK4.mjs → update-7oKvP1HC.mjs} +6 -6
- package/dist/{update-DTmRHBik.mjs → update-AJ2JmwDl.mjs} +7 -7
- package/dist/{update-BR_vkkd1.mjs → update-BB6Go_RX.mjs} +5 -5
- package/dist/{update-DCjAjihm.mjs → update-Bah7N8QX.mjs} +6 -6
- package/dist/{update-cqR1U6DU.mjs → update-CGJvIS-l.mjs} +5 -5
- package/dist/{update-tLIhVIPp.mjs → update-D7dG7H-z.mjs} +8 -8
- package/dist/{update-C1FBVLfC.mjs → update-DOdcflLH.mjs} +8 -8
- package/dist/{update-DlTaD1x3.mjs → update-DV54H3L5.mjs} +9 -9
- package/dist/{update-C4y3iQsv.mjs → update-DXmZuJho.mjs} +7 -7
- package/dist/{update-3idz42uD.mjs → update-DmgRIp7o.mjs} +7 -7
- package/dist/{update-DsZttiSC.mjs → update-H_fdjugs.mjs} +5 -5
- package/dist/{update-BCT9qpVr.mjs → update-To6A1Ugu.mjs} +5 -5
- package/dist/{update-dashcard-DlE_bb2F.mjs → update-dashcard-DjT5QOkL.mjs} +7 -7
- package/dist/update-l3PyNQKG.mjs +41 -0
- package/dist/{update-BpPaacCF.mjs → update-xEegxIyH.mjs} +6 -6
- package/dist/{upgrade-mNV7XuJG.mjs → upgrade-CuJx9fX4.mjs} +6 -8
- package/dist/upload-2YFFBSln.mjs +13 -0
- package/dist/{upload-CEGVxmYB.mjs → upload-CboARPZm.mjs} +4 -7
- package/dist/{upload-CD555ui1.mjs → upload-DOO94rCQ.mjs} +2 -2
- package/dist/{uuid-C4hqn3kA.mjs → uuid-InwZlrpQ.mjs} +10 -7
- package/dist/{validate-BWchyW0V.mjs → validate-D6-Vg_kn.mjs} +69 -23
- package/dist/{validate-query-DaGYSmpQ.mjs → validate-query-B90KYPQr.mjs} +3 -4
- package/dist/{values-C0O3eNaW.mjs → values-CsZLk1Ls.mjs} +6 -6
- package/dist/{verify-DfTjYF7s.mjs → verify-DrGjZwBM.mjs} +3 -18
- package/dist/{wait-WZmFenN_.mjs → wait-BmzdarP9.mjs} +7 -10
- package/dist/{wait-flags-BbfDSP8R.mjs → wait-flags-CiJGrTCT.mjs} +2 -2
- package/dist/{window-BkvrP0gB.mjs → window-DSb1tqSe.mjs} +1 -1
- package/package.json +1 -1
- package/skill-data/core/SKILL.md +31 -15
- package/skill-data/dashboard/SKILL.md +1 -1
- package/skill-data/data-workflow/references/building-clean-tables.md +6 -2
- package/skill-data/data-workflow/references/reusable-definitions.md +11 -3
- package/skill-data/document/SKILL.md +4 -1
- package/skill-data/git-sync/SKILL.md +5 -0
- package/skill-data/mbql/SKILL.md +84 -115
- package/skill-data/mbql/references/operators.md +77 -231
- package/skill-data/metadata/SKILL.md +1 -1
- package/skill-data/metadata/references/semantic-types.md +7 -1
- package/skill-data/native-sql/SKILL.md +8 -9
- package/skill-data/native-sql/references/template-tags.md +27 -27
- package/skill-data/notification/SKILL.md +7 -1
- package/skill-data/transform/SKILL.md +76 -4
- package/skill-data/transform-test-plan/SKILL.md +171 -0
- package/skill-data/transform-test-plan/references/checklist.md +81 -0
- package/skill-data/transform-test-plan/references/checks.md +263 -0
- package/skill-data/visualization/SKILL.md +13 -6
- package/skill-data/visualization/references/settings.md +13 -11
- package/skills/metabase-cli/SKILL.md +1 -1
- package/dist/card-CGCXbdmD.mjs +0 -24
- package/dist/client-mKuHg_sc.mjs +0 -2218
- package/dist/collection-D8Tk8i3a.mjs +0 -20
- package/dist/document-KbcHhzFz.mjs +0 -19
- package/dist/get-BC8J8BXB.mjs +0 -80
- package/dist/git-sync-Dik8nKfw.mjs +0 -28
- package/dist/library-ClLgrAXy.mjs +0 -19
- package/dist/list-CW5PdYCX.mjs +0 -98
- package/dist/network-error-D6CiOEBw.mjs +0 -431
- package/dist/predicates-Bkm2IoeX.mjs +0 -170
- package/dist/query-C256WBYG.mjs +0 -87
- package/dist/skills-DTCrMcix.mjs +0 -216
- package/dist/snippet-DTDO55Cg.mjs +0 -19
- package/dist/timeline-DcXPshcT.mjs +0 -21
- package/dist/transform-Dsf_wHAj.mjs +0 -28
- package/dist/transform-job-B1yLv5l-.mjs +0 -22
- package/dist/upload-DsYCf5kB.mjs +0 -13
package/skill-data/core/SKILL.md
CHANGED
|
@@ -6,17 +6,17 @@ allowed-tools: Read, Write, Edit, Bash, AskUserQuestion
|
|
|
6
6
|
|
|
7
7
|
# metabase-cli (core)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
`mb` drives a Metabase instance over its REST API: CRUD on every resource, query and transform execution, search, git-sync (representations ↔ instance), and entity-id translation.
|
|
10
10
|
|
|
11
11
|
Top-level command groups (run `mb <group> --help` to discover verbs):
|
|
12
12
|
|
|
13
13
|
```
|
|
14
14
|
auth | db | table | field | upload | content-translation | query | card | dashboard | snippet | segment | measure | collection | library
|
|
15
|
-
document | timeline | timeline-event | transform | transform-job | transform-tag | alert | subscription | setting
|
|
15
|
+
document | timeline | timeline-event | transform | transform-job | transform-tag | transform-test | alert | subscription | setting
|
|
16
16
|
search | git-sync | setup | eid | uuid | upgrade | skills
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
The conventions below — auth, flags, output, body input — hold across **every** group.
|
|
19
|
+
The conventions below — auth, flags, output, body input — hold across **every** group. When a card needs a query, prefer MBQL over native SQL (portable, pre-flight-validated — load `mbql`); fall back to native SQL when MBQL can't express it.
|
|
20
20
|
|
|
21
21
|
## Auth & profiles
|
|
22
22
|
|
|
@@ -28,7 +28,7 @@ mb auth status --json # → {profile, present, url} for the d
|
|
|
28
28
|
mb auth status --profile <name> --json # health probe for one profile
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
`auth list` is the primary enumeration path — one call returns every profile with sanitized URL, an `authenticated` flag, and a probe `status` (`ok` / `auth-failed` / `network-error` / `server-error` / `not-probed`).
|
|
31
|
+
`auth list` is the primary enumeration path — one call returns every profile with sanitized URL, an `authenticated` flag, and a probe `status` (`ok` / `auth-failed` / `network-error` / `server-error` / `not-probed`).
|
|
32
32
|
|
|
33
33
|
- One profile and intent doesn't disambiguate → use it.
|
|
34
34
|
- Several → ask via `AskUserQuestion`, presenting the names from `auth list`.
|
|
@@ -60,7 +60,7 @@ Every list/get verb supports the same output flags:
|
|
|
60
60
|
- `--json` — emit the full JSON envelope, safe for `jq`. Default is human-readable text.
|
|
61
61
|
- `--full` — include every field (the compact projection is the default, and is the agent-facing contract).
|
|
62
62
|
- `--fields a,b.c.d` — project specific dot-paths. Mutually exclusive with `--full`. **Paths are relative to each `data[]` item on list verbs, and to the root on single-item verbs.** So it's `--fields id,name` on `… list` / `database schema-tables` (`data.id` and `data[].id` both fail with `unknown field path: "data.id"`), and `--fields id,name,display` on `card get`, `--fields data.rows` on `mb query` (whose `data` is an object).
|
|
63
|
-
- `--max-bytes <n>` — cap output size. Default 24576
|
|
63
|
+
- `--max-bytes <n>` — cap output size. Default 24576; `0` disables. On a list it drops trailing items and sets `truncated` (see below). Single-item commands (`get`) never truncate — over the cap they throw a `ConfigError` (exit 2: "output is N bytes, over the M-byte --max-bytes cap; …") whose tail names the remedy: on schema-shaped commands it is the exact narrower command to run instead — follow it rather than raising the cap.
|
|
64
64
|
- JSON output is a single line when stdout is piped (pretty-printed only at a TTY) — always parse it, never scrape by line position.
|
|
65
65
|
|
|
66
66
|
## List windows and resumption
|
|
@@ -69,10 +69,10 @@ Every list verb takes `--limit <n>` (items this call returns) and `--offset <n>`
|
|
|
69
69
|
|
|
70
70
|
- **`has_more` decides whether to keep going — never compare counts.** `total` is the server's count on endpoints that report one and `null` on those that don't, so arithmetic over it is not a termination condition.
|
|
71
71
|
- **To continue, pass `next_offset` back as `--offset`.** When `has_more` is true `next_offset` is past the offset you sent, so the loop advances; when false the walk is over and `next_offset` is `null`.
|
|
72
|
-
- **`truncated` means the byte cap cut the output, not that the data ran out.** `has_more`/`next_offset` are recomputed to the cut point, so a capped list resumes like any window. Its `bytes` is what the untruncated answer would have measured, so it sizes the work left rather than the reply you hold. Narrow rows with `--fields` rather than raising `--max-bytes` —
|
|
72
|
+
- **`truncated` means the byte cap cut the output, not that the data ran out.** `has_more`/`next_offset` are recomputed to the cut point, so a capped list resumes like any window. Its `bytes` is what the untruncated answer would have measured, so it sizes the work left rather than the reply you hold. Narrow rows with `--fields` rather than raising `--max-bytes` — the cap counts only what you asked for, so `--fields` buys rows directly. A capped list always returns at least one row; when not even one fits it exits 2 with "the smallest response this list can produce is N bytes, over the M-byte --max-bytes cap; …".
|
|
73
73
|
- `limit` is echoed only when you passed `--limit` — except `mb search`, which defaults to `--limit 20` (an unbounded search is expensive server-side) and so always reports one. On nouns the server doesn't page, one large `--limit` with narrow `--fields` is a single request; many small `--offset` hops are one request each.
|
|
74
74
|
|
|
75
|
-
The whole walk
|
|
75
|
+
The whole walk:
|
|
76
76
|
|
|
77
77
|
```bash
|
|
78
78
|
offset=0
|
|
@@ -104,7 +104,7 @@ mb <noun> create --file ./.scratch/body.json --profile <n> --json
|
|
|
104
104
|
|
|
105
105
|
Single-quoted `'EOF'` stops the shell interpolating `$vars` inside the JSON.
|
|
106
106
|
|
|
107
|
-
Write working files to **`./.scratch`** in the current directory (`mkdir -p ./.scratch` first), never `/tmp` —
|
|
107
|
+
Write working files to **`./.scratch`** in the current directory (`mkdir -p ./.scratch` first), never `/tmp` — they persist across the session and the user can review them.
|
|
108
108
|
|
|
109
109
|
## Discovering commands and schemas
|
|
110
110
|
|
|
@@ -123,15 +123,17 @@ mb transform --help --json | jq -r '.commands[].command' # verbs under "transfo
|
|
|
123
123
|
|
|
124
124
|
## Resource quirks worth memorizing
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
Only what `--help` does _not_ tell you: footguns and non-obvious behaviors.
|
|
127
127
|
|
|
128
128
|
- **db traversal: the hydration ladder.** Start with `database get <db-id> --include tables` — the compact table map (id, name, schema, description per table), one call that fits most databases. Pick the relevant tables, then `table fields <table-id>` per table (bounded: fields are per-table). `--include tables.fields` is the full rollup — small databases only. Hundreds of tables? Traverse by schema (`database schemas <db-id>` → `database schema-tables <db-id> <schema>`) or look tables up by name (`search <term> --models table --db-id <db-id> --limit 10`). `sync-schema` / `rescan-values` queue async work and return `{status:"ok"}` immediately; `sync-schema --wait` blocks until `initial_sync_status: complete`.
|
|
129
129
|
- **table fields.** `table get` never returns fields on its own — pass `--include fields` (compact; the underlying query_metadata response also carries FK targets and dimensions, visible under `--full`) or use `table fields <id>` (list envelope). `table update` patches table-level metadata only; physical columns aren't editable.
|
|
130
130
|
- **field has no `list`.** Fields are per-table — get them via `table get <id> --include fields`. Never enumerate fields across a whole db (context blow-up). `field summary` is live cardinality `{field_id, count, distincts}`; `field values` is the cached distinct set (`has_more_values: true` ⇒ truncated cache). `field update` patches metadata only (`base_type` isn't editable) — this is where you set a column's `semantic_type` or foreign-key target.
|
|
131
131
|
- **upload (CSV → tables).** `upload csv --file <path>` creates a new table + model (prints `{model_id, table_id}`); `upload append <table-id>` / `upload replace <table-id> --file <path>` add to / overwrite a table **previously created by upload** (columns must match). The destination db+schema is admin-configured, not per-call — check with `mb setting get uploads-settings --json` (`db_id: null` ⇒ uploads off/unconfigured; needs admin to read). `--collection <id|root>` only sets the model's collection. Max 50 MB. Errors: **"The uploads database is not configured."** = no db has uploads enabled; **"Uploads are not enabled."** = the append/replace target isn't an uploaded table.
|
|
132
|
-
|
|
133
|
-
- **
|
|
134
|
-
|
|
132
|
+
<!-- requires: contentTranslation -->
|
|
133
|
+
- **content-translation.** Admin-only, and separate from Remote Sync. `content-translation download > translations.csv` streams the complete active dictionary; `content-translation upload --file translations.csv` replaces every active translation with the file's contents. Always upload the canonical complete CSV, never a partial patch. An empty dictionary downloads as Metabase's four-row sample dictionary — don't re-upload it as real translations. Metabase limits dictionaries to 1.5 MiB.
|
|
134
|
+
<!-- /requires -->
|
|
135
|
+
- **card.** `dataset_query` is the `mbql/query` object itself (→ `mbql`). `--export-format csv|xlsx` streams the raw export (pipe to a file), bypassing the JSON envelope. `archive` is the only delete; unarchive with `update --body '{"archived":false}'`. `visualization_settings` keys are scoped by `display` and aren't pre-flighted — see `visualization`.
|
|
136
|
+
- **dashboard.** Dashcards round-trip through `PUT /api/dashboard/:id` (no per-dashcard endpoint): `update-dashcard <dash-id> <dashcard-id>` patches one safely; `update --body '{"dashcards":[…]}'` replaces the whole set (omitted ids are deleted server-side; negative ids for new cards). Every dashcard must include `card_id`, including existing rows; use `card_id:null` plus a `visualization_settings.virtual_card` block (`{display:"text"|"heading"|"link"|…}`) for non-question cards. `create` accepts the **same** `dashcards` array in its initial body, so lay out the whole dashboard in one call. `create`/`update` pre-flight every positive `card_id` and exit **2** with `{ok:false,errors:[…]}` on a bad ref (non-bypassable). `dashboard get <id>` (or `--full`) hydrates dashcards/tabs; `list` omits them. **The grid is 24 columns wide:** each dashcard's `{col, row, size_x, size_y}` is in grid units — **full-width is `size_x: 24`**. Keep `col + size_x ≤ 24`, start a full-width stack's `col` at 0, and don't overlap (the server stores collisions as sent — no auto-fix). Layout patterns and per-chart default sizes → the `dashboard` skill; load it before composing any `dashcards` array.
|
|
135
137
|
- **dashboard parameters (filters).** A dashboard's `parameters` array holds its filter widgets; they're part of the dashboard record, so read them with `dashboard get <id> --fields parameters --json` (no separate verb). **Editing replaces the _whole_ array** (like dashcards), so it's a read-modify-write loop and omitting a parameter deletes it. A parameter only filters a card once it is **mapped** onto that dashcard's `parameter_mappings` — an unmapped parameter is an inert widget. `type` is a **closed enum**; an unlisted value is a hard parse error that echoes the full allowed set back to you. `dashboard parameter-values <id> <parameter-id> [--query <substr>]` fetches a widget's selectable values (`{values, has_more_values}`; `--query` is a case-insensitive substring search). Parameter types, ids, mapping targets, and value sources → the `dashboard` skill; load it before authoring a `parameters` array.
|
|
136
138
|
- **alert / subscription are two unrelated systems.** `alert` watches one **card** and fires on a send condition (`/api/notification`: a cron string, `channel/email`-prefixed handlers, typed recipients); `subscription` delivers one **dashboard** on a schedule (`/api/pulse`: structured `schedule_type` + hour/day/frame, bare `email` channels, `{id}|{email}` recipients). The bodies are not interchangeable. Both silently deliver nowhere if the server has no SMTP / Slack app — check `mb setting get 'email-configured?'` (quote it; the `?` is a shell glob) before creating either. Their list-valued fields (`handlers`/`subscriptions`, `channels`/`cards`) **replace wholesale** on update, so adding one recipient is a read-modify-write. `mb card alerts <id>` and `mb dashboard subscriptions <id>` list what's already attached to a card/dashboard; `archive` deactivates rather than deletes. Load the `notification` skill before authoring either body.
|
|
137
139
|
- **snippet `--archived` is a swap, not a union** — list returns _either_ active _or_ archived rows, never both. (Same for `--filter archived` on dashboard/collection.)
|
|
@@ -140,11 +142,18 @@ Routine verb shapes (list / get / create / update), every flag, and output schem
|
|
|
140
142
|
- **collection `<ref>`** accepts four forms only — positive int, `root`, `trash`, or a 21-char entity_id; anything else is a client-side `ConfigError`. `collection items` pages the server endpoint, pulling only as far as the output cap can show — read `has_more`/`next_offset` to continue. `collection tree` is **JSON-only** (`--format text` is rejected). A transform collection needs `collection create --namespace transforms`.
|
|
141
143
|
- **setting set** parses the value as **strict JSON**: a string is `'"value"'` (inner quotes), booleans `true`/`false`, numbers bare. Wrong quoting silently errors — confirm with `setting get <key>` after. `setting get --json` works on every value type (wrapping bare-text responses into `{key, value}`).
|
|
142
144
|
- **search vs. list.** For plain enumeration of cards/dashboards/collections use the dedicated `… list` verbs; reach for `search --models <kind>` only for ranking against a query string or a cross-resource lookup.
|
|
145
|
+
<!-- requires: transforms -->
|
|
143
146
|
- **transform.** Iterate with `transform update <id>`, never `delete` + `create` (keeps the row, `entity_id`, materialized table, and YAML filename — avoids `_2` suffixes and noisy git history). `transform run` needs `--wait` (or `--sync`, which also waits for the output table to register and returns `target_table_id`) or you get only `{run_id, final:null}`. (→ `transform`.)
|
|
147
|
+
<!-- /requires -->
|
|
148
|
+
<!-- requires: transformTests -->
|
|
149
|
+
- **transform-test.** `transform-test run <id>` checks a transform against fixtures in temp tables — only a `format: "sql"` input reads the source database — and exits 1 unless it passes. (→ `transform`.)
|
|
150
|
+
<!-- /requires -->
|
|
144
151
|
- **setup is one-shot.** `mb setup` walks `/api/setup` for a **fresh** instance only — errors against an already-configured one. Mostly for bootstrapping local / e2e instances.
|
|
145
152
|
- **eid** translates a string entity id → numeric id: `mb eid --model <model> <eid1,eid2> --json`. Entity ids are NanoIDs that can start with `-`, which the positional form misreads as a flag (shell quotes don't help) — for those, use `--body '{"entity_ids":{"card":["-…"]}}'` (the id is a JSON string value, immune to flag parsing).
|
|
146
|
-
|
|
147
|
-
- **
|
|
153
|
+
<!-- requires: library -->
|
|
154
|
+
- **library.** The Library is a curated subtree (`library-data` "Data" + `library-metrics` "Metrics" under a `library` root): tables published to **Data** appear first in data pickers and rank up in search; metrics saved to **Metrics** are prioritized in nav, search, and the query builder. `library get` shows the Library and its Data/Metrics collection ids; `library create` provisions it (idempotent). `library publish --table-ids/--db-ids/--schemas` publishes tables into Data — it **resolves the Data collection itself and creates the Library if absent**; each `--schemas` entry is `<db-id>:<schema>` (e.g. `1:public`), not a bare name. `publish` cascades to upstream FK dependencies, `unpublish` to downstream dependents; both need **admin or data-analyst** (Curate alone won't publish) and exit **403** without write **and** query permission on every affected table. Publish status shows on the table: `table get`/`table list` carry `is_published` (`collection_id` under `--full`). Publishing does not put the Data collection in the git-sync scope: on a remote-sync instance, `mb git-sync add-collection <data-collection-id>` is what makes exports carry the published tables' metadata (see the `git-sync` skill).
|
|
155
|
+
<!-- /requires -->
|
|
156
|
+
- **query / uuid.** `mb query` runs MBQL (`--dry-run` → run; `mbql`). `mb uuid --count <n>` mints an aggregation's `lib/uuid` (`mbql`) and document node `_id`s (`document`).
|
|
148
157
|
|
|
149
158
|
## Specialized skills (load on demand)
|
|
150
159
|
|
|
@@ -156,12 +165,19 @@ This file is enough for any single-command task. For anything deeper, load the r
|
|
|
156
165
|
- **`dashboard`** — building interactive dashboards: wiring filters (parameters + mappings), linked/cascading filters, cross-filtering, click behavior, series, and tabs. Load beyond a plain card-layout task.
|
|
157
166
|
- **`metadata`** — setting field/table metadata: semantic types, foreign-key targets, dropdown/scan behavior, and column visibility, and the downstream features each unlocks. Load when editing what a column _means_, not its data.
|
|
158
167
|
- **`notification`** — scheduled delivery: question alerts (`mb alert`) and dashboard subscriptions (`mb subscription`). Choosing between them, the two schedule/recipient contracts, channel prerequisites, testing a send.
|
|
168
|
+
<!-- requires: transforms -->
|
|
159
169
|
- **`transform`** — transform body JSON, create + run-with-wait, run inspection, tags, jobs.
|
|
170
|
+
<!-- /requires -->
|
|
171
|
+
<!-- requires: transformTests -->
|
|
172
|
+
- **`transform-test-plan`** — deciding _what_ to test in a transform: the fixture cast, the expectations, the coverage matrix. (`transform` has the `mb transform-test` shapes.)
|
|
173
|
+
<!-- /requires -->
|
|
160
174
|
- **`document`** — Metabase documents (TipTap body, embedding cards).
|
|
175
|
+
<!-- requires: remoteSync -->
|
|
161
176
|
- **`git-sync`** — round-tripping content to/from a git remote.
|
|
177
|
+
<!-- /requires -->
|
|
162
178
|
- **`data-workflow`** — the guided, end-to-end data workflow: investigate raw data, build clean analysis-ready tables, define reusable segments/measures/metrics, answer questions, build dashboards. **Start here when the user states a goal rather than a single verb** — "make sense of my data", "build a data model", "go from raw data to a dashboard", "be my data analyst", "set up analytics for X". It detects where the data is and routes to the right stage.
|
|
163
179
|
|
|
164
|
-
If a task spans more than one, load each. `mb skills list` enumerates
|
|
180
|
+
If a task spans more than one, load each. `mb skills list` enumerates the skills the profile's server can use, and `mb skills get` prints a skill with the sections that server cannot use left out; `--unfiltered` shows everything.
|
|
165
181
|
|
|
166
182
|
## Don't
|
|
167
183
|
|
|
@@ -47,7 +47,7 @@ A dashboard filter is one entry in the dashboard's `parameters` array **plus** a
|
|
|
47
47
|
"target": ["dimension", ["field", 1779, null]] }
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
**`id` is a slug-like string you pick** (e.g. `order_status`), unique within the dashboard — Metabase stores any non-blank string verbatim, so reuse the `slug` rather than guessing an opaque value.
|
|
50
|
+
**`id` is a slug-like string you pick** (e.g. `order_status`), unique within the dashboard — Metabase stores any non-blank string verbatim, so reuse the `slug` rather than guessing an opaque value.
|
|
51
51
|
|
|
52
52
|
**`type` is a closed enum** — an unlisted value is a hard parse error that echoes the allowed set back: string ops `string/=` `string/!=` `string/contains` `string/does-not-contain` `string/starts-with` `string/ends-with`; number ops `number/=` `number/!=` `number/between` `number/>=` `number/<=`; date `date/single` `date/range` `date/relative` `date/month-year` `date/quarter-year` `date/all-options`; location `location/city` `location/state` `location/zip_code` `location/country`; plus `category`, `id`, `boolean/=`, `temporal-unit`, and bare `number`/`text`/`date`/`boolean`.
|
|
53
53
|
|
|
@@ -131,7 +131,7 @@ Then make the links real, not just implied:
|
|
|
131
131
|
- **Wire foreign keys between your tables.** Mark each linking id as a foreign key pointing at the id it references — set the column's type to foreign-key and its target so Metabase itself knows the tables connect and can traverse them.
|
|
132
132
|
- **Graft onto existing clean data** the user approved (step 3 / Phase 1): point the linking id at the existing table's id the same way. Link, don't duplicate.
|
|
133
133
|
|
|
134
|
-
**Set the metadata — a transform's output starts blank, and these tables are
|
|
134
|
+
**Set the metadata — a transform's output starts blank, and these tables are the ones people will start from.** A fresh transform table has no descriptions, raw column names, and untyped columns. You worked it out while investigating; don't leave that knowledge stranded in this chat. Set it on the table so the data explains itself inside Metabase (search, the Question editor, Metabot) and is fit to publish. The mechanics — `mb field update` for semantic types / FK targets / display names, `mb table update` for table descriptions, and the feature each edit unlocks — are in the `metadata` skill; the calls about _what_ to set:
|
|
135
135
|
|
|
136
136
|
- **Semantic types — the highest-value piece.** A column's semantic type is what makes Metabase treat it right: `type/Email`, `type/Currency`/`type/Price`, `type/Category` (turns into a filter dropdown), `type/City`/`type/State`/`type/Country`, `type/CreationTimestamp`, `type/Description`. Set it on every column whose meaning you decoded. A typed column shows money as money, offers a filter dropdown, and lands on the right chart axis for everyone downstream; an untyped one is a guess.
|
|
137
137
|
- **Descriptions.** A one-line description on each table and every non-obvious column.
|
|
@@ -165,7 +165,11 @@ Then report plainly:
|
|
|
165
165
|
|
|
166
166
|
End on that connection map: it's what the user reads to trust the result, and what lets whatever they build next join on the right ids instead of guessing.
|
|
167
167
|
|
|
168
|
-
|
|
168
|
+
<!-- requires: library -->
|
|
169
|
+
|
|
170
|
+
These clean tables are exactly what belongs in the **Library** — published tables appear first when anyone picks a data source, so people start from your curated set, not the raw source. If the user wants that, publish the polished tables to the Library (`mb library publish` / `mb library create` mechanics and permissions are in `core`). Defining reusable segments / measures / metrics on top is the **reusable-definitions** stage (`references/reusable-definitions.md` in this skill).
|
|
171
|
+
|
|
172
|
+
<!-- /requires -->
|
|
169
173
|
|
|
170
174
|
---
|
|
171
175
|
|
|
@@ -50,7 +50,9 @@ Two things never bend in any mode: when genuinely unsure, **ask** (the Shared Co
|
|
|
50
50
|
- "Let me add up revenue the same way everywhere, on this table" → a **measure** on the table.
|
|
51
51
|
- "Revenue is an _official company number_ people pull onto dashboards" → a **metric** in a collection, with a default month-by-month view so it charts cleanly. Lean: make it a metric when it's a headline figure the org reuses across many questions/dashboards; keep it a measure when it's a table-local convenience.
|
|
52
52
|
- **Where the metric lives.** Metrics sit in a collection (folder). Lean: put the org's blessed ones in the shared **Library** so they surface prominently; keep experimental ones in a working collection until trusted.
|
|
53
|
-
|
|
53
|
+
<!-- requires: library -->
|
|
54
|
+
- **Publish the official tables to the Library.** The clean, analysis-ready tables your definitions sit on are the org's official starting points — the **Library** is how you mark them as such. Tables published to the Library's **Data** section appear _first_ when anyone picks a data source, nudging people toward your curated tables instead of raw warehouse ones. Lean: publish the wide clean tables you built the semantic layer on; hold back raw or half-built ones. Surface which tables you'd publish and confirm. (Only admins and data analysts can publish — mechanics in `core`.)
|
|
55
|
+
<!-- /requires -->
|
|
54
56
|
- **Default time dimension for a metric.** A monthly default makes it chart nicely on a dashboard, but doesn't lock anyone out of other groupings. Lean: set a sensible default (usually month) for anything headline; leave it off for raw counts that aren't inherently time-series.
|
|
55
57
|
- **How strict a segment is.** "Active" = last 30 vs 90 days is a real business call with no right answer from the data alone. Lean: surface the few reasonable thresholds with how many rows each catches, let the user pick.
|
|
56
58
|
|
|
@@ -101,7 +103,9 @@ Build each agreed definition. The verb mechanics (create/update flags, the `revi
|
|
|
101
103
|
- **Segment** → `mb segment create`. A flat MBQL filter clause on a table.
|
|
102
104
|
- **Measure** → `mb measure create`. **Exactly one** aggregation on a table.
|
|
103
105
|
- **Metric** → `mb card create` with the metric shape (`type: "metric"`) — it lives in a **collection**, carries the aggregation plus an optional default time dimension. Put org-blessed ones in the Library collection.
|
|
106
|
+
<!-- requires: library -->
|
|
104
107
|
- **Publish the official tables** → `mb library create` then `mb library publish` (mechanics in `core`) to move the clean tables your definitions sit on into the Library's **Data** section, so people start from your curated set, not raw warehouse tables.
|
|
108
|
+
<!-- /requires -->
|
|
105
109
|
|
|
106
110
|
Then **verify what the user can't see**, before you hand back:
|
|
107
111
|
|
|
@@ -122,10 +126,14 @@ Then **stop. Hard gate — every mode, no exceptions.** Recap in plain language
|
|
|
122
126
|
>
|
|
123
127
|
> **Metric** (in your **Library**, charts by month):
|
|
124
128
|
> • **Monthly recurring revenue**
|
|
125
|
-
|
|
129
|
+
|
|
130
|
+
<!-- requires: library -->
|
|
131
|
+
|
|
126
132
|
> **Published to the Library** (these now show up first when anyone picks a data source):
|
|
127
133
|
> • **Customers**, **Orders**
|
|
128
|
-
|
|
134
|
+
|
|
135
|
+
<!-- /requires -->
|
|
136
|
+
|
|
129
137
|
> Open any of those tables' Filter or Summarize block in Metabase to see them in place and try one — give it a look before you start building dashboards on top.
|
|
130
138
|
|
|
131
139
|
End on that plain-language map. It's what the user reads to trust the result — and it's what stops a wrong definition from quietly propagating into everything built next.
|
|
@@ -81,7 +81,10 @@ Every node is `{ "type": string, "attrs"?: object, "content"?: [nodes], "text"?:
|
|
|
81
81
|
- **`resizeNode`** — wraps a single `cardEmbed` or `flexContainer` to make it resizable (no `_id`). `attrs: { "height": <px>, "minHeight": <px> }`, `content` is exactly one `cardEmbed`/`flexContainer`.
|
|
82
82
|
- **`flexContainer`** — a horizontal row of 1–3 `cardEmbed` / `supportingText` cells side by side (no `_id`). `attrs.columnWidths` is an array of width percentages.
|
|
83
83
|
- **`supportingText`** — a text column that sits next to a card inside a `flexContainer` (id-bearing); `content` is the usual block nodes (`paragraph`, `heading`, lists, …).
|
|
84
|
-
- **`smartLink`** — an inline reference to a Metabase entity (renders as a live chip). Inline, atomic, no `_id`. `attrs: { "entityId": <id>, "model": <model>, "label": <string|null>, "href": <relative-path> }`. `model` ∈ `card`, `dataset`, `metric`, `dashboard`, `collection`, `table`, `database`, `document`, `transform`, `segment`, `user`, `action`, `indexed-entity
|
|
84
|
+
- **`smartLink`** — an inline reference to a Metabase entity (renders as a live chip). Inline, atomic, no `_id`. `attrs: { "entityId": <id>, "model": <model>, "label": <string|null>, "href": <relative-path> }`. `model` ∈ `card`, `dataset`, `metric`, `dashboard`, `collection`, `table`, `database`, `document`, `transform`, `segment`, `user`, `action`, `indexed-entity`.
|
|
85
|
+
<!-- requires: smartLinkMeasureModel -->
|
|
86
|
+
- `measure` is a valid `model` too.
|
|
87
|
+
<!-- /requires -->
|
|
85
88
|
- **`metabot`** — an inline Metabot prompt block.
|
|
86
89
|
|
|
87
90
|
## Embedding an existing card
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: git-sync
|
|
3
3
|
description: Round-trip Metabase content (cards, dashboards, transforms, snippets, collections, Library-published table/field metadata) between an instance and a git remote via `mb git-sync …` — status, dirty / has-remote-changes checks, import, export (with branch guard), branches, stash, add/remove a collection from sync. Load when the user wants to "import the latest changes", "export to git", "push my changes to the repo", "open a PR with my Metabase changes", "git sync", "dirty check", "stash before pulling", "add a collection to sync", or anything `mb git-sync …`.
|
|
4
4
|
allowed-tools: Read, Write, Edit, Bash, AskUserQuestion
|
|
5
|
+
requires: [remoteSync]
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# git-sync (representations ↔ instance)
|
|
@@ -130,6 +131,8 @@ mb setting set remote-sync-type '"read-write"' --profile <n>
|
|
|
130
131
|
|
|
131
132
|
**Verifying the result.** `mb git-sync status --profile <n> --json` lists the flagged collections under `synced_collections`, and `mb collection get <id> --json` shows the per-collection `is_remote_synced` flag.
|
|
132
133
|
|
|
134
|
+
<!-- requires: library -->
|
|
135
|
+
|
|
133
136
|
## Published table metadata (Library) and sync scope
|
|
134
137
|
|
|
135
138
|
Table and field metadata — table/field descriptions, semantic types (`type/PK`, `type/FK`), FK targets, plus segments and measures on the table — serializes for **Library-published tables only**, under `databases/<db>/schemas/<schema>/tables/<table>/…` in the repo. Eligibility is two-gated: the table must be published (`mb library publish`), **and** the Library collection holding it must itself carry `is_remote_synced: true`. An ordinary warehouse table, or a transform's target table that isn't published, never serializes — a transform's YAML carries only the transform definition (query, target, description), not the output table's field metadata.
|
|
@@ -144,6 +147,8 @@ mb git-sync stash --new-branch <branch> -m "..." --profile <n> # or create-b
|
|
|
144
147
|
|
|
145
148
|
Flagging the collection records it for the next export, which serializes its current content — including already-published tables and their field metadata. `mb library publish` prints a reminder when the target collection is outside the sync scope on an instance with a configured remote.
|
|
146
149
|
|
|
150
|
+
<!-- /requires -->
|
|
151
|
+
|
|
147
152
|
## Don't (git-sync-specific)
|
|
148
153
|
|
|
149
154
|
- Don't turn instance-side changes into hand-written repo files. When the changes were made against the instance, export them (`stash` / `create-branch` + `export`) and PR the exported branch; reconstructing them as YAML by hand — or pushing files in paths/formats the serializer doesn't own — produces content that never applies on import, and pushing behind Metabase's back races its own sync tasks. Hand-editing YAML belongs to the repo-first workflow, in the serialized layout the repo already uses.
|
package/skill-data/mbql/SKILL.md
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: mbql
|
|
3
|
-
description: Author and debug MBQL query bodies for the `mb` CLI — the
|
|
3
|
+
description: Author and debug MBQL query bodies for the `mb` CLI — the query shape, clauses, filters, aggregation and breakout, order and limit, expressions, joins and FK columns, multi-stage pipelines, saved questions and definitions as sources, output column names, and the print-schema → dry-run → run loop. Use when writing or fixing any query body — `mb query`, a card's `dataset_query`, a transform's `source.query`, or a segment/measure `definition` — or when `--dry-run` or a run reports errors. Triggers — "write an MBQL query", "the dataset_query is wrong", "aggregate and group by", "join two tables", "month-over-month".
|
|
4
4
|
allowed-tools: Read, Write, Edit, Bash, AskUserQuestion
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# MBQL
|
|
8
8
|
|
|
9
|
-
MBQL is the query format
|
|
9
|
+
MBQL is the structured query format: portable across warehouse engines, and a card built on it wires to dashboard filters as-is. Write a structured query first; write native SQL (a `mbql.stage/native` stage, see `native-sql`) for window functions beyond `offset`, CTEs, set operations, engine-specific functions, or when asked for SQL.
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
General flag conventions, body-input precedence, output flags, `./.scratch`, and `mb uuid` mechanics live in `core` (`mb skills get core`).
|
|
11
|
+
Flag conventions, body input, output flags and `./.scratch` live in `core` (`mb skills get core`).
|
|
14
12
|
|
|
15
13
|
## The shape
|
|
16
14
|
|
|
17
|
-
A flat object — `lib/type`, a numeric `database` id, and an ordered `stages` array. No recursive `source-query` nesting; multi-step queries are sibling stages.
|
|
18
|
-
|
|
19
15
|
```json
|
|
20
16
|
{
|
|
21
17
|
"lib/type": "mbql/query",
|
|
@@ -31,109 +27,67 @@ A flat object — `lib/type`, a numeric `database` id, and an ordered `stages` a
|
|
|
31
27
|
}
|
|
32
28
|
```
|
|
33
29
|
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
30
|
+
- `database`, `source-table`, `source-card` and field ids are numeric, copied from `mb database list`, `mb table get <id> --include fields`, `mb card list`. A wrong id that exists resolves to the wrong column without an error, so copy ids, never guess them.
|
|
31
|
+
- The first stage names exactly one source: `source-table` (a table id) or `source-card` (a saved question or model id). Later stages name none; they read the previous stage's output columns.
|
|
32
|
+
- Stage keys: `joins`, `expressions`, `filters`, `aggregation`, `breakout`, `fields`, `order-by`, `limit`. Each list holds at least one clause.
|
|
37
33
|
|
|
38
|
-
##
|
|
34
|
+
## Clauses
|
|
39
35
|
|
|
40
|
-
Every clause is `[op, {options}, ...args]
|
|
36
|
+
Every clause is `[op, {options}, ...args]` with the options object at position 1, `{}` when there are none:
|
|
41
37
|
|
|
42
38
|
```json
|
|
43
|
-
["
|
|
44
|
-
["
|
|
45
|
-
["
|
|
46
|
-
["
|
|
47
|
-
["asc", {}, ["field", {}, 42]]
|
|
39
|
+
["count", {}]
|
|
40
|
+
["sum", {}, ["field", {}, 42]]
|
|
41
|
+
["=", {}, ["field", {}, 61], "Gadget", "Widget"]
|
|
42
|
+
["field", { "temporal-unit": "month" }, 22]
|
|
48
43
|
```
|
|
49
44
|
|
|
50
|
-
|
|
45
|
+
An options key the server doesn't know is rejected or silently dropped, never applied, so spell keys exactly as written here. A field ref is `["field", {options}, <field id>]`. Its options: `temporal-unit` (bucket a date: `day`, `week`, `month`, `quarter`, `year`, …), `binning` (`{"strategy": "num-bins", "num-bins": 10}`), `join-alias` (a column of an explicit join), `source-field` (a column reached through an FK), `base-type` (on a column named by string, see Multi-stage).
|
|
51
46
|
|
|
52
|
-
|
|
47
|
+
## Filters, aggregation, breakout
|
|
53
48
|
|
|
54
|
-
|
|
49
|
+
- `filters` are ANDed; OR is `["or", {}, a, b, …]`. Multi-value is `["in", {}, <field>, "a", "b"]` / `["not-in", …]`.
|
|
50
|
+
- Relative dates: `["time-interval", {}, <field>, -30, "day"]`, `["time-interval", {}, <field>, "current", "month"]`. A stated year or date range is absolute: `["between", {}, <field>, "2024-01-01", "2024-12-31"]` (inclusive).
|
|
51
|
+
- `aggregation` is a list of aggregation clauses, `breakout` a list of refs. "only / where X" is a filter; "by / per / over time" is a breakout.
|
|
52
|
+
- Name every aggregation a later stage, a chart setting or a target table reads: `["sum", {"name": "revenue", "display-name": "Revenue"}, <field>]`. Unnamed, it is `count`, `sum`, `avg`, … and a second `sum` is `sum_2`.
|
|
53
|
+
- An aggregation can be arithmetic over aggregations: `["/", {"name": "aov"}, ["sum", {}, <field>], ["count", {}]]`.
|
|
54
|
+
- Date arithmetic is `["datetime-diff", {}, a, b, "day"]`.
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
## Order and limit
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
`order-by` holds `["asc", {}, <ref>]` / `["desc", {}, <ref>]`. To order by an aggregation of the same stage, set a `lib/uuid` from `mb uuid --format text` (the bare value) in that aggregation's options and point the ref at the same string:
|
|
59
59
|
|
|
60
60
|
```json
|
|
61
|
-
"aggregation": [["count", { "lib/uuid": "
|
|
62
|
-
"
|
|
61
|
+
"aggregation": [["count", {}], ["sum", {"name": "revenue", "lib/uuid": "<uuid>"}, ["field", {}, 40]]],
|
|
62
|
+
"breakout": [["field", {}, 43]],
|
|
63
|
+
"order-by": [["desc", {}, ["aggregation", {}, "<uuid>"]]],
|
|
64
|
+
"limit": 10
|
|
63
65
|
```
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
A query read back from Metabase carries a `lib/uuid` on every clause, and each must be unique within the query: drop it from a clause you duplicate.
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
"Top / first / latest N" is `order-by` plus `limit: N` in the stage.
|
|
68
70
|
|
|
69
|
-
##
|
|
71
|
+
## Expressions
|
|
70
72
|
|
|
71
|
-
`
|
|
73
|
+
`expressions` is a list of clauses, each named by `lib/expression-name` in its options; `["expression", {}, "<name>"]` uses one in the same stage:
|
|
72
74
|
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
mb query --file q.json --profile <n> --json # 3. validate + run
|
|
75
|
+
```json
|
|
76
|
+
"expressions": [["+", {"lib/expression-name": "Subtotal"}, ["field", {}, 40], ["field", {}, 44]]],
|
|
77
|
+
"aggregation": [["sum", {}, ["expression", {}, "Subtotal"]]]
|
|
77
78
|
```
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
- `--dry-run` validates and emits `{ ok, errors: [{ path, message }] }`. Exit `0` valid, `2` invalid. No request sent. Iterate until `ok: true`.
|
|
81
|
-
- run (no flag) validates, then on success sends to `/api/dataset`. On validation failure it writes the same envelope, exits `2`, and **never sends**.
|
|
82
|
-
|
|
83
|
-
`path` is a JSON Pointer into the body (`/stages/0/aggregation/0`); `message` is the validator error. Exit codes: `0` valid + ran, `2` validation failed / malformed body, `1` server-side error after a valid pre-flight.
|
|
84
|
-
|
|
85
|
-
**Pre-flight is a lightweight shape check, not the full backend validator.** It checks JSON shape, `lib/uuid` format, and enum values — not operator names, the first-stage source rule, or whether a reference resolves. A clean `--dry-run` is necessary but not sufficient: a body can pass pre-flight and still fail on the server (exit `1`). The server is the authority — when a run fails, read its error and fix the body. Common ones:
|
|
86
|
-
|
|
87
|
-
- `not a known MBQL clause` → a misspelled or unsupported **operator**. Check the vocabulary in `operators.md` (`mb skills get mbql --full`).
|
|
88
|
-
- `Initial MBQL stage must have either :source-table or :source-card` → the **first stage** is missing its source (a numeric table or card id); only the first stage takes one, later stages read the previous stage's columns.
|
|
89
|
-
- `Invalid :expression reference: no expression named "X"` (or an invalid `:aggregation` reference) → a **ref** points to an expression name / aggregation `lib/uuid` that isn't defined in the query; fix the target string.
|
|
90
|
-
- `Duplicate :lib/uuid` → you reused a `lib/uuid`. Omit them (the server mints unique ones) or give each clause a distinct value.
|
|
91
|
-
|
|
92
|
-
A successful run emits the compact envelope by default: `data.rows` + slim `data.cols` (`name`, `display_name`, `base_type`, `semantic_type`). Pass `--full` for the raw `/api/dataset` envelope (`results_metadata`, `native_form`, per-column fingerprints/`field_ref`) only when you need that metadata; `--fields data.rows` narrows to rows alone. `mb query` also runs a native query — author it as an `mbql.stage/native` stage (pre-flight-validated like any MBQL body; see `native-sql`).
|
|
93
|
-
|
|
94
|
-
`--skip-validate` bypasses pre-flight and sends as-is — use only when the bundled schema disagrees with what the server actually accepts (drift / false negative). Mutually exclusive with `--dry-run`. Same flag exists on `card create/update` and `transform create/update`.
|
|
80
|
+
## Joins
|
|
95
81
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
The same body and pre-flight apply everywhere a query is embedded. Each pre-flights only when the value is the `mbql/query` shape (`lib/type: "mbql/query"`); legacy shapes skip it; `--skip-validate` bypasses.
|
|
99
|
-
|
|
100
|
-
| Command | The query lives at | Notes |
|
|
101
|
-
| --------------------------------------- | ---------------------------------------------- | ------------------------------------------- |
|
|
102
|
-
| `mb query` | the whole body | ad-hoc run against `/api/dataset` |
|
|
103
|
-
| `card create` / `card update` | `dataset_query` | a **flat** `mbql/query` — see footgun below |
|
|
104
|
-
| `transform create` / `transform update` | `source.query` (when `source.type` is `query`) | materializes to a warehouse table |
|
|
105
|
-
| `measure create` / `measure update` | `definition` | exactly one `aggregation`, no `filters` |
|
|
106
|
-
| `segment create` / `segment update` | `definition` | filter macro tied to a table |
|
|
107
|
-
|
|
108
|
-
## Footgun: `dataset_query` is the flat mbql/query, not a legacy envelope
|
|
109
|
-
|
|
110
|
-
The most common mistake. The legacy shape `{ "type": "query", "database": N, "query": {…} }` looks similar but is wrong. `dataset_query` (and `source.query`, and `definition`) **is the `mbql/query` value itself**:
|
|
82
|
+
**A column of an FK-related table:** put the FK column's id in `source-field` and the related table's column id third. The join is added for you:
|
|
111
83
|
|
|
112
84
|
```json
|
|
113
|
-
"
|
|
114
|
-
"lib/type": "mbql/query",
|
|
115
|
-
"database": 2,
|
|
116
|
-
"stages": [{ "lib/type": "mbql.stage/mbql", "source-table": 190,
|
|
117
|
-
"aggregation": [["count", {}]] }]
|
|
118
|
-
}
|
|
85
|
+
["field", { "source-field": 1711 }, 1682]
|
|
119
86
|
```
|
|
120
87
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
## Legacy formats you may encounter
|
|
124
|
-
|
|
125
|
-
Older Metabase servers used a different query envelope (sometimes called MBQL 4 / "legacy MBQL"); the `mbql/query` shape above is what recent servers store and return. You won't author the legacy shapes, but you may see them in queries created long ago. Anything not `lib/type: "mbql/query"` is sent as-is and normalized server-side — you lose validation, so don't author these:
|
|
126
|
-
|
|
127
|
-
- **Legacy structured** — `{ "type": "query", "database": N, "query": { "source-table": T, … } }`
|
|
128
|
-
- **Flat native** — `{ "type": "native", "database": N, "native": { "query": "SELECT …" } }` — the server accepts it, but author the native stage instead (`native-sql`).
|
|
129
|
-
|
|
130
|
-
`mb query --file probe.json` runs these directly; `--dry-run` on them returns `{ ok: true, errors: [] }`. Don't author them by hand — build a legacy or complex query in the Metabase UI and pull the body with `mb card get <id> --full --json` / `mb transform get <id> --full --json` (which returns the `mbql/query` shape).
|
|
88
|
+
(`1711` = orders.customer_id, `1682` = customers.plan.)
|
|
131
89
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
Two ways to read columns from a related table.
|
|
135
|
-
|
|
136
|
-
**Explicit join.** A stage's `joins` array holds join objects, each with three required keys: `stages` (the joined source as its own one-stage array carrying `source-table`/`source-card`), `conditions` (the ON clause — `[op, {}, leftRef, rightRef]`, slot-1 rule and all), and `alias` (the string name you address joined columns by). Optional `strategy` (`left-join` default; also `right-join` / `inner-join` / `full-join`) and `fields` (`"all"` | `"none"` | an array of refs — which joined columns to select). Reference a joined column anywhere downstream by putting **`join-alias`** in the field options:
|
|
90
|
+
**An explicit join** for a non-FK condition, a chosen strategy, or a joined source question:
|
|
137
91
|
|
|
138
92
|
```json
|
|
139
93
|
"joins": [
|
|
@@ -141,28 +95,20 @@ Two ways to read columns from a related table.
|
|
|
141
95
|
"alias": "Customers",
|
|
142
96
|
"strategy": "left-join",
|
|
143
97
|
"stages": [{ "lib/type": "mbql.stage/mbql", "source-table": 170 }],
|
|
144
|
-
"conditions": [
|
|
145
|
-
|
|
146
|
-
],
|
|
147
|
-
"fields": "none"
|
|
98
|
+
"conditions": [["=", {}, ["field", {}, 1711], ["field", { "join-alias": "Customers" }, 1684]]],
|
|
99
|
+
"fields": "all"
|
|
148
100
|
}
|
|
149
101
|
],
|
|
150
102
|
"breakout": [["field", { "join-alias": "Customers" }, 1682]]
|
|
151
103
|
```
|
|
152
104
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
```json
|
|
158
|
-
["field", { "source-field": 1711 }, 1682] // orders.customer_id → customers.plan
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
`source-field` is the **FK field id** (orders.customer_id); the third element is the **target field id** in the related table (customers.plan). Use it for "show a column from the table this FK points at"; reach for an explicit join when you need a non-FK condition, a non-default strategy, or control over which joined columns return.
|
|
105
|
+
- `alias`, `stages` and `conditions` are required; `strategy` is `left-join` (default), `inner-join`, `right-join` or `full-join`.
|
|
106
|
+
- `fields` picks the joined columns a row listing returns: `"all"`, or a list of refs. Without it the join adds none.
|
|
107
|
+
- In the join's stage, every ref to a joined column carries `join-alias`, conditions included. A later stage reads it by name, like any earlier-stage column.
|
|
162
108
|
|
|
163
|
-
## Multi-stage
|
|
109
|
+
## Multi-stage
|
|
164
110
|
|
|
165
|
-
|
|
111
|
+
A later stage reads the previous stage's output by column name, with the column's `base-type`: `["field", {"base-type": "type/BigInteger"}, "count"]`. Filter on an aggregate (HAVING), or aggregate an aggregate, in the next stage:
|
|
166
112
|
|
|
167
113
|
```json
|
|
168
114
|
"stages": [
|
|
@@ -170,16 +116,15 @@ Stages run in order; each reads the **previous stage's output columns** — the
|
|
|
170
116
|
"aggregation": [["sum", { "name": "total" }, ["field", {}, 1715]]],
|
|
171
117
|
"breakout": [["field", {}, 1711]] },
|
|
172
118
|
{ "lib/type": "mbql.stage/mbql",
|
|
173
|
-
"filters": [[">", {}, ["field", { "base-type": "type/
|
|
174
|
-
|
|
175
|
-
"order-by": [["desc", {}, ["field", { "base-type": "type/BigInteger" }, "total"]]],
|
|
119
|
+
"filters": [[">", {}, ["field", { "base-type": "type/Float" }, "total"], 1000]],
|
|
120
|
+
"order-by": [["desc", {}, ["field", { "base-type": "type/Float" }, "total"]]],
|
|
176
121
|
"limit": 3 }
|
|
177
122
|
]
|
|
178
123
|
```
|
|
179
124
|
|
|
180
|
-
|
|
125
|
+
The names and base types are the `name` and `base_type` of the columns the earlier stages return: run them once (`mb query … --json`, `data.cols`) and copy both. A breakout keeps its field's name (`CREATED_AT`, even when bucketed); an aggregation has the `name` you gave it.
|
|
181
126
|
|
|
182
|
-
**Window
|
|
127
|
+
**Window:** `offset` sits in `aggregation` and reads another breakout row. Month-over-month against a monthly breakout:
|
|
183
128
|
|
|
184
129
|
```json
|
|
185
130
|
"aggregation": [
|
|
@@ -189,23 +134,47 @@ Later stages address the first stage's aggregation by the `name` you gave it (`"
|
|
|
189
134
|
"breakout": [["field", { "temporal-unit": "month" }, 1717]]
|
|
190
135
|
```
|
|
191
136
|
|
|
192
|
-
|
|
137
|
+
## Saved questions, models and definitions
|
|
193
138
|
|
|
194
|
-
|
|
139
|
+
- A saved question or model is a source: `"source-card": 137` on the first stage, same database as the rest of the query; its columns go by name with `base-type`, as in a later stage.
|
|
140
|
+
- A metric is an aggregation: `["metric", {}, <card id>]`, on a stage whose source is the metric's table.
|
|
141
|
+
- A segment is a filter: `["segment", {}, <segment id>]`, on its table.
|
|
142
|
+
- A metric's output column is named for its inner aggregation (`sum`, `count`); set `"name"` in its options for a later stage to read it by.
|
|
195
143
|
|
|
196
|
-
|
|
144
|
+
<!-- requires: measures -->
|
|
197
145
|
|
|
198
|
-
|
|
199
|
-
["count", { "name": "shipments_shipped", "display-name": "Shipments shipped" }]
|
|
200
|
-
```
|
|
146
|
+
A measure is an aggregation, `["measure", {}, <measure id>]`, on its table, and is named like a metric.
|
|
201
147
|
|
|
202
|
-
|
|
148
|
+
<!-- /requires -->
|
|
203
149
|
|
|
204
|
-
|
|
150
|
+
## Authoring loop: print-schema → dry-run → run
|
|
205
151
|
|
|
206
152
|
```bash
|
|
207
|
-
mb
|
|
208
|
-
mb
|
|
153
|
+
mb query --file q.json --dry-run --profile <n> # check + compile on the server, no run
|
|
154
|
+
mb query --file q.json --profile <n> --json # check + run
|
|
155
|
+
mb query --print-schema --profile <n> > ./.scratch/mbql-schema.json # the full JSON Schema
|
|
209
156
|
```
|
|
210
157
|
|
|
211
|
-
|
|
158
|
+
- `--dry-run` checks the shape locally, then has the server compile the query to SQL without running it. It answers `{ ok, errors: [{ path, message }], sql }`: exit `0` with the compiled `sql`, or exit `2` with `sql: null` when either check rejects the body. A local error's `path` is a JSON Pointer into the body; a server error's is `""`. Exit `1` means the compile could not run (the server refused permission, server unreachable).
|
|
159
|
+
- The server compile catches what the shape check cannot: a ref to a missing aggregation or expression, an unknown clause, a duplicate `lib/uuid`, a missing table, field, card or segment, a raw-variable template tag with no value or `default` outside an optional `[[ ]]` clause, a `required` tag with no value. A column's type not suiting its operator and a misspelled column name in a later stage are caught only by the warehouse, so a mistake there compiles and fails on the run. When a run fails, read the message and fix the body it names; an error naming nothing in the body (a `NullPointerException`) is a server fault, so stop editing a body that is otherwise correct.
|
|
160
|
+
- A run checks the shape first and never sends an invalid body; exit `1` is a server or warehouse error after that.
|
|
161
|
+
- A server error `lib/uuid: missing required key` at a clause means that clause's arguments are wrong: their count, a unit it doesn't take, a bad time zone.
|
|
162
|
+
- A run answers `data.rows` and slim `data.cols` (`name`, `display_name`, `base_type`, `semantic_type`); `--full` returns the raw `/api/dataset` envelope.
|
|
163
|
+
|
|
164
|
+
## Where the query goes
|
|
165
|
+
|
|
166
|
+
Every command below takes the query object itself at the path shown, checked by the same pre-flight (`--skip-validate` sends it unchecked).
|
|
167
|
+
|
|
168
|
+
| Command | The query lives at | Notes |
|
|
169
|
+
| --------------------------------------- | ---------------------------------------------- | --------------------------------- |
|
|
170
|
+
| `mb query` | the whole body | ad-hoc run |
|
|
171
|
+
| `card create` / `card update` | `dataset_query` | |
|
|
172
|
+
| `transform create` / `transform update` | `source.query` (when `source.type` is `query`) | materializes to a warehouse table |
|
|
173
|
+
| `measure create` / `measure update` | `definition` | see below |
|
|
174
|
+
| `segment create` / `segment update` | `definition` | see below |
|
|
175
|
+
|
|
176
|
+
A measure `definition` is one stage with `source-table` and exactly one `aggregation` that references no metric, and no `joins`, `expressions`, `breakout`, `filters`, `fields`, `order-by` or `limit`. A segment `definition` is one stage with `source-table` and at least one `filters` clause, and no `joins`, `expressions`, `breakout`, `aggregation`, `order-by` or `limit`.
|
|
177
|
+
|
|
178
|
+
## Operator reference
|
|
179
|
+
|
|
180
|
+
Every filter, aggregation, expression, temporal unit and binning strategy, with arguments: `references/operators.md` (`mb skills get mbql --full`, or `mb skills path mbql` and read the file).
|