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.S3Location |
extractBucketNameAndPath(String stageLocation)
A small helper for extracting bucket name and path from stage location.
|
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,
SnowflakeS3Client s3Client,
SFSession connection,
String command,
int parallel,
net.snowflake.common.core.S3FileEncryptionMaterial encMat,
String stageRegion)
A callable that can be executed in a separate thread using exeuctor service.
|
List<net.snowflake.common.core.S3FileEncryptionMaterial> |
getEncryptionMaterial() |
List<Object> |
getNextRow() |
Object |
getResultSet() |
Map<String,net.snowflake.common.core.S3FileEncryptionMaterial> |
getSrcToMaterialsMap() |
Map |
getStageCredentials() |
String |
getStageLocation() |
static Callable<Void> |
getUploadFileCallable(String stageLocationType,
String stageLocation,
String srcFilePath,
boolean requireCompress,
Map<String,net.snowflake.client.jdbc.SnowflakeFileTransferAgent.FileMetadata> fileMetadataMap,
SnowflakeS3Client s3Client,
SFSession connection,
String command,
InputStream inputStream,
boolean sourceFromStream,
long sourceDataSize,
int parallel,
File srcFile,
net.snowflake.common.core.S3FileEncryptionMaterial encMat,
String stageRegion)
A callable that can be executed in a separate thread using exeuctor service.
|
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 Map getStageCredentials()
public List<net.snowflake.common.core.S3FileEncryptionMaterial> getEncryptionMaterial()
public Map<String,net.snowflake.common.core.S3FileEncryptionMaterial> getSrcToMaterialsMap()
public String getStageLocation()
public static Callable<Void> getUploadFileCallable(String stageLocationType, String stageLocation, String srcFilePath, boolean requireCompress, Map<String,net.snowflake.client.jdbc.SnowflakeFileTransferAgent.FileMetadata> fileMetadataMap, SnowflakeS3Client s3Client, SFSession connection, String command, InputStream inputStream, boolean sourceFromStream, long sourceDataSize, int parallel, File srcFile, net.snowflake.common.core.S3FileEncryptionMaterial 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 metadatas3Client - 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, SnowflakeS3Client s3Client, SFSession connection, String command, int parallel, net.snowflake.common.core.S3FileEncryptionMaterial encMat, String stageRegion)
stageLocationType - stage location typestageLocation - stage locationcredentials - credentialssrcFilePath - path that stores the downloaded filelocalLocation - local locationfileMetadataMap - file metadata maps3Client - s3 clientconnection - connection objectcommand - command stringencMat - s3 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 net.snowflake.client.jdbc.SnowflakeFileTransferAgent.S3Location extractBucketNameAndPath(String stageLocation)
stageLocation - 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.