Liking cljdoc? Tell your friends :D

metabase.api.database

/api/database endpoints.

/api/database endpoints.
raw docstring

DBEngineStringclj

Schema for a valid database engine name, e.g. h2 or postgres.

Schema for a valid database engine name, e.g. `h2` or `postgres`.
sourceraw docstring

DELETE_:idclj

DELETE /api/database/:id

Delete a Database.

PARAMS:
  • id
## `DELETE /api/database/:id`

Delete a `Database`.

##### PARAMS:

*  **`id`** 
sourceraw docstring

ExpandedSchedulesMapclj

Schema for the :schedules key we add to the response containing 'expanded' versions of the CRON schedules. This same key is used in reverse to update the schedules.

Schema for the `:schedules` key we add to the response containing 'expanded' versions of the CRON schedules.
This same key is used in reverse to update the schedules.
sourceraw docstring

GET_clj

GET /api/database/

Fetch all Databases. include_tables means we should hydrate the Tables belonging to each DB. include_cards here means we should also include virtual Table entries for saved Questions, e.g. so we can easily use them as source Tables in queries. Default for both is false.

PARAMS:
  • include_tables value may be nil, or if non-nil, value must be a valid boolean string ('true' or 'false').

  • include_cards value may be nil, or if non-nil, value must be a valid boolean string ('true' or 'false').

## `GET /api/database/`

Fetch all `Databases`. `include_tables` means we should hydrate the Tables belonging to each DB. `include_cards` here
  means we should also include virtual Table entries for saved Questions, e.g. so we can easily use them as source
  Tables in queries. Default for both is `false`.

##### PARAMS:

*  **`include_tables`** value may be nil, or if non-nil, value must be a valid boolean string ('true' or 'false').

*  **`include_cards`** value may be nil, or if non-nil, value must be a valid boolean string ('true' or 'false').
sourceraw docstring

GET_:idclj

GET /api/database/:id

Get Database with ID.

PARAMS:
  • id
## `GET /api/database/:id`

Get `Database` with ID.

##### PARAMS:

*  **`id`** 
sourceraw docstring

GET_:id_autocomplete_suggestionsclj

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"]; Fields are returned in the format [field_name "table_name base_type special_type"]

PARAMS:
  • id

  • prefix value must be a non-blank string.

## `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"]`;
   Fields are returned in the format `[field_name "table_name base_type special_type"]`

##### PARAMS:

*  **`id`** 

*  **`prefix`** value must be a non-blank string.
sourceraw docstring

GET_:id_fieldsclj

GET /api/database/:id/fields

Get a list of all Fields in Database.

PARAMS:
  • id
## `GET /api/database/:id/fields`

Get a list of all `Fields` in `Database`.

##### PARAMS:

*  **`id`** 
sourceraw docstring

GET_:id_idfieldsclj

GET /api/database/:id/idfields

Get a list of all primary key Fields for Database.

PARAMS:
  • id
## `GET /api/database/:id/idfields`

Get a list of all primary key `Fields` for `Database`.

##### PARAMS:

*  **`id`** 
sourceraw docstring

GET_:id_metadataclj

GET /api/database/:id/metadata

Get metadata about a Database, including all of its Tables and Fields. Returns DB, fields, and field values.

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.

##### PARAMS:

*  **`id`** 
sourceraw docstring

GET_:id_schema_:schemaclj

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/schema/:schema`

Returns a list of tables for the given database `id` and `schema`

##### PARAMS:

*  **`id`** 

*  **`schema`** 
sourceraw docstring

GET_:id_schemasclj

GET /api/database/:id/schemas

Returns a list of all the schemas found for the database id

PARAMS:
  • id
## `GET /api/database/:id/schemas`

Returns a list of all the schemas found for the database `id`

##### PARAMS:

*  **`id`** 
sourceraw docstring

GET_:virtual-db_metadataclj

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/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.
sourceraw docstring

POST_clj

POST /api/database/

Add a new Database.

You must be a superuser to do this.

PARAMS:
  • name value must be a non-blank string.

  • engine value must be a valid database engine.

  • details value must be a map.

  • is_full_sync value may be nil, or if non-nil, value must be a boolean.

  • is_on_demand value may be nil, or if non-nil, value must be a boolean.

  • schedules value may be nil, or if non-nil, value must be a valid map of schedule maps for a DB.

## `POST /api/database/`

Add a new `Database`.

You must be a superuser to do this.

##### PARAMS:

*  **`name`** value must be a non-blank string.

*  **`engine`** value must be a valid database engine.

*  **`details`** value must be a map.

*  **`is_full_sync`** value may be nil, or if non-nil, value must be a boolean.

*  **`is_on_demand`** value may be nil, or if non-nil, value must be a boolean.

*  **`schedules`** value may be nil, or if non-nil, value must be a valid map of schedule maps for a DB.
sourceraw docstring

POST_:id_discard_valuesclj

POST /api/database/:id/discard_values

Discards all saved field values for this Database.

You must be a superuser to do this.

PARAMS:
  • id
## `POST /api/database/:id/discard_values`

Discards all saved field values for this `Database`.

You must be a superuser to do this.

##### PARAMS:

*  **`id`** 
sourceraw docstring

POST_:id_rescan_valuesclj

POST /api/database/:id/rescan_values

Trigger a manual scan of the field values for this Database.

You must be a superuser to do this.

PARAMS:
  • id
## `POST /api/database/:id/rescan_values`

Trigger a manual scan of the field values for this `Database`.

You must be a superuser to do this.

##### PARAMS:

*  **`id`** 
sourceraw docstring

POST_:id_syncclj

POST /api/database/:id/sync

Update the metadata for this Database. This happens asynchronously.

PARAMS:
  • id
## `POST /api/database/:id/sync`

Update the metadata for this `Database`. This happens asynchronously.

##### PARAMS:

*  **`id`** 
sourceraw docstring

POST_:id_sync_schemaclj

POST /api/database/:id/sync_schema

Trigger a manual update of the schema metadata for this Database.

You must be a superuser to do this.

PARAMS:
  • id
## `POST /api/database/:id/sync_schema`

Trigger a manual update of the schema metadata for this `Database`.

You must be a superuser to do this.

##### PARAMS:

*  **`id`** 
sourceraw docstring

POST_sample_datasetclj

POST /api/database/sample_dataset

Add the sample dataset as a new Database.

You must be a superuser to do this.

## `POST /api/database/sample_dataset`

Add the sample dataset as a new `Database`.

You must be a superuser to do this.
sourceraw docstring

POST_validateclj

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:
  • engine value must be a valid database engine.

  • details value must be a map.

## `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:

*  **`engine`** value must be a valid database engine.

*  **`details`** value must be a map.
sourceraw docstring

PUT_:idclj

PUT /api/database/:id

Update a Database.

You must be a superuser to do this.

PARAMS:
  • engine value may be nil, or if non-nil, value must be a valid database engine.

  • schedules value may be nil, or if non-nil, value must be a valid map of schedule maps for a DB.

  • points_of_interest value may be nil, or if non-nil, value must be a string.

  • description value may be nil, or if non-nil, value must be a string.

  • name value may be nil, or if non-nil, value must be a non-blank string.

  • caveats value may be nil, or if non-nil, value must be a string.

  • is_full_sync

  • details value may be nil, or if non-nil, value must be a map.

  • id

  • is_on_demand

## `PUT /api/database/:id`

Update a `Database`.

You must be a superuser to do this.

##### PARAMS:

*  **`engine`** value may be nil, or if non-nil, value must be a valid database engine.

*  **`schedules`** value may be nil, or if non-nil, value must be a valid map of schedule maps for a DB.

*  **`points_of_interest`** value may be nil, or if non-nil, value must be a string.

*  **`description`** value may be nil, or if non-nil, value must be a string.

*  **`name`** value may be nil, or if non-nil, value must be a non-blank string.

*  **`caveats`** value may be nil, or if non-nil, value must be a string.

*  **`is_full_sync`** 

*  **`details`** value may be nil, or if non-nil, value must be a map.

*  **`id`** 

*  **`is_on_demand`** 
sourceraw docstring

routesclj

Ring routes for api/database: (POST_ PUT_:id POST_:id_discard_values POST_sample_dataset POST_:id_rescan_values POST_validate POST_:id_sync_schema GET_:id_idfields GET_:id_autocomplete_suggestions GET_:id_metadata GET_:id_schema_:schema POST_:id_sync GET_:virtual-db_metadata GET_ GET_:id_schemas GET_:id_fields DELETE_:id GET_:id)

Ring routes for api/database:
(POST_
 PUT_:id
 POST_:id_discard_values
 POST_sample_dataset
 POST_:id_rescan_values
 POST_validate
 POST_:id_sync_schema
 GET_:id_idfields
 GET_:id_autocomplete_suggestions
 GET_:id_metadata
 GET_:id_schema_:schema
 POST_:id_sync
 GET_:virtual-db_metadata
 GET_
 GET_:id_schemas
 GET_:id_fields
 DELETE_:id
 GET_:id)
sourceraw docstring

schedule-map->cron-stringsclj

(schedule-map->cron-strings {:keys [metadata_sync cache_field_values]})

Inputs: [{:keys [metadata_sync cache_field_values]} :- ExpandedSchedulesMap] Returns: CronSchedulesMap

Convert a map of :schedules as passed in by the frontend to a map of cron strings with the approriate keys for Database. This map can then be merged directly inserted into the DB, or merged with a map of other columns to insert/update.

Inputs: [{:keys [metadata_sync cache_field_values]} :- ExpandedSchedulesMap]
Returns: CronSchedulesMap

Convert a map of `:schedules` as passed in by the frontend to a map of cron strings with the approriate keys for
 Database. This map can then be merged directly inserted into the DB, or merged with a map of other columns to
 insert/update.
sourceraw docstring

test-database-connectionclj

(test-database-connection engine
                          {:keys [host port] :as details}
                          &
                          {:keys [invalid-response-handler]
                           :or {invalid-response-handler
                                  invalid-connection-response}})

Try out the connection details for a database and useful error message if connection fails, returns nil if connection succeeds.

Try out the connection details for a database and useful error message if connection fails, returns `nil` if
connection succeeds.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close