Package net.snowflake.client.api.loader
Interface Loader
-
- All Superinterfaces:
AutoCloseable
public interface Loader extends AutoCloseable
Bulk loader for Snowflake.This interface extends
AutoCloseable, enabling try-with-resources pattern for automatic resource management:try (Loader loader = LoaderFactory.createLoader(...)) { loader.start(); loader.submitRow(data); loader.finish(); } // Connections closed automatically
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classLoader.ConnectionErrorstatic classLoader.DataError
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Close connections that have been provided upon initialization.voidfinish()Finishes processing and commits or rolls back.LoadResultListenergetListener()voidresetOperation(Operation op)If operation is changed, previous data is committedvoidrollback()Rollback uncommitted changes.voidsetListener(LoadResultListener listener)voidsetProperty(LoaderProperty property, Object value)voidstart()Initiates loading threads.voidsubmitRow(Object[] data)Pass row data
-
-
-
Method Detail
-
setProperty
void setProperty(LoaderProperty property, Object value)
-
setListener
void setListener(LoadResultListener listener)
-
start
void start()
Initiates loading threads. Executes "before" statement
-
submitRow
void submitRow(Object[] data)
Pass row data- Parameters:
data- , must match shape of the table (requested columns, in the order provided)
-
resetOperation
void resetOperation(Operation op)
If operation is changed, previous data is committed- Parameters:
op- operation will be reset
-
rollback
void rollback()
Rollback uncommitted changes. If no transaction was initialized, indeterminate fraction of rows could have been committed.
-
finish
void finish() throws ExceptionFinishes processing and commits or rolls back. Will throw the exception that was the cause of an abort- Throws:
Exception- if that was the cause of an abort
-
close
void close() throws ExceptionClose connections that have been provided upon initialization.This method is called automatically when using try-with-resources. It is safe to call this method multiple times.
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception- if an error occurs while closing resources
-
getListener
LoadResultListener getListener()
-
-