Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Created May 24, 2023 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miguelmota/da41319b69168e88781d5ea2006c40e2 to your computer and use it in GitHub Desktop.
Save miguelmota/da41319b69168e88781d5ea2006c40e2 to your computer and use it in GitHub Desktop.
Node.js metabase raw sql query dataset
const body = {
database: databaseInteger,
type: 'native',
native: {
query: rawSqlQuery,
},
}
const res = await fetch('https://metabase.example.com/api/dataset', {
method: 'POST',
headers: {
'X-Metabase-Session': token,
'Content-Type': 'application/json'
},
body: JSON.stringify(body)
})
const json = await res.json()
console.log(json)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment