public class Updatable extends DataFrame
DataFrame so all DataFrame
operations can be applied on it.
'''Creating an Updatable'''
You can create an Updatable by calling Session.table with the name of the Updatable.
| Modifier and Type | Method and 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 a
DeleteResult, representing number of
rows deleted. |
DeleteResult |
delete(Column condition)
Deletes all rows in the updatable that satisfy specified condition and returns a
DeleteResult, 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 other
DataFrame, and returns a DeleteResult, representing number of
rows deleted. |
MergeBuilder |
merge(DataFrame source,
Column joinExpr)
Initiates a merge action for this updatable with
DataFrame source on specified join
expression. |
UpdateResult |
update(Map<Column,Column> assignments)
Updates all rows in the Updatable with specified assignments and returns a
UpdateResult, 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 a
UpdateResult, 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 other
DataFrame, and returns a UpdateResult, 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 a
UpdateResult, 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 a
UpdateResult, 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 other
DataFrame, and returns a UpdateResult, representing number of
rows modified and number of multi-joined rows modified. |
agg, 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, 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, writepublic UpdateResult update(Map<Column,Column> assignments)
UpdateResult, 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);
assignments - A map contains the column being updated and the new value.UpdateResultpublic UpdateResult updateColumn(Map<String,Column> assignments)
UpdateResult, 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);
assignments - A map contains the column being updated and the new value.UpdateResultpublic UpdateResult update(Map<Column,Column> assignments, Column condition)
UpdateResult, 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)));
assignments - A map contains the column being updated and the new value.condition - The condition of the Column being updated.UpdateResultpublic UpdateResult updateColumn(Map<String,Column> assignments, Column condition)
UpdateResult, 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)));
assignments - A map contains the column being updated and the new value.condition - The condition of the Column being updated.UpdateResultpublic UpdateResult update(Map<Column,Column> assignments, Column condition, DataFrame sourceData)
DataFrame, and returns a UpdateResult, 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);
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.UpdateResultpublic UpdateResult updateColumn(Map<String,Column> assignments, Column condition, DataFrame sourceData)
DataFrame, and returns a UpdateResult, 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);
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.UpdateResultpublic DeleteResult delete()
DeleteResult, representing number of
rows deleted.DeleteResultpublic DeleteResult delete(Column condition)
DeleteResult, representing number of rows deleted.
For example:
session.table("tableName").delete(Functions.col("col1").equal_to(Functions.lit(1)));
condition - The condition expressionDeleteResultpublic DeleteResult delete(Column condition, DataFrame sourceData)
DataFrame, and returns a DeleteResult, representing number of
rows deleted.
For example:
session.table(tableName).delete(Functions.col("col1").equal_to(df.col("col2")), df);
condition - The condition expressionsourceData - The source DataFrameDeleteResultpublic MergeBuilder merge(DataFrame source, Column joinExpr)
DataFrame source on specified join
expression. Returns a MergeBuilder which provides APIs to define merge clauses.source - The source DataFramejoinExpr - The join expressionMergeBuilderpublic Updatable clone()
public UpdatableAsyncActor async()
© 2023 Snowflake Inc. All Rights Reserved