Class AppendOnlyKeyValueTable

  • All Implemented Interfaces:
    AppendOnlyTable

    public class AppendOnlyKeyValueTable
    extends Object
    implements AppendOnlyTable
    Default implementation of AppendOnlyTable, which stores the data as key-value pairs, similarly to the default implementation of KeyValueTable.

    This implementation requires that the backing Snowflake table has the following structure:

    • column key of type STRING
    • column value of type Variant
    • column updated_at of type TIMESTAMP_NTZ
    • Constructor Detail

      • AppendOnlyKeyValueTable

        public AppendOnlyKeyValueTable​(Session session,
                                       String tableName)
        Creates a new AppendOnlyKeyValueTable, backed by the provided Snowflake table.
        Parameters:
        session - Snowpark session object
        tableName - 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 interface AppendOnlyTable
        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 interface AppendOnlyTable
        Parameters:
        key - key associated with the value
        value - 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 interface AppendOnlyTable
        Parameters:
        filter - filter for the table records
        Returns:
        values from records which match the provided filter