starburstdata / metabase-driver

Starburst Metabase driver
Apache License 2.0
60 stars 11 forks source link

Add query remarks #116

Closed lpoulain closed 8 months ago

lpoulain commented 8 months ago

When executing a query, Metabase adds a comment providing the user ID, query type and hash:

PREPARE statement3 FROM -- Metabase:: userID: 1 queryType: MBQL queryHash: a5cd01e49cc4cef75ee341f2249ea177b7fefe3d71762318caa3b7a6d76d9cd0
SELECT "default"."customer"."custkey" FROM "default"."customer"

This PR adds extra information as it's already done with Redshift (https://github.com/metabase/metabase/blob/dc676e1e649249c4ddb2ff9ee3752682596b0f23/modules/drivers/redshift/src/metabase/driver/redshift.clj#L312). It adds the account ID, Dashboard ID and when card ID available:

PREPARE statement3 FROM -- Metabase:: userID: 1 queryType: native queryHash: e80d81488b5f52789240a8be468983ab5638ef272b524b5e7c6fb9830beeb201 accountID: d578dddb-cbda-41b2-b00d-599e445dac37
SELECT "default"."customer"."custkey" FROM "default"."customer"
PREPARE statement4 FROM -- Metabase:: userID: 1 queryType: MBQL queryHash: b2ad15ab0ef360e068ec906b53fdecfd8be58a1fde061225d484c0b3f2bc3301 accountID: d578dddb-cbda-41b2-b00d-599e445dac37 dashboardID: 1 cardID: 2
SELECT "default"."customer"."custkey" FROM "default"."customer"
paoliniluis commented 8 months ago

Great! Let us know when you cut a release so we can ship it in our cloud