Version v0.43 of Metabase is no longer supported. Check out the docs for the current stable version, Metabase v0.63.
Database
/api/database endpoints.
- DELETE /api/database/:id
- GET /api/database/
- GET /api/database/:id
- GET /api/database/:id/autocomplete_suggestions
- GET /api/database/:id/fields
- GET /api/database/:id/idfields
- GET /api/database/:id/metadata
- GET /api/database/:id/schema/
- GET /api/database/:id/schema/:schema
- GET /api/database/:id/schemas
- GET /api/database/:virtual-db/datasets
- GET /api/database/:virtual-db/datasets/:schema
- GET /api/database/:virtual-db/metadata
- GET /api/database/:virtual-db/schema/:schema
- GET /api/database/:virtual-db/schemas
- GET /api/database/db-ids-with-deprecated-drivers
- POST /api/database/
- POST /api/database/:id/discard_values
- POST /api/database/:id/rescan_values
- POST /api/database/:id/sync
- POST /api/database/:id/sync_schema
- POST /api/database/sample_database
- POST /api/database/validate
- PUT /api/database/:id
DELETE /api/database/:id
Delete a Database.
You must be a superuser to do this.
PARAMS:
id
GET /api/database/
Fetch all Databases.
-
include=tablesmeans we should hydrate the Tables belonging to each DB. Default:false. -
savedmeans we should include the saved questions virtual database. Default:false. -
include_tablesis a legacy alias forinclude=tables, but should be considered deprecated as of 0.35.0, and will be removed in a future release. -
include_cardshere means we should also include virtual Table entries for saved Questions, e.g. so we can easily use them as source Tables in queries. This is a deprecated alias forsaved=true+include=tables(for the saved questions virtual DB). Prefer usingincludeandsavedinstead. -
include_editable_data_modelwill only include DBs for which the current user has data model editing permissions. (Ifinclude=tables, this also applies to the list of tables in each DB). Has no effect unless Enterprise Edition code is available the advanced-permissions feature is enabled. -
exclude_uneditable_detailswill only include DBs for which the current user can edit the DB details. Has no effect unless Enterprise Edition code is available and the advanced-permissions feature is enabled.
PARAMS:
-
include_tablesvalue may be nil, or if non-nil, value must be a valid boolean string (‘true’ or ‘false’). -
include_cardsvalue may be nil, or if non-nil, value must be a valid boolean string (‘true’ or ‘false’). -
includeinclude must be either empty or the value tables -
savedvalue may be nil, or if non-nil, value must be a valid boolean string (‘true’ or ‘false’). -
include_editable_data_modelvalue may be nil, or if non-nil, value must be a valid boolean string (‘true’ or ‘false’). -
exclude_uneditable_detailsvalue may be nil, or if non-nil, value must be a valid boolean string (‘true’ or ‘false’).
GET /api/database/:id
Get a single Database with id. Optionally pass ?include=tables or ?include=tables.fields to include the Tables
belonging to this database, or the Tables and Fields, respectively. If the requestor has write permissions for the DB
(i.e. is an admin or has data model permissions), then certain inferred secret values will also be included in the
returned details (see [[metabase.models.secret/expand-db-details-inferred-secret-values]] for full details).
Passing include_editable_data_model will only return tables for which the current user has data model editing permissions, if Enterprise Edition code is available and a token with the advanced-permissions feature is present. In addition, if the user has no data access for the DB (aka block permissions), it will return only the DB name, ID and tables, with no additional metadata.
PARAMS:
-
id -
includevalue may be nil, or if non-nil, value must be one of:tables,tables.fields. -
include_editable_data_model
GET /api/database/:id/autocomplete_suggestions
Return a list of autocomplete suggestions for a given prefix.
This is intened for use with the ACE Editor when the User is typing raw SQL. Suggestions include matching Tables
and Fields in this Database.
Tables are returned in the format [table_name "Table"];
When Fields have a semantic_type, they are returned in the format [field_name "table_name base_type semantic_type"]
When Fields lack a semantic_type, they are returned in the format [field_name "table_name base_type"].
PARAMS:
-
id -
prefix -
search
GET /api/database/:id/fields
Get a list of all Fields in Database.
PARAMS:
id
GET /api/database/:id/idfields
Get a list of all primary key Fields for Database.
PARAMS:
id
GET /api/database/:id/metadata
Get metadata about a Database, including all of its Tables and Fields. Returns DB, fields, and field values.
By default only non-hidden tables and fields are returned. Passing include_hidden=true includes them.
Passing include_editable_data_model will only return tables for which the current user has data model editing permissions, if Enterprise Edition code is available and a token with the advanced-permissions feature is present. In addition, if the user has no data access for the DB (aka block permissions), it will return only the DB name, ID and tables, with no additional metadata.
PARAMS:
-
id -
include_hiddenvalue may be nil, or if non-nil, value must be a valid boolean string (‘true’ or ‘false’). -
include_editable_data_modelvalue may be nil, or if non-nil, value must be a valid boolean string (‘true’ or ‘false’).
GET /api/database/:id/schema/
Return a list of Tables for a Database whose schema is nil or an empty string.
PARAMS:
id
GET /api/database/:id/schema/:schema
Returns a list of Tables for the given Database id and schema.
PARAMS:
-
id -
schema
GET /api/database/:id/schemas
Returns a list of all the schemas found for the database id.
PARAMS:
id
GET /api/database/:virtual-db/datasets
Returns a list of all the datasets found for the saved questions virtual database.
GET /api/database/:virtual-db/datasets/:schema
Returns a list of Tables for the datasets virtual database.
PARAMS:
schema
GET /api/database/:virtual-db/metadata
Endpoint that provides metadata for the Saved Questions ‘virtual’ database. Used for fooling the frontend and allowing it to treat the Saved Questions virtual DB just like any other database.
GET /api/database/:virtual-db/schema/:schema
Returns a list of Tables for the saved questions virtual database.
PARAMS:
schema
GET /api/database/:virtual-db/schemas
Returns a list of all the schemas found for the saved questions virtual database.
GET /api/database/db-ids-with-deprecated-drivers
Return a list of database IDs using currently deprecated drivers.
POST /api/database/
Add a new Database.
You must be a superuser to do this.
PARAMS:
-
namevalue must be a non-blank string. -
enginevalue must be a valid database engine. -
detailsvalue must be a map. -
is_full_syncvalue may be nil, or if non-nil, value must be a boolean. -
is_on_demandvalue may be nil, or if non-nil, value must be a boolean. -
schedulesvalue may be nil, or if non-nil, value must be a valid map of schedule maps for a DB. -
auto_run_queriesvalue may be nil, or if non-nil, value must be a boolean. -
cache_ttlvalue may be nil, or if non-nil, value must be an integer greater than zero.
POST /api/database/:id/discard_values
Discards all saved field values for this Database.
PARAMS:
id
POST /api/database/:id/rescan_values
Trigger a manual scan of the field values for this Database.
PARAMS:
id
POST /api/database/:id/sync
Update the metadata for this Database. This happens asynchronously.
PARAMS:
id
POST /api/database/:id/sync_schema
Trigger a manual update of the schema metadata for this Database.
PARAMS:
id
POST /api/database/sample_database
Add the sample database as a new Database.
You must be a superuser to do this.
POST /api/database/validate
Validate that we can connect to a database given a set of details.
You must be a superuser to do this.
PARAMS:
-
enginevalue must be a valid database engine. -
detailsvalue must be a map.
PUT /api/database/:id
Update a Database.
PARAMS:
-
enginevalue may be nil, or if non-nil, value must be a valid database engine. -
schedulesvalue may be nil, or if non-nil, value must be a valid map of schedule maps for a DB. -
refingerprintvalue may be nil, or if non-nil, value must be a boolean. -
points_of_interestvalue may be nil, or if non-nil, value must be a string. -
descriptionvalue may be nil, or if non-nil, value must be a string. -
auto_run_queriesvalue may be nil, or if non-nil, value must be a boolean. -
namevalue may be nil, or if non-nil, value must be a non-blank string. -
caveatsvalue may be nil, or if non-nil, value must be a string. -
is_full_sync -
cache_ttlvalue may be nil, or if non-nil, value must be an integer greater than zero. -
detailsvalue may be nil, or if non-nil, value must be a map. -
id -
is_on_demand
Read docs for other versions of Metabase.