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(String stageLocationType,
String stageLocation,
Map credentials,
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,
String stageRegion)
A callable that can be executed in a separate thread using executor service.
|
List<Object> |
getNextRow() |
Object |
getResultSet() |
static Callable<Void> |
getUploadFileCallable(String stageLocationType,
String stageLocation,
String srcFilePath,
boolean requireCompress,
Map<String,net.snowflake.client.jdbc.SnowflakeFileTransferAgent.FileMetadata> fileMetadataMap,
SnowflakeStorageClient client,
SFSession connection,
String command,
InputStream inputStream,
boolean sourceFromStream,
long sourceDataSize,
int parallel,
File srcFile,
net.snowflake.common.core.RemoteStoreFileEncryptionMaterial encMat,
String stageRegion)
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 |
setOverwrite(boolean overwrite) |
void |
setSourceStream(InputStream sourceStream) |
void |
setSourceStreamSize(long sourceStreamSize) |
public static final String SRC_FILE_NAME_FOR_STREAM
public SnowflakeFileTransferAgent(String command, SFSession connection, SFStatement statement) throws SnowflakeSQLException
SnowflakeSQLExceptionpublic static Callable<Void> getUploadFileCallable(String stageLocationType, String stageLocation, String srcFilePath, boolean requireCompress, Map<String,net.snowflake.client.jdbc.SnowflakeFileTransferAgent.FileMetadata> fileMetadataMap, SnowflakeStorageClient client, SFSession connection, String command, InputStream inputStream, boolean sourceFromStream, long sourceDataSize, int parallel, File srcFile, net.snowflake.common.core.RemoteStoreFileEncryptionMaterial encMat, String stageRegion)
stageLocationType - stage location typestageLocation - stage locationsrcFilePath - source file pathrequireCompress - boolean indicating if requiring compressionfileMetadataMap - map where key is file name and value is metadataclient - client object used to communicate with c3connection - connection objectcommand - command stringinputStream - null if upload source is filesourceFromStream - whether upload source is file or streamsourceDataSize - upload data sizeparallel - number of threads for parallel uploadingsrcFile - source file nameencMat - not null if encryption is requiredstageRegion - region name where stage persistspublic static Callable<Void> getDownloadFileCallable(String stageLocationType, String stageLocation, Map credentials, 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, String stageRegion)
stageLocationType - stage location typestageLocation - stage locationcredentials - credentialssrcFilePath - 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 downloadingstageRegion - region name where the stage persistspublic 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 setSourceStreamSize(long sourceStreamSize)
public void setCompressSourceFromStream(boolean compressSourceFromStream)
public void setOverwrite(boolean overwrite)
Copyright © 2017. All rights reserved.