GetMaterializedView

Updated at:

Queries the definition, cumulative benefits, refresh configuration, and refresh history of a specified materialized view.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

odps:GetMaterializedView

get

*All Resource

*

None None

Request syntax

GET /api/v2/projects/{projectName}/materializedViews/{name} HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

projectName

string

Yes

The name of the MaxCompute project.

example_project

name

string

Yes

The name of the materialized view.

mv_sales_daily

Request parameters

Parameter

Type

Required

Description

Example

schema

string

No

The name of the schema to which the materialized view belongs.

default

Response elements

Element

Type

Description

Example

object

PopResult

requestId

string

The unique identifier of the API request. Provide this identifier when troubleshooting call issues.

0be3e0aa16667684362147582e038f

httpCode

integer

The HTTP status code of the request.

200

errorCode

string

The error code returned when the request fails.

InvalidArgument

errorMsg

string

The error message returned when the request fails.

The specified parameter is invalid.

data

object

The details and benefits of the materialized view.

name

string

The name of the materialized view.

mv_sales_daily

project

string

The name of the MaxCompute project.

example_project

schema

string

The name of the schema to which the materialized view belongs.

default

id

string

The recommendation identifier corresponding to the materialized view.

a7b1d9e0f43c25a8

owner

string

The owner of the materialized view.

example_owner

usedCount

integer

The cumulative number of times the materialized view has been used by jobs.

36

usedCountLastDay

integer

The number of times the materialized view was used by jobs on the previous statistical day.

8

savedCu

number

The cumulative saved compute resource usage, measured in CU hours.

14.5

savedCuLastDay

number

The saved compute resource usage on the previous statistical day, measured in CU hours.

2.8

savedCalculation

integer

The cumulative amount of saved calculations, calculated by multiplying the scan volume by the complexity.

5368709120

savedCalculationLastDay

integer

The amount of saved calculations on the previous statistical day, calculated by multiplying the scan volume by the complexity.

1073741824

savedTime

integer

The cumulative job computing time saved, in seconds.

4800

savedTimeLastDay

integer

The job computing time saved on the previous statistical day, in seconds.

900

createTime

integer

The creation time of the materialized view, represented as a Unix timestamp in milliseconds.

1795132800000

status

string

The creation status. Valid values: CREATED: Created. CREATING: Creating. NOT_CREATE: Not created. UNKNOWN: Unknown.

CREATED

lifeCycle

string

The lifecycle of the materialized view, in days.

30

query

string

The query statement in the definition of the materialized view.

SELECT sales_date, SUM(amount) AS amount FROM sales GROUP BY sales_date

size

integer

The storage space occupied by the materialized view, in bytes.

1048576

enableAutoRefresh

boolean

Indicates whether automatic refresh is enabled.

refreshIntervalMinutes

integer

The automatic refresh interval, in minutes.

60

refreshCron

string

The cron expression for automatic refresh.

0 0 * * * ?

lastRefreshBeginTime

integer

The start time of the most recent refresh, represented as a Unix timestamp in seconds. The value is 0 if no refresh record exists.

1795132800

lastRefreshEndTime

integer

The end time of the most recent refresh, represented as a Unix timestamp in seconds. The value is 0 if no refresh record exists.

1795132800

refreshHistory

array<object>

The refresh history of the materialized view.

object

instId

string

The instance ID of the refresh job.

20261120000000000g1a2b3c4

status

string

The execution status of the refresh job.

Success

startTime

integer

The start time of the refresh, represented as a Unix timestamp in seconds.

1795132800

endTime

integer

The end time of the refresh, represented as a Unix timestamp in seconds.

1795132800

isPartitioned

boolean

Indicates whether the materialized view is a partitioned table.

lastModifyTime

integer

The most recent modification time of the materialized view data, represented as a Unix timestamp in milliseconds.

1795132800000

lastDDLTime

integer

The most recent modification time of the materialized view table schema, represented as a Unix timestamp in milliseconds.

1795132800000

rowCount

integer

The number of rows recorded in the view. This field is omitted if no statistical result is available.

1024

Examples

Success response

JSON format

{
  "requestId": "0be3e0aa16667684362147582e038f",
  "httpCode": 200,
  "errorCode": "InvalidArgument",
  "errorMsg": "The specified parameter is invalid.",
  "data": {
    "name": "mv_sales_daily",
    "project": "example_project",
    "schema": "default",
    "id": "a7b1d9e0f43c25a8",
    "owner": "example_owner",
    "usedCount": 36,
    "usedCountLastDay": 8,
    "savedCu": 14.5,
    "savedCuLastDay": 2.8,
    "savedCalculation": 5368709120,
    "savedCalculationLastDay": 1073741824,
    "savedTime": 4800,
    "savedTimeLastDay": 900,
    "createTime": 1795132800000,
    "status": "CREATED",
    "lifeCycle": "30",
    "query": "SELECT sales_date, SUM(amount) AS amount FROM sales GROUP BY sales_date",
    "size": 1048576,
    "enableAutoRefresh": false,
    "refreshIntervalMinutes": 60,
    "refreshCron": "0 0 * * * ?",
    "lastRefreshBeginTime": 1795132800,
    "lastRefreshEndTime": 1795132800,
    "refreshHistory": [
      {
        "instId": "20261120000000000g1a2b3c4",
        "status": "Success",
        "startTime": 1795132800,
        "endTime": 1795132800
      }
    ],
    "isPartitioned": false,
    "lastModifyTime": 1795132800000,
    "lastDDLTime": 1795132800000,
    "rowCount": 1024
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.