Class Stage

java.lang.Object
dev.frostlake.metastore.SqlObject
dev.frostlake.metastore.model.Stage
All Implemented Interfaces:
Taggable

public class Stage extends SqlObject
Represents a Snowflake STAGE - a named location for staging data files. Supports local filesystem staging for data loading and unloading operations. S3 stages are simulated using local filesystem paths.
  • Constructor Details

  • Method Details

    • getFileFormatOptions

      public Map<String,String> getFileFormatOptions()
    • getCopyOptions

      public Map<String,String> getCopyOptions()
    • isDirectoryEnabled

      public boolean isDirectoryEnabled()
    • setDirectoryEnabled

      public void setDirectoryEnabled(boolean directoryEnabled)
    • setUrl

      public void setUrl(String url)
      ALTER STAGE … SET URL — repoint the stage and recompute its local directory.
    • setFileFormat

      public void setFileFormat(String fileFormat)
      ALTER STAGE … SET FILE_FORMAT.
    • getType

      public StageType getType()
    • getUrl

      public String getUrl()
    • getFileFormat

      public String getFileFormat()
    • isEncryption

      public boolean isEncryption()
    • getEncryptionType

      public String getEncryptionType()
      The declared ENCRYPTION TYPE (e.g. SNOWFLAKE_SSE), or null for the account default.
    • setEncryptionType

      public void setEncryptionType(String encryptionType)
    • getCreatedAt

      public Instant getCreatedAt()
    • getLocalPath

      public Path getLocalPath()
    • getObjectType

      public String getObjectType()
      Description copied from class: SqlObject
      Get the type of this SQL object (e.g., "TABLE", "VIEW", "DATABASE") Subclasses should override to provide their specific type
      Specified by:
      getObjectType in class SqlObject
      Returns:
      The object type as a string
    • listFiles

      public List<StageFile> listFiles() throws IOException
      List files in the stage
      Throws:
      IOException
    • listFiles

      public List<StageFile> listFiles(String pattern) throws IOException
      List files in the stage with optional pattern
      Throws:
      IOException
    • fileExists

      public boolean fileExists(String fileName)
      Check if a file exists in the stage
    • getFilePath

      public Path getFilePath(String fileName)
      Get full path to a file in the stage
    • putFile

      public void putFile(Path sourceFile) throws IOException
      Put a file into the stage
      Throws:
      IOException
    • getFile

      public void getFile(String fileName, Path destPath) throws IOException
      Get a file from the stage
      Throws:
      IOException
    • removeFile

      public boolean removeFile(String fileName) throws IOException
      Remove a file from the stage
      Throws:
      IOException
    • isS3Simulated

      public boolean isS3Simulated()
      Check if this stage is using S3 simulation
    • getS3Bucket

      public String getS3Bucket()
      Get the S3 bucket name (if this is an S3 stage)
    • getS3Prefix

      public String getS3Prefix()
      Get the S3 prefix/path (if this is an S3 stage)
    • toString

      public String toString()
      Overrides:
      toString in class SqlObject