| title | summary |
|---|---|
Database |
/api/database endpoints.
|
/api/database endpoints.
Delete a Database.
You must be a superuser to do this.
idvalue must be an integer greater than zero.
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_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). Should only be used if 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. -
include_only_uploadablewill only include DBs into which Metabase can insert new data.
Independently of these flags, the implementation of [[metabase.models.interface/to-json]] for :model/Database in
[[metabase.models.database]] uses the implementation of [[metabase.models.interface/can-write?]] for :model/Database
in [[metabase.models.database]] to exclude the details field, if the requesting user lacks permission to change the
database details.
-
includeinclude must be either empty or the value tables. -
savednullable boolean. -
include_editable_data_modelnullable boolean. -
exclude_uneditable_detailsnullable boolean. -
include_only_uploadablenullable boolean. -
include_analyticsnullable boolean.
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.
Independently of these flags, the implementation of [[metabase.models.interface/to-json]] for :model/Database in
[[metabase.models.database]] uses the implementation of [[metabase.models.interface/can-write?]] for :model/Database
in [[metabase.models.database]] to exclude the details field, if the requesting user lacks permission to change the
database details.
-
idvalue must be an integer greater than zero. -
includenullable enum of tables, tables.fields. -
include_editable_data_model -
exclude_uneditable_details
Return a list of autocomplete suggestions for a given prefix, or substring. Should only specify one, but
substring will have priority if both are present.
This is intended 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"].
-
idvalue must be an integer greater than zero. -
prefixnullable value must be a non-blank string. -
substringnullable value must be a non-blank string.
Return a list of Card autocomplete suggestions for a given query in a given Database.
This is intended for use with the ACE Editor when the User is typing in a template tag for a Card, e.g. {{#...}}.
-
idvalue must be an integer greater than zero. -
queryvalue must be a non-blank string.
Get a list of all Fields in Database.
idvalue must be an integer greater than zero.
Get a list of all primary key Fields for Database.
-
idvalue must be an integer greater than zero. -
include_editable_data_model
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.
-
idvalue must be an integer greater than zero. -
include_hiddennullable value must be a valid boolean string ('true' or 'false'). -
include_editable_data_modelnullable value must be a valid boolean string ('true' or 'false'). -
remove_inactivenullable value must be a valid boolean string ('true' or 'false'). -
skip_fieldsnullable value must be a valid boolean string ('true' or 'false').
Return a list of Tables for a Database whose schema is nil or an empty string.
-
idvalue must be an integer greater than zero. -
include_hiddennullable value must be a valid boolean string ('true' or 'false'). -
include_editable_data_modelnullable value must be a valid boolean string ('true' or 'false').
Returns a list of Tables for the given Database id and schema.
-
idvalue must be an integer greater than zero. -
include_hiddennullable value must be a valid boolean string ('true' or 'false'). -
include_editable_data_modelnullable value must be a valid boolean string ('true' or 'false'). -
schema
Returns a list of all the schemas with tables found for the database id. Excludes schemas with no tables.
-
idvalue must be an integer greater than zero. -
include_editable_data_modelnullable value must be a valid boolean string ('true' or 'false'). -
include_hiddennullable value must be a valid boolean string ('true' or 'false').
Returns a list of all syncable schemas found for the database id.
idvalue must be an integer greater than zero.
Get usage info for a database. Returns a map with keys are models and values are the number of entities that use this database.
You must be a superuser to do this.
idvalue must be an integer greater than zero.
Returns a list of all the datasets found for the saved questions virtual database.
Returns a list of Tables for the datasets virtual database.
schema
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.
Returns a list of Tables for the saved questions virtual database.
schema
Returns a list of all the schemas found for the saved questions virtual database.
Add a new Database.
You must be a superuser to do this.
-
enginevalue must be a valid database engine. -
schedulesnullable value must be a valid map of schedule maps for a DB. -
connection_sourcenullable enum of :admin, :setup. -
auto_run_queriesnullable boolean. -
namevalue must be a non-blank string. -
is_full_syncnullable value must be a valid boolean string ('true' or 'false'). -
cache_ttlnullable value must be an integer greater than zero. -
detailsValue must be a map. -
is_on_demandnullable value must be a valid boolean string ('true' or 'false').
Discards all saved field values for this Database.
idvalue must be an integer greater than zero.
Manually set the initial sync status of the Database and corresponding
tables to be complete (see #20863).
idvalue must be an integer greater than zero.
Attempt to enable model persistence for a database. If already enabled returns a generic 204.
idvalue must be an integer greater than zero.
Trigger a manual scan of the field values for this Database.
idvalue must be an integer greater than zero.
Trigger a manual update of the schema metadata for this Database.
idvalue must be an integer greater than zero.
Attempt to disable model persistence for a database. If already not enabled, just returns a generic 204.
idvalue must be an integer greater than zero.
Add the sample database as a new Database.
You must be a superuser to do this.
Validate that we can connect to a database given a set of details.
You must be a superuser to do this.
-
enginevalue must be a valid database engine. -
detailsmap.
Update a Database.
-
enginenullable value must be a valid database engine. -
schedulesnullable value must be a valid map of schedule maps for a DB. -
refingerprintnullable boolean. -
points_of_interestnullable string. -
descriptionnullable string. -
auto_run_queriesnullable boolean. -
namenullable value must be a non-blank string. -
settingsnullable Value must be a map. -
caveatsnullable string. -
is_full_sync -
cache_ttlnullable value must be an integer greater than zero. -
detailsnullable Value must be a map. -
idvalue must be an integer greater than zero. -
is_on_demand