Initiates the process of creating a materialized view, reserving the view’s name to prevent other views or tables from being created with that name.
For materialized view details and examples, see Materialized Views.
The response contains output parameter view_id, which is used to tag each subsequent operation (projection, union, aggregation, filter, or join) that will compose the view.
Parameters
Name of the table to be created that is the top-level table of the materialized view, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria.
Optional parameters. Allowed keys are:
collection_name – [DEPRECATED–please specify the containing schema for the materialized view as part of input parameter table_name and use
GPUdb.create_schema()to create the schema if non-existent] Name of a schema which is to contain the newly created view. If the schema provided is non-existent, it will be automatically created.execute_as – User name to use to run the refresh job.
build_materialized_view_policy – Sets startup materialized view rebuild scheme. Allowed values are:
always – Rebuild as many materialized views as possible before accepting requests.
lazy – Rebuild the necessary materialized views at start, and load the remainder lazily.
on_demand – Rebuild materialized views as requests use them.
system – Rebuild materialized views using the system-configured default.
The default value is ‘system’.
persist – If true, then the materialized view specified in input parameter table_name will be persisted and will not expire unless a ttl is specified. If false, then the materialized view will be an in-memory table and will expire unless a ttl is specified otherwise. Allowed values are:
true
false
The default value is ‘false’.
enable_mv_input_wrappers – If true, each base table the view reads is accessed through a wrapper view so an in-progress out-of-place update cannot make a record momentarily disappear from the view, and a long refresh does not block updates to the base tables. Overrides the gaia.enable_mv_input_wrappers configuration default when set. Allowed values are:
true
false
The default value is ‘false’.
refresh_span – Sets the future time-offset(in seconds) at which periodic refresh stops.
refresh_stop_time – When refresh_method is periodic, specifies the time at which a periodic refresh is stopped. Value is a datetime string with format ‘YYYY-MM-DD HH:MM:SS’.
refresh_method – Method by which the join can be refreshed when the data in underlying member tables have changed. Allowed values are:
manual – Refresh only occurs when manually requested by calling
GPUdb.alter_table()with an ‘action’ of ‘refresh’.on_query – Refresh any time the view is queried.
on_change – If possible, incrementally refresh (refresh just those records added) whenever an insert, update, delete or refresh of input table is done. A full refresh is done if an incremental refresh is not possible.
periodic – Refresh table periodically at rate specified by refresh_period.
The default value is ‘manual’.
refresh_period – When refresh_method is periodic, specifies the period in seconds at which refresh occurs.
refresh_start_time – When refresh_method is periodic, specifies the first time at which a refresh is to be done. Value is a datetime string with format ‘YYYY-MM-DD HH:MM:SS’.
ttl – Sets the TTL of the table specified in input parameter table_name.
The default value is an empty dict ( ).
Returns
A dict with the following entries–
Value of input parameter table_name.
Value of view_id.
Additional information. Allowed keys are:
qualified_table_name – The fully qualified name of the result table (i.e. including the schema).
The default value is an empty dict ( ).