Skip to content

Commit 3ba63e5

Browse files
committed
AUTO: Sync ScalarDB docs in English to docs site repo
1 parent 98b4004 commit 3ba63e5

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

docs/api-guide.mdx

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,84 @@ Scan scanUsingSpecifiedNamespace =
11501150
.build();
11511151
```
11521152

1153+
##### Operation attributes
1154+
1155+
The operation attribute is a key-value pair that can be used to store additional information about an operation. You can set operation attributes by using the `attribute()` or `attributes()` method in the operation builder, as shown below:
1156+
1157+
```java
1158+
// Set operation attributes in the `Get` operation.
1159+
Get get = Get.newBuilder()
1160+
.namespace("ns")
1161+
.table("tbl")
1162+
.partitionKey(partitionKey)
1163+
.clusteringKey(clusteringKey)
1164+
.attribute("attribute1", "value1")
1165+
.attributes(ImmutableMap.of("attribute2", "value2", "attribute3", "value3"))
1166+
.build();
1167+
1168+
// Set operation attributes in the `Scan` operation.
1169+
Scan scan = Scan.newBuilder()
1170+
.namespace("ns")
1171+
.table("tbl")
1172+
.partitionKey(partitionKey)
1173+
.projections("c1", "c2", "c3", "c4")
1174+
.attribute("attribute1", "value1")
1175+
.attributes(ImmutableMap.of("attribute2", "value2", "attribute3", "value3"))
1176+
.build();
1177+
1178+
// Set operation attributes in the `Insert` operation.
1179+
Insert insert = Insert.newBuilder()
1180+
.namespace("ns")
1181+
.table("tbl")
1182+
.partitionKey(partitionKey)
1183+
.clusteringKey(clusteringKey)
1184+
.floatValue("c4", 1.23F)
1185+
.doubleValue("c5", 4.56)
1186+
.attribute("attribute1", "value1")
1187+
.attributes(ImmutableMap.of("attribute2", "value2", "attribute3", "value3"))
1188+
.build();
1189+
1190+
// Set operation attributes in the `Upsert` operation.
1191+
Upsert upsert = Upsert.newBuilder()
1192+
.namespace("ns")
1193+
.table("tbl")
1194+
.partitionKey(partitionKey)
1195+
.clusteringKey(clusteringKey)
1196+
.floatValue("c4", 1.23F)
1197+
.doubleValue("c5", 4.56)
1198+
.attribute("attribute1", "value1")
1199+
.attributes(ImmutableMap.of("attribute2", "value2", "attribute3", "value3"))
1200+
.build();
1201+
1202+
// Set operation attributes in the `Update` operation.
1203+
Update update = Update.newBuilder()
1204+
.namespace("ns")
1205+
.table("tbl")
1206+
.partitionKey(partitionKey)
1207+
.clusteringKey(clusteringKey)
1208+
.floatValue("c4", 1.23F)
1209+
.doubleValue("c5", 4.56)
1210+
.attribute("attribute1", "value1")
1211+
.attributes(ImmutableMap.of("attribute2", "value2", "attribute3", "value3"))
1212+
.build();
1213+
1214+
// Set operation attributes in the `Delete` operation.
1215+
Delete delete = Delete.newBuilder()
1216+
.namespace("ns")
1217+
.table("tbl")
1218+
.partitionKey(partitionKey)
1219+
.clusteringKey(clusteringKey)
1220+
.attribute("attribute1", "value1")
1221+
.attributes(ImmutableMap.of("attribute2", "value2", "attribute3", "value3"))
1222+
.build();
1223+
```
1224+
1225+
:::note
1226+
1227+
ScalarDB currently has no available operation attributes.
1228+
1229+
:::
1230+
11531231
#### Commit a transaction
11541232

11551233
After executing CRUD operations, you need to commit a transaction to finish it.

docs/scalardb-sql/grammar.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@ SELECT projection [, projection] ...
604604
[WHERE and_predicates [OR and_predicates ...] | or_predicates [AND or_predicates ...]]
605605
[ORDER BY identifier [order] [, identifier [order]] ...]
606606
[LIMIT <limit>]
607+
[WITH operation_attributes]
607608

608609
projection: * | identifier [AS <alias>]
609610
join_specification: [INNER] JOIN [<namespace name>.]<table name> [AS <alias>] ON join_predicate [AND join_predicate] ... | {LEFT|RIGHT} [OUTER] JOIN [<namespace name>.]<table name> [AS <alias>] ON join_predicate [AND join_predicate] ...
@@ -614,6 +615,7 @@ predicate: identifier operator <literal> | identifier BETWEEN <literal> AND <lit
614615
identifier: [[<namespace name>.]<table name>.]<column name> | [alias.]<column name>
615616
operator: = | <> | != | > | >= | < | <=
616617
order: ASC | DESC
618+
operation_attributes: <operation attribute name>=<operation attribute value> [AND <operation attribute name>=<operation attribute value>] ...
617619
```
618620

619621
##### Note
@@ -1084,6 +1086,9 @@ This command returns the following column:
10841086
```sql
10851087
INSERT INTO [<namespace name>.]<table name> [(<column name> [, <column name>] ...)]
10861088
VALUES (<literal> [, <literal>] ...) [, (<literal> [, <literal>] ...)] ...
1089+
[WITH operation_attributes]
1090+
1091+
operation_attributes: <operation attribute name>=<operation attribute value> [AND <operation attribute name>=<operation attribute value>] ...
10871092
```
10881093

10891094
- You must specify a full primary key in `INSERT`.
@@ -1154,6 +1159,9 @@ This command returns the following column:
11541159
```sql
11551160
UPSERT INTO [<namespace name>.]<table name> [(<column name> [, <column name>] ...)]
11561161
VALUES (<literal> [, <literal>] ...) [, (<literal> [, <literal>] ...)] ...
1162+
[WITH operation_attributes]
1163+
1164+
operation_attributes: <operation attribute name>=<operation attribute value> [AND <operation attribute name>=<operation attribute value>] ...
11571165
```
11581166

11591167
- You must specify a full primary key in `UPSERT`.
@@ -1233,12 +1241,14 @@ This command returns the following column:
12331241
UPDATE [<namespace name>.]<table name> [AS <alias>]
12341242
SET <column identifier> = <literal> [, <column identifier> = <literal>] ...
12351243
[WHERE and_predicates [OR and_predicates ...] | or_predicates [AND or_predicates ...]]
1244+
[WITH operation_attributes]
12361245

12371246
identifier: [[<namespace name>.]<table name>.]<column name> | [alias.]<column name>
12381247
and_predicates: predicate | (predicate [AND predicate ...])
12391248
or_predicates: predicate | (predicate [OR predicate ...])
12401249
predicate: <identifier> operator <literal> | <identifier> BETWEEN <literal> AND <literal> | <identifier> [NOT] LIKE <pattern> [ESCAPE <escape character>] | <identifier> IS [NOT] NULL
12411250
operator: = | <> | != | > | >= | < | <=
1251+
operation_attributes: <operation attribute name>=<operation attribute value> [AND <operation attribute name>=<operation attribute value>] ...
12421252
```
12431253

12441254
##### Note
@@ -1460,12 +1470,14 @@ This command returns the following column:
14601470
```sql
14611471
DELETE FROM [<namespace name>.]<table name> [AS <alias>]
14621472
[WHERE and_predicates [OR and_predicates ...] | or_predicates [AND or_predicates ...]]
1473+
[WITH operation_attributes]
14631474

14641475
identifier: [[<namespace name>.]<table name>.]<column name> | [alias.]<column name>
14651476
and_predicates: predicate | (predicate [AND predicate ...])
14661477
or_predicates: predicate | (predicate [OR predicate ...])
14671478
predicate: <identifier> operator <literal> | <identifier> BETWEEN <literal> AND <literal> | <identifier> [NOT] LIKE <pattern> [ESCAPE <escape character>] | <identifier> IS [NOT] NULL
14681479
operator: = | <> | != | > | >= | < | <=
1480+
operation_attributes: <operation attribute name>=<operation attribute value> [AND <operation attribute name>=<operation attribute value>] ...
14691481
```
14701482

14711483
##### Note

0 commit comments

Comments
 (0)