Package dev.frostlake.metastore.model
Class View
java.lang.Object
dev.frostlake.metastore.SqlObject
dev.frostlake.metastore.model.View
- All Implemented Interfaces:
Taggable
-
Field Summary
Fields inherited from class dev.frostlake.metastore.SqlObject
comment, createdTime, name, owner -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()A full-fidelity duplicate for CLONE DATABASE/SCHEMA: keeps the explicit column list, the SECURE flag, the comment and any attached row access policy (the name-and-definition constructor alone silently dropped all of these from clones).The view's fullCREATE OR REPLACEstatement rendered againstdisplayName(bare for GET_DDL's default output, schema-qualified for the metadata views).Get the type of this SQL object (e.g., "TABLE", "VIEW", "DATABASE") Subclasses should override to provide their specific typeThe view's columns — name and declared type — as its defining query resolved to at CREATE time, or null when they could not be resolved (a body that would not plan, or a snapshot predating capture).booleanbooleanbooleanbooleanisSecure()booleanA TEMPORARY (TEMP / VOLATILE) view lives only as long as the session that created it, the same lifetime Frostlake gives a temporary table.voidsetOriginalDdl(String originalDdl) voidsetResolvedColumns(List<TableColumn> resolvedColumns) voidsetRowAccessPolicyColumns(List<String> cols) voidsetRowAccessPolicyName(String name) voidsetSecure(boolean secure) voidsetTemporary(boolean temporary) Methods inherited from class dev.frostlake.metastore.SqlObject
equals, getComment, getCreatedTime, getName, getOwner, getTagValue, getTagValues, hashCode, rename, setComment, setName, setOwner, setTag, toString, unsetTag, withoutTrailingSemicolon
-
Constructor Details
-
View
-
View
-
-
Method Details
-
getDefinition
-
getOriginalDdl
-
setOriginalDdl
-
getColumnNames
-
hasExplicitColumnNames
public boolean hasExplicitColumnNames() -
getResolvedColumns
The view's columns — name and declared type — as its defining query resolved to at CREATE time, or null when they could not be resolved (a body that would not plan, or a snapshot predating capture). This is whatINFORMATION_SCHEMA.COLUMNSreports for the view, and through it whatDatabaseMetaData.getColumnsanswers.Resolved ONCE, at creation, and never recomputed — which is Snowflake's own behavior, verified live on a real account. There, a view's reported column metadata is a snapshot taken when the view is created and is entirely independent of the tables underneath it afterwards:
ALTER TABLE t ALTER COLUMN c SET DATA TYPE VARCHAR(50)leaves every view overcstill reportingVARCHAR(10);ALTER TABLE t ADD COLUMNdoes not widen aSELECT *view — the star was expanded once, at creation;ALTER TABLE t ALTER COLUMN c DROP NOT NULLleaves the view still reportingIS_NULLABLE = NO;- dropping the column a view projects — or the whole base table — leaves the view reporting its columns unchanged, even though selecting from it then fails to compile.
Freezing at creation is also what keeps a metadata read from ever planning a query:
INFORMATION_SCHEMAis itself served by these views, so resolving a view body while answering a metadata call could re-enter the metadata layer. Nothing here can. -
setResolvedColumns
-
hasResolvedColumns
public boolean hasResolvedColumns() -
isSecure
public boolean isSecure() -
setSecure
public void setSecure(boolean secure) -
isTemporary
public boolean isTemporary()A TEMPORARY (TEMP / VOLATILE) view lives only as long as the session that created it, the same lifetime Frostlake gives a temporary table. Live also makes it invisible to other sessions and lets it shadow a permanent object of the same name; Frostlake has one namespace per catalog, so it models the lifetime and not the isolation. -
setTemporary
public void setTemporary(boolean temporary) -
getRowAccessPolicyName
-
setRowAccessPolicyName
-
getRowAccessPolicyColumns
-
setRowAccessPolicyColumns
-
hasRowAccessPolicy
public boolean hasRowAccessPolicy() -
copy
A full-fidelity duplicate for CLONE DATABASE/SCHEMA: keeps the explicit column list, the SECURE flag, the comment and any attached row access policy (the name-and-definition constructor alone silently dropped all of these from clones). -
ddl
The view's fullCREATE OR REPLACEstatement rendered againstdisplayName(bare for GET_DDL's default output, schema-qualified for the metadata views). Snowflake surfaces a view's executable DDL — not just its query — inINFORMATION_SCHEMA.VIEWS.VIEW_DEFINITIONand in SHOW VIEWS'textcolumn; deployment tooling relies onEXECUTE IMMEDIATEof that text to recreate views. -
getObjectType
Description copied from class:SqlObjectGet the type of this SQL object (e.g., "TABLE", "VIEW", "DATABASE") Subclasses should override to provide their specific type- Specified by:
getObjectTypein classSqlObject- Returns:
- The object type as a string
-