> For the complete documentation index, see [llms.txt](https://docs.mediarithmics.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mediarithmics.io/api-reference/datamart-management/data-warehouse.md).

# Data Warehouse

Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems.

## GET /datawarehouses/{datawarehouse\_id}/databases/{database\_id}

> Retrieve DataWarehouse database

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/databases/{database_id}":{"get":{"tags":["Data Warehouse"],"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseDatabaseResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"parameters":[{"style":"simple","name":"datawarehouse_id","explode":false,"schema":{"type":"string"},"description":"The data warehouse owning the database","required":true,"in":"path"},{"schema":{"type":"string"},"name":"database_id","style":"simple","in":"path","description":"The data warehouse database id","explode":false,"required":true}],"description":"","operationId":"getDataWarehouseDatabase","summary":"Retrieve DataWarehouse database"}}},"components":{"schemas":{"DataWarehouseDatabaseResource":{"type":"object","properties":{"data_warehouse_id":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"name":{"type":"string","readOnly":false},"discovery_date":{"type":"integer","format":"int64","default":0,"readOnly":true}},"required":["data_warehouse_id","discovery_date","id","name"]},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## PUT /datawarehouses/{datawarehouse\_id}/databases/{database\_id}

> Update a DataWarehouse database

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/databases/{database_id}":{"put":{"parameters":[{"schema":{"type":"string"},"in":"path","style":"simple","description":"The data warehouse owning the database","name":"datawarehouse_id","required":true,"explode":false},{"required":true,"in":"path","style":"simple","schema":{"type":"string"},"name":"database_id","description":"The data warehouse database id","explode":false}],"requestBody":{"description":"The database to update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataWarehouseDatabaseResource"}}},"required":true},"description":"","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseDatabaseResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"summary":"Update a DataWarehouse database","tags":["Data Warehouse"],"operationId":"updateDataWarehouseDatabase"}}},"components":{"schemas":{"DataWarehouseDatabaseResource":{"type":"object","properties":{"data_warehouse_id":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"name":{"type":"string","readOnly":false},"discovery_date":{"type":"integer","format":"int64","default":0,"readOnly":true}},"required":["data_warehouse_id","discovery_date","id","name"]},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## DELETE /datawarehouses/{datawarehouse\_id}/databases/{database\_id}

> Delete a DataWarehouse database

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/databases/{database_id}":{"delete":{"responses":{"200":{"$ref":"#/components/responses/simple"},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"operationId":"deleteDataWarehouseDatabase","description":"","summary":"Delete a DataWarehouse database","tags":["Data Warehouse"],"parameters":[{"name":"datawarehouse_id","schema":{"type":"string"},"in":"path","explode":false,"style":"simple","required":true,"description":"The data warehouse owning the database"},{"description":"The data warehouse database id","explode":false,"schema":{"type":"string"},"in":"path","required":true,"style":"simple","name":"database_id"}]}}},"components":{"responses":{"simple":{"description":"Success response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"schemas":{"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}}}}
```

## GET /datamarts/{datamart\_id}/datawarehouses/{datawarehouse\_id}/config

> Retrieve a DataWarehouse Datamart Config

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/datawarehouses/{datawarehouse_id}/config":{"get":{"tags":["Data Warehouse"],"operationId":"findDataWarehouseDatamartConfig","summary":"Retrieve a DataWarehouse Datamart Config","description":"","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseDatamartConfigResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"parameters":[{"explode":false,"description":"The datamart id","style":"simple","in":"path","required":true,"schema":{"type":"string"},"name":"datamart_id"},{"schema":{"type":"string"},"explode":false,"in":"path","style":"simple","name":"datawarehouse_id","required":true,"description":"The data warehouse id"}]}}},"components":{"schemas":{"DataWarehouseDatamartConfigResource":{"type":"object","properties":{"datamart_id":{"type":"string","readOnly":false},"role":{"type":"string","readOnly":false},"last_modified_ts":{"type":"integer","format":"int64","default":0,"readOnly":true},"output_schema_name":{"type":"string","readOnly":false},"working_schema_name":{"type":"string","readOnly":false},"id":{"type":"string","readOnly":true},"data_warehouse_id":{"type":"string","readOnly":false},"created_ts":{"type":"integer","format":"int64","default":0,"readOnly":true},"compute_name":{"type":"string","readOnly":false}},"required":["created_ts","data_warehouse_id","datamart_id","id"]},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## PUT /datamarts/{datamart\_id}/datawarehouses/{datawarehouse\_id}/config

> Upsert a DataWarehouse Datamart Config

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/datawarehouses/{datawarehouse_id}/config":{"put":{"parameters":[{"name":"datamart_id","schema":{"type":"string"},"description":"The datamart id","explode":false,"style":"simple","required":true,"in":"path"},{"description":"The data warehouse id","name":"datawarehouse_id","schema":{"type":"string"},"explode":false,"required":true,"style":"simple","in":"path"}],"description":"","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseDatamartConfigResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"operationId":"upsertDataWarehouseDatamartConfig","requestBody":{"description":"The datamart config to upsert","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataWarehouseDatamartConfigResource"}}},"required":true},"summary":"Upsert a DataWarehouse Datamart Config","tags":["Data Warehouse"]}}},"components":{"schemas":{"DataWarehouseDatamartConfigResource":{"type":"object","properties":{"datamart_id":{"type":"string","readOnly":false},"role":{"type":"string","readOnly":false},"last_modified_ts":{"type":"integer","format":"int64","default":0,"readOnly":true},"output_schema_name":{"type":"string","readOnly":false},"working_schema_name":{"type":"string","readOnly":false},"id":{"type":"string","readOnly":true},"data_warehouse_id":{"type":"string","readOnly":false},"created_ts":{"type":"integer","format":"int64","default":0,"readOnly":true},"compute_name":{"type":"string","readOnly":false}},"required":["created_ts","data_warehouse_id","datamart_id","id"]},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## DELETE /datamarts/{datamart\_id}/datawarehouses/{datawarehouse\_id}/config

> Delete a DataWarehouse Datamart Config

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/datawarehouses/{datawarehouse_id}/config":{"delete":{"summary":"Delete a DataWarehouse Datamart Config","tags":["Data Warehouse"],"parameters":[{"schema":{"type":"string"},"explode":false,"required":true,"style":"simple","name":"datamart_id","description":"The datamart id","in":"path"},{"explode":false,"description":"The data warehouse id","name":"datawarehouse_id","schema":{"type":"string"},"in":"path","style":"simple","required":true}],"operationId":"deleteDataWarehouseDatamartConfig","description":"","responses":{"200":{"$ref":"#/components/responses/simple"},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}}}}},"components":{"responses":{"simple":{"description":"Success response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"schemas":{"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}}}}
```

## POST /datawarehouses/{datawarehouse\_id}/credentials

> Register a datawarehouse credentials

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/credentials":{"post":{"summary":"Register a datawarehouse credentials","tags":["Data Warehouse"],"requestBody":{"description":"The gcp service account to register","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataWarehouseCredentialsResource"}}},"required":true},"description":"","parameters":[{"explode":false,"style":"simple","required":true,"description":"The data warehouse the credentials give access to","schema":{"type":"string"},"in":"path","name":"datawarehouse_id"}],"responses":{"200":{"$ref":"#/components/responses/simple"},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"operationId":"registerCredentials"}}},"components":{"schemas":{"DataWarehouseCredentialsResource":{"type":"object","properties":{"scheme":{"$ref":"#/components/schemas/TenantCredentialsScheme"},"credentials":{"type":"string","readOnly":false}},"required":["credentials","scheme"]},"TenantCredentialsScheme":{"type":"string","enum":["GOOGLE_SERVICE_ACCOUNT","NO_CREDENTIALS","JDBC_CREDENTIALS","SNOWFLAKE","HMAC","S3","OAUTH2","API_TOKEN","LOGIN_PASSWORD"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"simple":{"description":"Success response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## Preview a table's data

> Return the first rows of a data warehouse table

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/tables/{table_id}/preview":{"get":{"description":"Return the first rows of a data warehouse table","operationId":"previewTable","summary":"Preview a table's data","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseTablePreviewResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"parameters":[{"style":"simple","in":"path","schema":{"type":"string"},"required":true,"name":"datawarehouse_id","description":"The data warehouse owning the table","explode":false},{"required":true,"in":"path","name":"table_id","schema":{"type":"string"},"explode":false,"style":"simple","description":"The table to preview"},{"required":true,"explode":true,"schema":{"type":"string"},"name":"datamart_id","in":"query","description":"The datamart used to resolve the data warehouse's datafarm","style":"form"}],"tags":["Data Warehouse"]}}},"components":{"schemas":{"DataWarehouseTablePreviewResource":{"type":"object","properties":{"columns":{"type":"array","items":{"type":"string","readOnly":false},"readOnly":false},"rows":{"type":"array","items":{"type":"array","items":{"type":["string","null"],"readOnly":false},"readOnly":false},"readOnly":false}},"required":["columns","rows"]},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## GET /datawarehouses

> Find DataWarehouses

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses":{"get":{"parameters":[{"in":"query","style":"form","required":true,"schema":{"type":"integer","format":"int64"},"explode":true,"description":"The data warehouse owning the tables","name":"organisation_id"},{"explode":true,"in":"query","style":"form","description":"Offset from which the search must be performed","name":"first_result","required":false,"schema":{"type":"integer","format":"int32"}},{"required":false,"explode":true,"name":"max_results","style":"form","schema":{"type":"integer","format":"int32"},"description":"Number of maximum items that shall be return by this search","in":"query"}],"operationId":"findDataWarehouses","description":"","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DataWarehouseResource"}},"status":{"type":"string","enum":["ok"]},"max_results":{"type":"integer"},"first_result":{"type":"integer"},"total":{"type":"integer"},"count":{"type":"integer"}},"required":["count","data","first_result","max_results","status","total"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"tags":["Data Warehouse"],"summary":"Find DataWarehouses"}}},"components":{"schemas":{"DataWarehouseResource":{"type":"object","properties":{"organisation_id":{"type":"string","readOnly":true},"description":{"type":"string","readOnly":false},"engine_type":{"$ref":"#/components/schemas/DataWarehouseEngineType"},"id":{"type":"string","readOnly":true},"name":{"type":"string","readOnly":false},"location":{"type":"string","readOnly":false}},"required":["description","engine_type","id","name","organisation_id"]},"DataWarehouseEngineType":{"type":"string","enum":["BIG_QUERY","POSTGRES","SNOWFLAKE","DUCK_DB"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## POST /datawarehouses

> Create a DataWarehouse

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses":{"post":{"requestBody":{"description":"The datamart to create","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataWarehouseResource"}}},"required":true},"tags":["Data Warehouse"],"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"summary":"Create a DataWarehouse","description":"","operationId":"createDataWarehouse"}}},"components":{"schemas":{"DataWarehouseResource":{"type":"object","properties":{"organisation_id":{"type":"string","readOnly":true},"description":{"type":"string","readOnly":false},"engine_type":{"$ref":"#/components/schemas/DataWarehouseEngineType"},"id":{"type":"string","readOnly":true},"name":{"type":"string","readOnly":false},"location":{"type":"string","readOnly":false}},"required":["description","engine_type","id","name","organisation_id"]},"DataWarehouseEngineType":{"type":"string","enum":["BIG_QUERY","POSTGRES","SNOWFLAKE","DUCK_DB"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## POST /datawarehouses/wizard

> Validate and create a DataWarehouse

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/wizard":{"post":{"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"operationId":"executeWizard","summary":"Validate and create a DataWarehouse","description":"","tags":["Data Warehouse"],"requestBody":{"description":"The datamart to create","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataWarehouseWizardResource"}}},"required":true}}}},"components":{"schemas":{"DataWarehouseResource":{"type":"object","properties":{"organisation_id":{"type":"string","readOnly":true},"description":{"type":"string","readOnly":false},"engine_type":{"$ref":"#/components/schemas/DataWarehouseEngineType"},"id":{"type":"string","readOnly":true},"name":{"type":"string","readOnly":false},"location":{"type":"string","readOnly":false}},"required":["description","engine_type","id","name","organisation_id"]},"DataWarehouseEngineType":{"type":"string","enum":["BIG_QUERY","POSTGRES","SNOWFLAKE","DUCK_DB"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]},"DataWarehouseWizardResource":{"discriminator":{"propertyName":"type","mapping":{"POSTGRES":"#/components/schemas/Postgres","BIG_QUERY":"#/components/schemas/BigQuery","SNOWFLAKE":"#/components/schemas/Snowflake"}},"oneOf":[{"$ref":"#/components/schemas/Postgres"},{"$ref":"#/components/schemas/BigQuery"},{"$ref":"#/components/schemas/Snowflake"}],"properties":{"type":{"type":"string","enum":["POSTGRES","BIG_QUERY","SNOWFLAKE"]}},"required":["type"]},"Postgres":{"type":"object","properties":{"organisation_id":{"type":"string","readOnly":false},"credentials":{"type":"string","readOnly":false},"working_schema_name":{"type":"string","readOnly":false},"output_schema_name":{"type":"string","readOnly":false},"description":{"type":"string","readOnly":false},"data_warehouse_name":{"type":"string","readOnly":false}},"required":["credentials","data_warehouse_name","description","organisation_id"]},"BigQuery":{"type":"object","properties":{"working_schema_name":{"type":"string","readOnly":false},"organisation_id":{"type":"string","readOnly":false},"service_account":{"type":"string","readOnly":false},"location":{"type":"string","readOnly":false},"project_id":{"type":"string","readOnly":false},"data_warehouse_name":{"type":"string","readOnly":false},"description":{"type":"string","readOnly":false},"output_schema_name":{"type":"string","readOnly":false}},"required":["data_warehouse_name","description","organisation_id","service_account"]},"Snowflake":{"type":"object","properties":{"working_schema_name":{"type":"string","readOnly":false},"data_warehouse_name":{"type":"string","readOnly":false},"output_schema_name":{"type":"string","readOnly":false},"credentials":{"type":"string","readOnly":false},"organisation_id":{"type":"string","readOnly":false},"description":{"type":"string","readOnly":false}},"required":["credentials","data_warehouse_name","description","organisation_id"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## GET /datawarehouses/{datawarehouse\_id}/metadata

> Fetch data warehouse database metadata

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/metadata":{"get":{"description":"","tags":["Data Warehouse"],"operationId":"getDatabasesMetadata","parameters":[{"in":"path","explode":false,"required":true,"description":"The data warehouse owning the tables","schema":{"type":"string"},"style":"simple","name":"datawarehouse_id"},{"required":false,"name":"include_disappeared","style":"form","description":"Include elements with an non null disappearance date","schema":{"type":"boolean"},"explode":true,"in":"query"}],"summary":"Fetch data warehouse database metadata","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseInfosResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}}}}},"components":{"schemas":{"DataWarehouseInfosResource":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"name":{"type":"string","readOnly":false},"databases":{"type":"array","items":{"$ref":"#/components/schemas/DataWarehouseDatabaseInfosResource"},"readOnly":false}},"required":["databases","id","name"]},"DataWarehouseDatabaseInfosResource":{"type":"object","properties":{"discovery_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"last_seen_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"disappearance_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"schemas":{"type":"array","items":{"$ref":"#/components/schemas/DataWarehouseSchemaInfosResource"},"readOnly":false},"name":{"type":"string","readOnly":false},"data_warehouse_id":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true}},"required":["data_warehouse_id","discovery_date","id","last_seen_date","name","schemas"]},"DataWarehouseSchemaInfosResource":{"type":"object","properties":{"disappearance_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"discovery_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"tables":{"type":"array","items":{"$ref":"#/components/schemas/DataWarehouseTableInfosResource"},"readOnly":false},"last_seen_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"id":{"type":"string","readOnly":false},"name":{"type":"string","readOnly":false}},"required":["discovery_date","id","last_seen_date","name","tables"]},"DataWarehouseTableInfosResource":{"type":"object","properties":{"read_access_disappearance_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"last_seen_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"columns":{"type":"array","items":{"$ref":"#/components/schemas/DataWarehouseTableColumnResource"},"readOnly":false},"discovery_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"has_read_access":{"type":"boolean","default":false,"readOnly":false},"disappearance_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"name":{"type":"string","readOnly":false},"id":{"type":"string","readOnly":true}},"required":["columns","discovery_date","has_read_access","id","last_seen_date","name"]},"DataWarehouseTableColumnResource":{"type":"object","properties":{"primary_key":{"type":"boolean","default":false,"readOnly":false},"discovery_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"index":{"type":"integer","format":"int32","default":0,"readOnly":false},"type_name":{"type":"string","readOnly":false},"nullable":{"type":"boolean","default":false,"readOnly":false},"repeated":{"type":"boolean","default":false,"readOnly":false},"last_seen_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"column_name":{"type":"string","readOnly":false},"disappearance_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"id":{"type":"string","readOnly":false}},"required":["column_name","discovery_date","id","index","last_seen_date","nullable","primary_key","repeated","type_name"]},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## POST /datawarehouses/{datawarehouse\_id}/metadata

> Fetch tables metadata from big query

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/metadata":{"post":{"requestBody":{"description":"The gcp service account to register","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataWarehouseFetchMetadataRequest"}}},"required":true},"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseInfosResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"tags":["Data Warehouse"],"operationId":"fetchExternalMetadata","summary":"Fetch tables metadata from big query","description":"","parameters":[{"description":"The data warehouse owning the tables","schema":{"type":"string"},"explode":false,"name":"datawarehouse_id","required":true,"in":"path","style":"simple"}]}}},"components":{"schemas":{"DataWarehouseFetchMetadataRequest":{"type":"object","properties":{"fetch_only":{"type":"boolean","default":false,"readOnly":false}},"required":["fetch_only"]},"DataWarehouseInfosResource":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"name":{"type":"string","readOnly":false},"databases":{"type":"array","items":{"$ref":"#/components/schemas/DataWarehouseDatabaseInfosResource"},"readOnly":false}},"required":["databases","id","name"]},"DataWarehouseDatabaseInfosResource":{"type":"object","properties":{"discovery_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"last_seen_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"disappearance_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"schemas":{"type":"array","items":{"$ref":"#/components/schemas/DataWarehouseSchemaInfosResource"},"readOnly":false},"name":{"type":"string","readOnly":false},"data_warehouse_id":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true}},"required":["data_warehouse_id","discovery_date","id","last_seen_date","name","schemas"]},"DataWarehouseSchemaInfosResource":{"type":"object","properties":{"disappearance_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"discovery_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"tables":{"type":"array","items":{"$ref":"#/components/schemas/DataWarehouseTableInfosResource"},"readOnly":false},"last_seen_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"id":{"type":"string","readOnly":false},"name":{"type":"string","readOnly":false}},"required":["discovery_date","id","last_seen_date","name","tables"]},"DataWarehouseTableInfosResource":{"type":"object","properties":{"read_access_disappearance_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"last_seen_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"columns":{"type":"array","items":{"$ref":"#/components/schemas/DataWarehouseTableColumnResource"},"readOnly":false},"discovery_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"has_read_access":{"type":"boolean","default":false,"readOnly":false},"disappearance_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"name":{"type":"string","readOnly":false},"id":{"type":"string","readOnly":true}},"required":["columns","discovery_date","has_read_access","id","last_seen_date","name"]},"DataWarehouseTableColumnResource":{"type":"object","properties":{"primary_key":{"type":"boolean","default":false,"readOnly":false},"discovery_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"index":{"type":"integer","format":"int32","default":0,"readOnly":false},"type_name":{"type":"string","readOnly":false},"nullable":{"type":"boolean","default":false,"readOnly":false},"repeated":{"type":"boolean","default":false,"readOnly":false},"last_seen_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"column_name":{"type":"string","readOnly":false},"disappearance_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"id":{"type":"string","readOnly":false}},"required":["column_name","discovery_date","id","index","last_seen_date","nullable","primary_key","repeated","type_name"]},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## GET /datawarehouses/{datawarehouse\_id}

> Retrieve a DataWarehouse

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}":{"get":{"description":"","summary":"Retrieve a DataWarehouse","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"tags":["Data Warehouse"],"operationId":"getDataWarehouse","parameters":[{"name":"datawarehouse_id","description":"The data warehouse the credentials give access to","required":true,"style":"simple","in":"path","explode":false,"schema":{"type":"string"}}]}}},"components":{"schemas":{"DataWarehouseResource":{"type":"object","properties":{"organisation_id":{"type":"string","readOnly":true},"description":{"type":"string","readOnly":false},"engine_type":{"$ref":"#/components/schemas/DataWarehouseEngineType"},"id":{"type":"string","readOnly":true},"name":{"type":"string","readOnly":false},"location":{"type":"string","readOnly":false}},"required":["description","engine_type","id","name","organisation_id"]},"DataWarehouseEngineType":{"type":"string","enum":["BIG_QUERY","POSTGRES","SNOWFLAKE","DUCK_DB"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## PUT /datawarehouses/{datawarehouse\_id}

> Update a DataWarehouse

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}":{"put":{"summary":"Update a DataWarehouse","parameters":[{"description":"The data warehouse the credentials give access to","schema":{"type":"string"},"required":true,"name":"datawarehouse_id","explode":false,"in":"path","style":"simple"}],"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"requestBody":{"description":"The datamart to create","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataWarehouseResource"}}},"required":true},"tags":["Data Warehouse"],"description":"","operationId":"updateDataWarehouse"}}},"components":{"schemas":{"DataWarehouseResource":{"type":"object","properties":{"organisation_id":{"type":"string","readOnly":true},"description":{"type":"string","readOnly":false},"engine_type":{"$ref":"#/components/schemas/DataWarehouseEngineType"},"id":{"type":"string","readOnly":true},"name":{"type":"string","readOnly":false},"location":{"type":"string","readOnly":false}},"required":["description","engine_type","id","name","organisation_id"]},"DataWarehouseEngineType":{"type":"string","enum":["BIG_QUERY","POSTGRES","SNOWFLAKE","DUCK_DB"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## DELETE /datawarehouses/{datawarehouse\_id}

> Delete a DataWarehouse

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}":{"delete":{"description":"","operationId":"deleteDataWarehouse","summary":"Delete a DataWarehouse","tags":["Data Warehouse"],"parameters":[{"explode":false,"in":"path","style":"simple","name":"datawarehouse_id","description":"The data warehouse the credentials give access to","required":true,"schema":{"type":"string"}}],"responses":{"200":{"$ref":"#/components/responses/simple"},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}}}}},"components":{"responses":{"simple":{"description":"Success response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"schemas":{"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}}}}
```

## GET /datawarehouses/{datawarehouse\_id}/columns/{column\_id}

> Retrieve a column context from its id

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/columns/{column_id}":{"get":{"parameters":[{"explode":false,"in":"path","schema":{"type":"string"},"required":true,"description":"The data warehouse","style":"simple","name":"datawarehouse_id"},{"name":"column_id","style":"simple","explode":false,"description":"The data warehouse column","required":true,"schema":{"type":"string"},"in":"path"}],"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseTableColumnContextResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"tags":["Data Warehouse"],"operationId":"getColumnContext","description":"","summary":"Retrieve a column context from its id"}}},"components":{"schemas":{"DataWarehouseTableColumnContextResource":{"type":"object","properties":{"table_id":{"type":"string","readOnly":false},"schema_name":{"type":"string","readOnly":false},"database_id":{"type":"string","readOnly":false},"data_warehouse_id":{"type":"string","readOnly":false},"data_warehouse_name":{"type":"string","readOnly":false},"column_name":{"type":"string","readOnly":false},"id":{"type":"string","readOnly":false},"database_name":{"type":"string","readOnly":false},"schema_id":{"type":"string","readOnly":false},"table_name":{"type":"string","readOnly":false}},"required":["column_name","data_warehouse_id","data_warehouse_name","database_id","database_name","id","schema_id","schema_name","table_id","table_name"]},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## GET /datawarehouses/{datawarehouse\_id}/databases

> Find DataWarehouse databases

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/databases":{"get":{"summary":"Find DataWarehouse databases","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"count":{"type":"integer"},"first_result":{"type":"integer"},"max_results":{"type":"integer"},"total":{"type":"integer"},"data":{"type":"array","items":{"$ref":"#/components/schemas/DataWarehouseDatabaseResource"}}},"required":["count","data","first_result","max_results","status","total"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"parameters":[{"required":true,"name":"datawarehouse_id","schema":{"type":"string"},"explode":false,"in":"path","style":"simple","description":"The data warehouse owning the databases"},{"in":"query","schema":{"type":"integer","format":"int32"},"style":"form","description":"Offset from which the search must be performed","required":false,"explode":true,"name":"first_result"},{"style":"form","required":false,"description":"Number of maximum items that shall be return by this search","schema":{"type":"integer","format":"int32"},"name":"max_results","in":"query","explode":true}],"operationId":"findDataWarehouseDatabases","description":"","tags":["Data Warehouse"]}}},"components":{"schemas":{"DataWarehouseDatabaseResource":{"type":"object","properties":{"data_warehouse_id":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"name":{"type":"string","readOnly":false},"discovery_date":{"type":"integer","format":"int64","default":0,"readOnly":true}},"required":["data_warehouse_id","discovery_date","id","name"]},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## POST /datawarehouses/{datawarehouse\_id}/databases

> Create database

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/databases":{"post":{"requestBody":{"description":"The gcp service account to register","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataWarehouseDatabaseInfosListResource"}}},"required":true},"parameters":[{"style":"simple","name":"datawarehouse_id","explode":false,"schema":{"type":"string"},"description":"The data warehouse owning the databases","in":"path","required":true}],"summary":"Create database","tags":["Data Warehouse"],"operationId":"createDatabase","description":"","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"status":{"type":"string","enum":["ok"]},"max_results":{"type":"integer"},"first_result":{"type":"integer"},"total":{"type":"integer"},"data":{"type":"array","items":{"$ref":"#/components/schemas/DataWarehouseDatabaseInfosResource"}}},"required":["count","data","first_result","max_results","status","total"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}}}}},"components":{"schemas":{"DataWarehouseDatabaseInfosListResource":{"type":"object","properties":{"databases":{"type":"array","items":{"$ref":"#/components/schemas/DataWarehouseDatabaseInfosResource"},"readOnly":false}},"required":["databases"]},"DataWarehouseDatabaseInfosResource":{"type":"object","properties":{"discovery_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"last_seen_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"disappearance_date":{"type":"integer","format":"int64","default":0,"readOnly":true},"schemas":{"type":"array","items":{"$ref":"#/components/schemas/DataWarehouseSchemaInfosResource"},"readOnly":false},"name":{"type":"string","readOnly":false},"data_warehouse_id":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true}},"required":["data_warehouse_id","discovery_date","id","last_seen_date","name","schemas"]},"DataWarehouseSchemaInfosResource":{"type":"object","properties":{"disappearance_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"discovery_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"tables":{"type":"array","items":{"$ref":"#/components/schemas/DataWarehouseTableInfosResource"},"readOnly":false},"last_seen_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"id":{"type":"string","readOnly":false},"name":{"type":"string","readOnly":false}},"required":["discovery_date","id","last_seen_date","name","tables"]},"DataWarehouseTableInfosResource":{"type":"object","properties":{"read_access_disappearance_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"last_seen_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"columns":{"type":"array","items":{"$ref":"#/components/schemas/DataWarehouseTableColumnResource"},"readOnly":false},"discovery_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"has_read_access":{"type":"boolean","default":false,"readOnly":false},"disappearance_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"name":{"type":"string","readOnly":false},"id":{"type":"string","readOnly":true}},"required":["columns","discovery_date","has_read_access","id","last_seen_date","name"]},"DataWarehouseTableColumnResource":{"type":"object","properties":{"primary_key":{"type":"boolean","default":false,"readOnly":false},"discovery_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"index":{"type":"integer","format":"int32","default":0,"readOnly":false},"type_name":{"type":"string","readOnly":false},"nullable":{"type":"boolean","default":false,"readOnly":false},"repeated":{"type":"boolean","default":false,"readOnly":false},"last_seen_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"column_name":{"type":"string","readOnly":false},"disappearance_date":{"type":"integer","format":"int64","default":0,"readOnly":false},"id":{"type":"string","readOnly":false}},"required":["column_name","discovery_date","id","index","last_seen_date","nullable","primary_key","repeated","type_name"]},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mediarithmics.io/api-reference/datamart-management/data-warehouse.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
