public class SnowflakeFileTransferAgent extends Object implements SnowflakeFixedView
| Modifier and Type | Class and Description |
|---|---|
static class |
SnowflakeFileTransferAgent.CommandType |
class |
SnowflakeFileTransferAgent.DownloadCommandEncryptionFacade |
class |
SnowflakeFileTransferAgent.DownloadCommandFacade
A class for encapsulating the columns to return for the download command
|
static class |
SnowflakeFileTransferAgent.FileCompressionType |
static class |
SnowflakeFileTransferAgent.ResultStatus
Result status enum
|
static class |
SnowflakeFileTransferAgent.UploadColumns
A class for encapsulating the columns to return for the upload command
|
class |
SnowflakeFileTransferAgent.UploadCommandEncryptionFacade |
class |
SnowflakeFileTransferAgent.UploadCommandFacade |
| Modifier and Type | Field and Description |
|---|---|
static String |
SRC_FILE_NAME_FOR_STREAM |
| Constructor and Description |
|---|
SnowflakeFileTransferAgent(String command,
SFSession connection,
SFStatement statement) |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel() |
List<SnowflakeColumnMetadata> |
describeColumns()
Describe the metadata of a fixed view.
|
boolean |
execute() |
static Set<String> |
expandFileNames(String[] filePathList)
process a list of file paths separated by "," and expand the wildcards
if any to generate the list of paths for all files matched by the
wildcards
|
static net.snowflake.client.jdbc.SnowflakeFileTransferAgent.remoteLocation |
extractLocationAndPath(String stageLocationPath)
A small helper for extracting location name and path from full location path
|
SnowflakeFileTransferAgent.CommandType |
getCommandType() |
static Callable<Void> |
getDownloadFileCallable(StageInfo stage,
String srcFilePath,
String localLocation,
Map<String,net.snowflake.client.jdbc.SnowflakeFileTransferAgent.FileMetadata> fileMetadataMap,
SnowflakeStorageClient client,
SFSession connection,
String command,
int parallel,
net.snowflake.common.core.RemoteStoreFileEncryptionMaterial encMat)
A callable that can be executed in a separate thread using executor service.
|
List<net.snowflake.common.core.RemoteStoreFileEncryptionMaterial> |
getEncryptionMaterial() |
List<Object> |
getNextRow() |
Object |
getResultSet() |
Map<String,net.snowflake.common.core.RemoteStoreFileEncryptionMaterial> |
getSrcToMaterialsMap() |
Map |
getStageCredentials() |
StageInfo |
getStageInfo() |
String |
getStageLocation() |
int |
getTotalRows() |
static Callable<Void> |
getUploadFileCallable(StageInfo stage,
String srcFilePath,
net.snowflake.client.jdbc.SnowflakeFileTransferAgent.FileMetadata metadata,
SnowflakeStorageClient client,
SFSession connection,
String command,
InputStream inputStream,
boolean sourceFromStream,
int parallel,
File srcFile,
net.snowflake.common.core.RemoteStoreFileEncryptionMaterial encMat)
A callable that can be executed in a separate thread using exeuctor service.
|
static void |
renewExpiredToken(SFSession connection,
String command,
SnowflakeStorageClient client)
This static method is called when we are handling an expired token exception
It retrieves a fresh token from GS and then calls .renew() on the storage
client to refresh itself with the new token
|
void |
setCompressSourceFromStream(boolean compressSourceFromStream) |
void |
setDestFileNameForStreamSource(String destFileNameForStreamSource) |
void |
setSourceStream(InputStream sourceStream) |
static void |
throwJCEMissingError(String operation,
Exception ex) |
public static final String SRC_FILE_NAME_FOR_STREAM
public SnowflakeFileTransferAgent(String command, SFSession connection, SFStatement statement) throws SnowflakeSQLException
SnowflakeSQLExceptionpublic StageInfo getStageInfo()
public Map getStageCredentials()
public List<net.snowflake.common.core.RemoteStoreFileEncryptionMaterial> getEncryptionMaterial()
public Map<String,net.snowflake.common.core.RemoteStoreFileEncryptionMaterial> getSrcToMaterialsMap()
public String getStageLocation()
public static Callable<Void> getUploadFileCallable(StageInfo stage, String srcFilePath, net.snowflake.client.jdbc.SnowflakeFileTransferAgent.FileMetadata metadata, SnowflakeStorageClient client, SFSession connection, String command, InputStream inputStream, boolean sourceFromStream, int parallel, File srcFile, net.snowflake.common.core.RemoteStoreFileEncryptionMaterial encMat)
The callable does compression if needed and upload the result to the table's staging area.
stage - information about the stagesrcFilePath - source file pathmetadata - file metadataclient - client object used to communicate with c3connection - connection objectcommand - command stringinputStream - null if upload source is filesourceFromStream - whether upload source is file or streamparallel - number of threads for parallel uploadingsrcFile - source file nameencMat - not null if encryption is requiredpublic static Callable<Void> getDownloadFileCallable(StageInfo stage, String srcFilePath, String localLocation, Map<String,net.snowflake.client.jdbc.SnowflakeFileTransferAgent.FileMetadata> fileMetadataMap, SnowflakeStorageClient client, SFSession connection, String command, int parallel, net.snowflake.common.core.RemoteStoreFileEncryptionMaterial encMat)
The callable download files from a stage location to a local location
stage - stage informationsrcFilePath - path that stores the downloaded filelocalLocation - local locationfileMetadataMap - file metadata mapclient - remote store clientconnection - connection objectcommand - command stringencMat - remote store encryption materialparallel - number of parallel threads for downloadingpublic boolean execute()
throws SQLException
SQLExceptionpublic void cancel()
public static Set<String> expandFileNames(String[] filePathList) throws SnowflakeSQLException
filePathList - file path listSnowflakeSQLException - if cannot find the filepublic static void renewExpiredToken(SFSession connection, String command, SnowflakeStorageClient client) throws SnowflakeSQLException
connection - a connection objectcommand - a command to be retriedclient - a Snowflake Storage client objectSnowflakeSQLException - if any error occurspublic static net.snowflake.client.jdbc.SnowflakeFileTransferAgent.remoteLocation extractLocationAndPath(String stageLocationPath)
stageLocationPath - stage locationpublic List<SnowflakeColumnMetadata> describeColumns() throws Exception
describeColumns in interface SnowflakeFixedViewException - failed to construct listpublic List<Object> getNextRow() throws Exception
getNextRow in interface SnowflakeFixedViewExceptionpublic Object getResultSet() throws SnowflakeSQLException
SnowflakeSQLExceptionpublic SnowflakeFileTransferAgent.CommandType getCommandType()
public void setSourceStream(InputStream sourceStream)
public void setDestFileNameForStreamSource(String destFileNameForStreamSource)
public void setCompressSourceFromStream(boolean compressSourceFromStream)
public static void throwJCEMissingError(String operation, Exception ex) throws SnowflakeSQLException
SnowflakeSQLExceptionpublic int getTotalRows()
getTotalRows in interface SnowflakeFixedViewCopyright © 2019. All rights reserved.