Class FileDescriptor
Measured live: SELECT TO_FILE('@sse/hello.txt') yields exactly
{"CONTENT_TYPE":"text/plain","ETAG":"b7dddf722cfdc51710087d369f8d9e6b",
"LAST_MODIFIED":"Mon, 03 Aug 2026 11:24:13 GMT","RELATIVE_PATH":"hello.txt",
"SIZE":24,"STAGE":"@PROBE135_DB.S.SSE"}
— keys in alphabetical order, SIZE a JSON number, LAST_MODIFIED an RFC-1123 HTTP
date in GMT with a ZERO-PADDED two-digit day (note LIST @stage formats the same instant with
an unpadded day, so the two are not interchangeable), and ETAG the file's MD5 hex — verified
equal to the md5 column of LIST @stage for every staged file on a server-side
encrypted stage.
Frostlake's stages are real local directories, so every one of those fields is read from the
actual file: SIZE from its length, LAST_MODIFIED from its mtime, ETAG from
its MD5, CONTENT_TYPE from its extension (see FileContentTypes). Nothing here is
synthesised from the path text.
The two URL fields are the exception. SCOPED_FILE_URL and STAGE_FILE_URL are
absent from a descriptor TO_FILE builds from a stage path — live, both
FL_GET_STAGE_FILE_URL and FL_GET_SCOPED_FILE_URL return NULL for such a file, even on
a directory-enabled stage. They are plain descriptor FIELDS that only a caller-supplied metadata
object populates (proved by feeding TRY_TO_FILE an object carrying them and reading them
straight back). So the accessors read the field and Frostlake leaves it unset — returning NULL is the
measured behaviour, not a shortfall.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe descriptor'sCONTENT_TYPEfield.static final StringThe descriptor'sETAGfield — the file's MD5 hex.static final StringThe descriptor'sLAST_MODIFIEDfield — an RFC-1123 date string.static final StringThe descriptor'sRELATIVE_PATHfield.static final StringThe descriptor'sSCOPED_FILE_URLfield — only ever caller-supplied.static final StringThe descriptor'sSIZEfield — a number of bytes.static final StringThe descriptor'sSTAGEfield, e.g.static final StringThe descriptor'sSTAGE_FILE_URLfield — only ever caller-supplied. -
Method Summary
Modifier and TypeMethodDescriptionstatic tools.jackson.databind.JsonNodedescriptorNode(Object value) The descriptor as a JSON object node, or null when the value is not one.static StringformatLastModified(Instant instant) Renders an instant the way a descriptor'sLAST_MODIFIEDreads.static VariantValuefromLocation(String location, StageFileLocator locator) Resolve a stage reference and read the real file's metadata.static VariantValuefromMetadataObject(Object value, boolean tryMode) Validate a caller-supplied metadata object, asTO_FILE(OBJECT)does.static StringnotFoundMessage(String location) Snowflake's "Remote file 'x' was not found…" message for the given location.static InstantparseLastModified(String text) Parses a descriptorLAST_MODIFIEDstring, or null when it is not RFC-1123.static StringA descriptor field as text, or null when the value is not a descriptor or the field is unset.
-
Field Details
-
CONTENT_TYPE
The descriptor'sCONTENT_TYPEfield.- See Also:
-
ETAG
The descriptor'sETAGfield — the file's MD5 hex.- See Also:
-
LAST_MODIFIED
The descriptor'sLAST_MODIFIEDfield — an RFC-1123 date string.- See Also:
-
RELATIVE_PATH
The descriptor'sRELATIVE_PATHfield.- See Also:
-
SIZE
The descriptor'sSIZEfield — a number of bytes.- See Also:
-
STAGE
The descriptor'sSTAGEfield, e.g.@DB.SCHEMA.NAME.- See Also:
-
SCOPED_FILE_URL
The descriptor'sSCOPED_FILE_URLfield — only ever caller-supplied.- See Also:
-
STAGE_FILE_URL
The descriptor'sSTAGE_FILE_URLfield — only ever caller-supplied.- See Also:
-
-
Method Details
-
notFoundMessage
Snowflake's "Remote file 'x' was not found…" message for the given location. -
fromLocation
Resolve a stage reference and read the real file's metadata.- Parameters:
location- the stage reference as the caller wrote it (it is echoed in the error)locator- resolves the reference to a file on disk- Returns:
- the descriptor, or null when the file does not exist (the caller decides whether that is
an error, as
TO_FILEdoes, or a NULL, asTRY_TO_FILEdoes)
-
fromMetadataObject
Validate a caller-supplied metadata object, asTO_FILE(OBJECT)does. Unlike the stage-path form this does NOT check that the file exists — live, an object namingx.txton a real stage round-trips even though no such file is there.- Parameters:
value- the object, as an OBJECT/VARIANT runtime valuetryMode- true forTRY_TO_FILE(invalid input yields null instead of an error)- Returns:
- the descriptor, or null when
tryModeand the object is invalid
-
textField
A descriptor field as text, or null when the value is not a descriptor or the field is unset. -
descriptorNode
The descriptor as a JSON object node, or null when the value is not one. -
parseLastModified
Parses a descriptorLAST_MODIFIEDstring, or null when it is not RFC-1123. -
formatLastModified
Renders an instant the way a descriptor'sLAST_MODIFIEDreads.
-