public class SimpleIngestManager extends Object implements AutoCloseable
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
|
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
|
SimpleIngestManager(String account,
String user,
String pipe,
PrivateKey privateKey,
String schemeName,
String hostName,
int port,
String userAgentSuffix) |
SimpleIngestManager(String account,
String user,
String pipe,
String hostName,
KeyPair keyPair,
String userAgentSuffix)
Using this constructor for Builder pattern.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the resources associated with this object.
|
ConfigureClientResponse |
configureClient(UUID requestId)
Register a snowpipe client and returns the client sequencer
|
String |
getAccount()
getAccount - Gives back the name of the account that this IngestManager is targeting
|
ClientStatusResponse |
getClientStatus(UUID requestId)
Get client status for snowpipe which contains offset token and client sequencer
|
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
|
RequestBuilder |
getRequestBuilder() |
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 |
ingestFile(StagedFileWrapper file,
UUID requestId,
boolean showSkippedFiles)
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
|
IngestResponse |
ingestFiles(List<StagedFileWrapper> files,
UUID requestId,
boolean showSkippedFiles)
ingestFiles - synchronously sends a request to the ingest service to enqueue these files
|
IngestResponse |
ingestFiles(List<StagedFileWrapper> files,
UUID requestId,
boolean showSkippedFiles,
InsertFilesClientInfo clientInfo)
ingestFiles With Client Info - synchronously sends a request to the ingest service to enqueue
these files along with clientSequencer and offSetToken.
|
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)
This method is deprecated, please use the constructor that only requires PrivateKey instead of 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 tokens@Deprecated public SimpleIngestManager(String account, String user, String pipe, KeyPair keyPair, String schemeName, String hostName, int port)
This method is deprecated, please use the constructor that only requires PrivateKey instead of 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 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) throws InvalidKeySpecException, NoSuchAlgorithmException
Note: this method only takes in account parameter and derive the hostname, i.e. testaccount.snowfakecomputing.com. If your deployment is not aws us-west, please use the constructor that accept hostname as argument
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 invalidpublic SimpleIngestManager(String account, String user, String pipe, String hostName, KeyPair keyPair, String userAgentSuffix)
Utils.createKeyPairFromPrivateKey(PrivateKey) publicaccount - 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 pipehostName - the hostnamekeyPair - keyPair associated with the private key used for authentication. See @see Utils.createKeyPairFromPrivateKey(java.security.PrivateKey) to generate KP from p8KeyuserAgentSuffix - user agent suffix we want to add.public 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 SimpleIngestManager(String account, String user, String pipe, PrivateKey privateKey, String schemeName, String hostName, int port, String userAgentSuffix) throws NoSuchAlgorithmException, InvalidKeySpecException
public 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, IngestResponseException, BackOffException
file - - a wrapper around a filename and sizerequestId - - a requestId that we'll use to label - if null, we generate one for the userURISyntaxException - - if the provided account name was illegal and caused a URI
construction failureIOException - - if we have some other network failureIngestResponseException - - if snowflake encountered error during ingestBackOffException - - if we have a 503 responsepublic IngestResponse ingestFile(StagedFileWrapper file, UUID requestId, boolean showSkippedFiles) throws URISyntaxException, IOException, IngestResponseException, BackOffException
file - - a wrapper around a filename and sizerequestId - - a requestId that we'll use to label - if null, we generate one for the usershowSkippedFiles - - a flag which returns the files that were skipped when set to true.URISyntaxException - - if the provided account name was illegal and caused a URI
construction failureIOException - - if we have some other network failureIngestResponseException - - if snowflake encountered error during ingestBackOffException - - if we have a 503 responsepublic IngestResponse ingestFiles(List<StagedFileWrapper> files, UUID requestId) throws URISyntaxException, IOException, IngestResponseException, BackOffException
files - - list of wrappers around filenames and sizesrequestId - - a requestId that we'll use to label - if null, we generate one for the userURISyntaxException - - if the provided account name was illegal and caused a URI
construction failureIOException - - if we have some other network failureIngestResponseException - - if snowflake encountered error during ingestBackOffException - - if we have a 503 responsepublic IngestResponse ingestFiles(List<StagedFileWrapper> files, UUID requestId, boolean showSkippedFiles) throws URISyntaxException, IOException, IngestResponseException, BackOffException
files - - list of wrappers around filenames and sizesrequestId - - a requestId that we'll use to label - if null, we generate one for the usershowSkippedFiles - - a flag which returns the files that were skipped when set to true.URISyntaxException - - if the provided account name was illegal and caused a URI
construction failureIOException - - if we have some other network failureIngestResponseException - - if snowflake encountered error during ingestBackOffException - - if we have a 503 responsepublic IngestResponse ingestFiles(List<StagedFileWrapper> files, UUID requestId, boolean showSkippedFiles, InsertFilesClientInfo clientInfo) throws URISyntaxException, IOException, IngestResponseException, BackOffException
OffsetToken will be atomically persisted on server(Snowflake) side along with files if the clientSequencer added in this request matches with what Snowflake currently has.
If clientSequencers doesnt match, 400 response code is sent back and no files will be added.
files - - list of wrappers around filenames and sizesrequestId - - a requestId that we'll use to label - if null, we generate one for the usershowSkippedFiles - - a flag which returns the files that were skipped when set to true.clientInfo - - clientSequencer and offsetToken to pass along with files. Can be null.URISyntaxException - - if the provided account name was illegal and caused a URI
construction failureIOException - - if we have some other network failureIngestResponseException - - if snowflake encountered error during ingestBackOffException - - if we have a 503 responsepublic HistoryResponse getHistory(UUID requestId, Integer recentSeconds, String beginMark) throws URISyntaxException, IOException, IngestResponseException, BackOffException
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 fetchedURISyntaxException - - if the provided account name was illegal and caused a URI
construction failureIOException - - if we have some other network failureIngestResponseException - - if snowflake encountered error during ingestBackOffException - - if we have a 503 responsepublic HistoryRangeResponse getHistoryRange(UUID requestId, String startTimeInclusive, String endTimeExclusive) throws URISyntaxException, IOException, IngestResponseException, BackOffException
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.URISyntaxException - if the provided account name was illegal and caused a URI
construction failureIOException - - if we have some other network failureIngestResponseException - - if snowflake encountered error during ingestBackOffException - if we have a 503 responsepublic ConfigureClientResponse configureClient(UUID requestId) throws URISyntaxException, IOException, IngestResponseException, BackOffException
requestId - a UUID we use to label the request, if null, one is generated for the userURISyntaxException - - if the provided account name was illegal and caused a URI
construction failureIOException - - if we have some other network failureIngestResponseException - - if snowflake encountered error during ingestBackOffException - - if we have a 503 responsepublic ClientStatusResponse getClientStatus(UUID requestId) throws URISyntaxException, IOException, IngestResponseException, BackOffException
requestId - a UUID we use to label the request, if null, one is generated for the userURISyntaxException - - if the provided account name was illegal and caused a URI
construction failureIOException - - if we have some other network failureIngestResponseException - - if snowflake encountered error during ingestBackOffException - - if we have a 503 responsepublic void close()
SimpleIngestManager to reopen and start ingesting/monitoring new
data.close in interface AutoCloseablepublic RequestBuilder getRequestBuilder()
Copyright © 2022. All rights reserved.