Package com.snowflake.snowpark_java
Class Updatable
- java.lang.Object
-
- com.snowflake.snowpark.internal.Logging
-
- com.snowflake.snowpark_java.DataFrame
-
- com.snowflake.snowpark_java.Updatable
-
- All Implemented Interfaces:
Cloneable
public class Updatable extends DataFrame
Represents a lazily-evaluated Updatable. It extendsDataFrame
so allDataFrame
operations can be applied on it.'''Creating an Updatable'''
You can create an Updatable by calling
Session.table
with the name of the Updatable.- Since:
- 1.1.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UpdatableAsyncActor
async()
Returns an UpdatableAsyncActor object that can be used to execute Updatable actions asynchronously.Updatable
clone()
Returns a clone of this Updatable.DeleteResult
delete()
Deletes all rows in the updatable and returns aDeleteResult
, representing number of rows deleted.DeleteResult
delete(Column condition)
Deletes all rows in the updatable that satisfy specified condition and returns aDeleteResult
, representing number of rows deleted.DeleteResult
delete(Column condition, DataFrame sourceData)
Deletes all rows in the updatable that satisfy specified condition where condition includes columns in otherDataFrame
, and returns aDeleteResult
, representing number of rows deleted.MergeBuilder
merge(DataFrame source, Column joinExpr)
Initiates a merge action for this updatable withDataFrame
source on specified join expression.UpdateResult
update(Map<Column,Column> assignments)
Updates all rows in the Updatable with specified assignments and returns aUpdateResult
, representing number of rows modified and number of multi-joined rows modified.UpdateResult
update(Map<Column,Column> assignments, Column condition)
Updates all rows in the updatable that satisfy specified condition with specified assignments and returns aUpdateResult
, representing number of rows modified and number of multi-joined rows modified.UpdateResult
update(Map<Column,Column> assignments, Column condition, DataFrame sourceData)
Updates all rows in the updatable that satisfy specified condition where condition includes columns in otherDataFrame
, and returns aUpdateResult
, representing number of rows modified and number of multi-joined rows modified.UpdateResult
updateColumn(Map<String,Column> assignments)
Updates all rows in the updatable with specified assignments and returns aUpdateResult
, representing number of rows modified and number of multi-joined rows modified.UpdateResult
updateColumn(Map<String,Column> assignments, Column condition)
Updates all rows in the updatable that satisfy specified condition with specified assignments and returns aUpdateResult
, representing number of rows modified and number of multi-joined rows modified.UpdateResult
updateColumn(Map<String,Column> assignments, Column condition, DataFrame sourceData)
Updates all rows in the updatable that satisfy specified condition where condition includes columns in otherDataFrame
, and returns aUpdateResult
, representing number of rows modified and number of multi-joined rows modified.-
Methods inherited from class com.snowflake.snowpark_java.DataFrame
agg, alias, cacheResult, col, collect, count, createOrReplaceTempView, createOrReplaceTempView, createOrReplaceView, createOrReplaceView, crossJoin, cube, cube, distinct, drop, drop, dropDuplicates, except, explain, filter, first, first, flatten, flatten, groupBy, groupBy, groupByGroupingSets, intersect, join, join, join, join, join, join, join, join, join, join, join, join, limit, na, naturalJoin, naturalJoin, pivot, pivot, randomSplit, rename, rollup, rollup, sample, sample, schema, select, select, show, show, show, sort, stat, toDF, toLocalIterator, union, unionAll, unionAllByName, unionByName, where, withColumn, withColumns, write
-
-
-
-
Method Detail
-
update
public UpdateResult update(Map<Column,Column> assignments)
Updates all rows in the Updatable with specified assignments and returns aUpdateResult
, representing number of rows modified and number of multi-joined rows modified.For example:
Map<Column, Column> assignments = new HashMap<>; assignments.put(Functions.col("col1"), Functions.lit(1); // Assign value 1 to column col1 in all rows in updatable. session.table("tableName").update(assignment);
- Parameters:
assignments
- A map contains the column being updated and the new value.- Returns:
UpdateResult
- Since:
- 1.1.0
-
updateColumn
public UpdateResult updateColumn(Map<String,Column> assignments)
Updates all rows in the updatable with specified assignments and returns aUpdateResult
, representing number of rows modified and number of multi-joined rows modified.For example:
Map<String, Column> assignments = new HashMap<>; assignments.put("col1", Functions.lit(1); // Assign value 1 to column col1 in all rows in updatable. session.table("tableName").updateColumn(assignment);
- Parameters:
assignments
- A map contains the column being updated and the new value.- Returns:
UpdateResult
- Since:
- 1.1.0
-
update
public UpdateResult update(Map<Column,Column> assignments, Column condition)
Updates all rows in the updatable that satisfy specified condition with specified assignments and returns aUpdateResult
, representing number of rows modified and number of multi-joined rows modified.For example:
Map<Column, Column> assignments = new HashMap<>; assignments.put(Functions.col("col1"), Functions.lit(1); // Assign value 1 to column col1 in the rows if col2 is true in updatable. session.table("tableName").updateColumn(assignment, Functions.col("col2").equal_to(Functions.lit(true)));
- Parameters:
assignments
- A map contains the column being updated and the new value.condition
- The condition of the Column being updated.- Returns:
UpdateResult
- Since:
- 1.1.0
-
updateColumn
public UpdateResult updateColumn(Map<String,Column> assignments, Column condition)
Updates all rows in the updatable that satisfy specified condition with specified assignments and returns aUpdateResult
, representing number of rows modified and number of multi-joined rows modified.For example:
Map<String, Column> assignments = new HashMap<>; assignments.put("col1", Functions.lit(1); // Assign value 1 to column col1 in the rows if col3 is true in updatable. session.table("tableName").updateColumn(assignment, Functions.col("col2").equal_to(Functions.lit(true)));
- Parameters:
assignments
- A map contains the column being updated and the new value.condition
- The condition of the Column being updated.- Returns:
UpdateResult
- Since:
- 1.1.0
-
update
public UpdateResult update(Map<Column,Column> assignments, Column condition, DataFrame sourceData)
Updates all rows in the updatable that satisfy specified condition where condition includes columns in otherDataFrame
, and returns aUpdateResult
, representing number of rows modified and number of multi-joined rows modified.For example:
Map<Column, Column> assignments = new HashMap<>; assignments.put(Functions.col("col1"), Functions.lit(1); session.table("tableName").update(assignment, Functions.col("col2").equal_to(df.col("col_a")), df);
- Parameters:
assignments
- A map contains the column being updated and the new value.condition
- The condition of the Column being updated.sourceData
- Another DataFrame being joined.- Returns:
UpdateResult
- Since:
- 1.1.0
-
updateColumn
public UpdateResult updateColumn(Map<String,Column> assignments, Column condition, DataFrame sourceData)
Updates all rows in the updatable that satisfy specified condition where condition includes columns in otherDataFrame
, and returns aUpdateResult
, representing number of rows modified and number of multi-joined rows modified.For example:
Map<String, Column> assignments = new HashMap<>; assignments.put("col1", Functions.lit(1); session.table("tableName").updateColumn(assignment, Functions.col("col2").equal_to(df.col("col_a")), df);
- Parameters:
assignments
- A map contains the column being updated and the new value.condition
- The condition of the Column being updated.sourceData
- Another DataFrame being joined.- Returns:
UpdateResult
- Since:
- 1.1.0
-
delete
public DeleteResult delete()
Deletes all rows in the updatable and returns aDeleteResult
, representing number of rows deleted.- Returns:
DeleteResult
- Since:
- 1.1.0
-
delete
public DeleteResult delete(Column condition)
Deletes all rows in the updatable that satisfy specified condition and returns aDeleteResult
, representing number of rows deleted.For example:
session.table("tableName").delete(Functions.col("col1").equal_to(Functions.lit(1)));
- Parameters:
condition
- The condition expression- Returns:
DeleteResult
- Since:
- 1.1.0
-
delete
public DeleteResult delete(Column condition, DataFrame sourceData)
Deletes all rows in the updatable that satisfy specified condition where condition includes columns in otherDataFrame
, and returns aDeleteResult
, representing number of rows deleted.For example:
session.table(tableName).delete(Functions.col("col1").equal_to(df.col("col2")), df);
- Parameters:
condition
- The condition expressionsourceData
- The source DataFrame- Returns:
DeleteResult
- Since:
- 1.1.0
-
merge
public MergeBuilder merge(DataFrame source, Column joinExpr)
Initiates a merge action for this updatable withDataFrame
source on specified join expression. Returns aMergeBuilder
which provides APIs to define merge clauses.- Parameters:
source
- The source DataFramejoinExpr
- The join expression- Returns:
MergeBuilder
- Since:
- 1.1.0
-
clone
public Updatable clone()
Returns a clone of this Updatable.
-
async
public UpdatableAsyncActor async()
Returns an UpdatableAsyncActor object that can be used to execute Updatable actions asynchronously.
-
-