public class SimpleIngestManager extends Object
Usage of this class delegates all exception and state handling to the developer
Modifier and Type | Class and Description |
---|---|
static class |
SimpleIngestManager.Builder
This Builder allows someone to configure a SimpleIngestManager
prior to instantiating the manager
|
Constructor and Description |
---|
SimpleIngestManager(String account,
String user,
String pipe,
KeyPair keyPair)
Deprecated.
|
SimpleIngestManager(String account,
String user,
String pipe,
KeyPair keyPair,
String schemeName,
String hostName,
int port)
Deprecated.
|
SimpleIngestManager(String account,
String user,
String pipe,
PrivateKey privateKey)
Constructs a SimpleIngestManager for a given user in a specific account
In addition, this also takes takes the target table and source stage
Finally, it also requires a valid private key registered with
Snowflake DB
Note: this method only takes in account parameter and derive the hostname,
i.e.
|
SimpleIngestManager(String account,
String user,
String pipe,
PrivateKey privateKey,
String schemeName,
String hostName,
int port)
Constructs a SimpleIngestManager for a given user in a specific account
In addition, this also takes takes the target table and source stage
Finally, it also requires a valid private key registered with
Snowflake DB
|
Modifier and Type | Method and Description |
---|---|
String |
getAccount()
getAccount - Gives back the name of the account
that this IngestManager is targeting
|
HistoryResponse |
getHistory(UUID requestId)
Pings the service to see the current ingest history for this table
|
HistoryResponse |
getHistory(UUID requestId,
Integer recentSeconds,
String beginMark)
Pings the service to see the current ingest history for this table
|
HistoryRangeResponse |
getHistoryRange(UUID requestId,
String startTimeInclusive,
String endTimeExclusive)
Pings the service to see the current ingest history for this table
|
String |
getPipe()
getPipe - gives back the pipe which we are using
|
String |
getUser()
getUser - gives back the user on behalf of
which this ingest manager is loading
|
IngestResponse |
ingestFile(StagedFileWrapper file,
UUID requestId)
ingestFile - ingest a single file
|
IngestResponse |
ingestFiles(List<StagedFileWrapper> files,
UUID requestId)
ingestFiles - synchronously sends a request to the ingest
service to enqueue these files
|
static List<StagedFileWrapper> |
wrapFilepaths(Set<String> filenames)
wrapFilepaths - convenience method to take a list of filenames and
produce a list of FileWrappers with unset size
|
@Deprecated public SimpleIngestManager(String account, String user, String pipe, KeyPair keyPair)
account
- The account into which we're loading
Note: account should not include region or cloud provider
info. e.g. if host is testaccount.us-east-1.azure
.snowflakecomputing.com, account should be testaccountuser
- the user performing this loadpipe
- the fully qualified name of the pipekeyPair
- the KeyPair we'll use to sign JWT tokenspublic SimpleIngestManager(String account, String user, String pipe, PrivateKey privateKey) throws InvalidKeySpecException, NoSuchAlgorithmException
account
- The account into which we're loading
Note: account should not include region or cloud provider
info. e.g. if host is testaccount.us-east-1.azure
.snowflakecomputing.com, account should be testaccount.
If this is the case, you should use the constructor that
accepts hostname as argumentuser
- the user performing this loadpipe
- the fully qualified name of the pipeprivateKey
- the private key we'll use to sign JWT tokensNoSuchAlgorithmException
- if can't create
key factory by using RSA algorithmInvalidKeySpecException
- if private key or public key is
invalid@Deprecated public SimpleIngestManager(String account, String user, String pipe, KeyPair keyPair, String schemeName, String hostName, int port)
account
- the account into which we're loading
Note: account should not include region or cloud provider
info. e.g. if host is testaccount.us-east-1.azure
.snowflakecomputing.com account should be testaccount
If this is the case, you should use the constructor that
accepts hostname as argumentuser
- the user performing this loadpipe
- the fully qualified name of the pipekeyPair
- the KeyPair we'll use to sign JWT tokensschemeName
- http or httpshostName
- the hostnameport
- the port numberpublic SimpleIngestManager(String account, String user, String pipe, PrivateKey privateKey, String schemeName, String hostName, int port) throws NoSuchAlgorithmException, InvalidKeySpecException
account
- the account into which we're loading
Note: account should not include region or cloud provider
info. e.g. if host is testaccount.us-east-1.azure
.snowflakecomputing.com, account should be testaccountuser
- the user performing this loadpipe
- the fully qualified name of the pipeprivateKey
- the private key we'll use to sign JWT tokensschemeName
- http or httpshostName
- the hostname i.e. testaccount.us-east-1.azure
.snowflakecomputing.comport
- the port numberNoSuchAlgorithmException
- if can't create key factory by using
RSA algorithmInvalidKeySpecException
- if private key or public key is invalidpublic String getAccount()
public String getUser()
public String getPipe()
public static List<StagedFileWrapper> wrapFilepaths(Set<String> filenames)
filenames
- the filenames you want to wrap uppublic IngestResponse ingestFile(StagedFileWrapper file, UUID requestId) throws URISyntaxException, IOException, Exception
file
- - a wrapper around a filename and sizerequestId
- - a requestId that we'll use to label - if null,
we generate one for the userBackOffException
- - if we have a 503 responseIOException
- - if we have some other network failureURISyntaxException
- - if the provided account name was illegal and
caused a URI construction failureException
public IngestResponse ingestFiles(List<StagedFileWrapper> files, UUID requestId) throws URISyntaxException, IOException, IngestResponseException
files
- - list of wrappers around filenames and sizesrequestId
- - a requestId that we'll use to label - if null,
we generate one for the userBackOffException
- - if we have a 503 responseIOException
- - if we have some other network failureIngestResponseException
- - if snowflake encountered
error during ingestURISyntaxException
- - if the provided account name was illegal and
caused a URI construction failurepublic HistoryResponse getHistory(UUID requestId, Integer recentSeconds, String beginMark) throws URISyntaxException, IOException, IngestResponseException
requestId
- a UUID we use to label the request, if null, one is
generated for the userrecentSeconds
- history only for items in the recentSeconds windowbeginMark
- mark from which history should be fetchedBackOffException
- - if we have a 503 responseIOException
- - if we have some other network failureIngestResponseException
- - if snowflake encountered a service errorURISyntaxException
- - if the provided account name was illegal and
caused a URI construction failurepublic HistoryResponse getHistory(UUID requestId) throws URISyntaxException, IOException, IngestResponseException
requestId
- a UUID we use to label the request, if null, one is
generated for the userBackOffException
- - if we have a 503 responseIOException
- - if we have some other network failureIngestResponseException
- -if snowflake encountered a service errorURISyntaxException
- - if the provided account name was illegal
and caused a URI construction failurepublic HistoryRangeResponse getHistoryRange(UUID requestId, String startTimeInclusive, String endTimeExclusive) throws URISyntaxException, IOException, IngestResponseException
requestId
- a UUID we use to label the request, if null, one is
generated for the userstartTimeInclusive
- Start time inclusive of scan range,
in ISO-8601 format. Missing millisecond part in string will lead
to a zero milliseconds. This is a required query parameter, and
a 400 will be returned if this query parameter is missingendTimeExclusive
- End time exclusive of scan range. If this
query parameter is missing or user provided value is later
than current millis, then current millis is used.BackOffException
- - if we have a 503 responseIOException
- - if we have some other network failureIngestResponseException
- -if snowflake encountered a service errorURISyntaxException
- - if the provided account name was illegal
and caused a URI construction failureCopyright © 2020. All rights reserved.