Class AppendOnlyKeyValueTable
- java.lang.Object
-
- com.snowflake.connectors.common.table.AppendOnlyKeyValueTable
-
- All Implemented Interfaces:
AppendOnlyTable
public class AppendOnlyKeyValueTable extends Object implements AppendOnlyTable
Default implementation ofAppendOnlyTable
, which stores the data as key-value pairs, similarly to the default implementation ofKeyValueTable
.This implementation requires that the backing Snowflake table has the following structure:
- column
key
of typeSTRING
- column
value
of typeVariant
- column
updated_at
of typeTIMESTAMP_NTZ
-
-
Constructor Summary
Constructors Constructor Description AppendOnlyKeyValueTable(Session session, String tableName)
Creates a newAppendOnlyKeyValueTable
, backed by the provided Snowflake table.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Variant
fetch(String key)
Fetches the most recent value stored under the provided key.List<Variant>
getAllWhere(Column filter)
Returns all values from this table where the record matches the provided filter.void
insert(String key, Variant value)
Inserts the provided value under the provided key into this table.
-
-
-
Constructor Detail
-
AppendOnlyKeyValueTable
public AppendOnlyKeyValueTable(Session session, String tableName)
Creates a newAppendOnlyKeyValueTable
, backed by the provided Snowflake table.- Parameters:
session
- Snowpark session objecttableName
- name of the Snowflake table
-
-
Method Detail
-
fetch
public Variant fetch(String key)
Description copied from interface:AppendOnlyTable
Fetches the most recent value stored under the provided key.- Specified by:
fetch
in interfaceAppendOnlyTable
- Parameters:
key
- key associated with the value- Returns:
- most recent value stored under the provided key
-
insert
public void insert(String key, Variant value)
Description copied from interface:AppendOnlyTable
Inserts the provided value under the provided key into this table.- Specified by:
insert
in interfaceAppendOnlyTable
- Parameters:
key
- key associated with the valuevalue
- value
-
getAllWhere
public List<Variant> getAllWhere(Column filter)
Description copied from interface:AppendOnlyTable
Returns all values from this table where the record matches the provided filter.- Specified by:
getAllWhere
in interfaceAppendOnlyTable
- Parameters:
filter
- filter for the table records- Returns:
- values from records which match the provided filter
-
-