Package dev.frostlake.metastore
Class SqlObject
java.lang.Object
dev.frostlake.metastore.SqlObject
- All Implemented Interfaces:
Taggable
- Direct Known Subclasses:
AggregationPolicy,ComputePool,Contact,Database,DynamicTable,Function,JoinPolicy,MaskingPolicy,MaterializedView,Pipe,Procedure,ProjectionPolicy,RowAccessPolicy,Schema,Stage,Table,Tag,View
Abstract base class for SQL database objects
Provides common properties and behavior for objects like databases, schemas, tables, views, etc.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanGet the comment associated with this SQL objectGet the creation timestamp of this SQL objectgetName()Get the name of this SQL objectabstract StringGet the type of this SQL object (e.g., "TABLE", "VIEW", "DATABASE") Subclasses should override to provide their specific typegetOwner()Get the owning role of this SQL objectgetTagValue(String tagName) The value of the named tag on this object, ornullif not set.All tag associations on this object (tag name -> value).inthashCode()voidRename this SQL object Note: Subclasses may override to add validation or mark as unsupportedvoidsetComment(String comment) Set or update the comment for this SQL objectvoidRename this object (the catalog/schema map re-keying is the caller's responsibility).voidSet the owning role for this SQL object (stamped with the creating role at CREATE time)voidAssociate (or overwrite) a tag value on this object;tagNameis the canonical upper-cased tag name.toString()voidRemove a tag association from this object (no-op if absent).static StringA stored SQL text without its trailing semicolon, for embedding into a reconstructedCREATE OR REPLACEstatement (GET_DDL, VIEW_DEFINITION, SHOW ... text).
-
Field Details
-
name
-
createdTime
-
comment
-
owner
Owning role; defaults to SYSADMIN until stamped with the creating role at CREATE time.
-
-
Constructor Details
-
SqlObject
Constructor for SQL objects- Parameters:
name- The name of the object (will be stored as-is, normalization is subclass responsibility)
-
SqlObject
Constructor with explicit creation time (for testing or deserialization)- Parameters:
name- The name of the objectcreatedTime- The creation timestamp
-
-
Method Details
-
getName
Get the name of this SQL object- Returns:
- The object name
-
setName
Rename this object (the catalog/schema map re-keying is the caller's responsibility). -
getCreatedTime
Get the creation timestamp of this SQL object- Returns:
- The instant when this object was created
-
getComment
Get the comment associated with this SQL object- Returns:
- The comment, or null if no comment is set
-
setComment
Set or update the comment for this SQL object- Parameters:
comment- The comment text
-
getOwner
Get the owning role of this SQL object- Returns:
- The owner role name (defaults to SYSADMIN)
-
setOwner
Set the owning role for this SQL object (stamped with the creating role at CREATE time)- Parameters:
owner- The owner role name
-
setTag
Description copied from interface:TaggableAssociate (or overwrite) a tag value on this object;tagNameis the canonical upper-cased tag name. -
unsetTag
Description copied from interface:TaggableRemove a tag association from this object (no-op if absent). -
getTagValue
Description copied from interface:TaggableThe value of the named tag on this object, ornullif not set.- Specified by:
getTagValuein interfaceTaggable
-
getTagValues
Description copied from interface:TaggableAll tag associations on this object (tag name -> value). Named getTagValues to avoid clashing with Schema.getTags().- Specified by:
getTagValuesin interfaceTaggable
-
rename
Rename this SQL object Note: Subclasses may override to add validation or mark as unsupported- Parameters:
newName- The new name for the object
-
getObjectType
Get the type of this SQL object (e.g., "TABLE", "VIEW", "DATABASE") Subclasses should override to provide their specific type- Returns:
- The object type as a string
-
withoutTrailingSemicolon
A stored SQL text without its trailing semicolon, for embedding into a reconstructedCREATE OR REPLACEstatement (GET_DDL, VIEW_DEFINITION, SHOW ... text). -
toString
-
equals
-
hashCode
public int hashCode()
-