To ensure valid results with analytical views, perform the following tasks.
Check the state of an analytical view by running the following command:
show analytical views;
If the state of the views is either STALE
or UNUSABLE
,
refresh the analytical views. There are several options, depending on your business
requirements:
If the state of the analytical view is INVALID
, recreate the analytical
view after correcting its definition.
Here is an example of this command:
create analytical view analytical-view-name
stored as parquet
as (select count(*), platform, sdk_version
from base-table-name
group by platform, sdk_version);
The following command refreshes all analytical views, across all databases:
refresh all analytical views;
To refresh all analytical views in a specific database, use the following commands:
use database-name;
refresh analytical views like '*';
Note that using the wildcard, *, matches everything. Don't forget the single quotes.
The following command refreshes a specific analytical view in the current database:
refresh analytical view analytical-view-name;
Alternatively, this command refreshes an analytical in a specific database, while connected to any database:
refresh analytical view database-name.analytical-view-name;
The following commands use a specific database to refresh analytical views that match the
string_value
parameter.
use database-name;
refresh analytical views like 'string_value';
The string_value
parameter can match a number of file-naming protocols:
'event
', 'my-custom-av-prefix
',
'cyber-crime-diagnostics-and-prevention
', and so on. Don't
forget the single quotes.