更新时间:2025-12-11 GMT+08:00
分享

GeminiDB Serverless使用与约束

本章节介绍GeminiDB Serverless使用与约束。

使用须知

  • GeminiDB Serverless兼容DynamoDB接口,支持使用GeminiDB兼容DynamoDB接口的API对表进行增删改操作,控制台只支持DDL操作。
  • 当前版本不支持事务功能(TransactWriteItems, TransactGetItems)。
  • 当前版本不支持按需备份接口:CreateBackup、DescribeBackup、 DeleteBackup、 ListBackups、 RestoreTableFromBackup。
  • 表/索引名称中不能包含的字符有:"."。
  • DDL接口均为同步接口。

支持的表达式

GeminiDB兼容DynamoDB接口中的ConditionExpression、FilterExpression支持的函数语法如下:

function ::=
    attribute_exists (path)
    | attribute_not_exists (path)
    | attribute_type (path, type)
    | begins_with (path, substr)
    | contains (path, operand)
contains(path,operand)中operand只能是属性值(即传入的value占位符)。 

GeminiDB兼容DynamoDB接口中的UpdateExpression语法如下:

update-expression ::=
    [ SET action [, action] ... ]
    [ REMOVE action [, action] ...]
    [ ADD action [, action] ... ]
    [ DELETE action [, action] ...]   

set-action ::=
    path = value  

value ::=
    operand
    | operand '+' operand
    | operand '-' operand   

operand ::= 
    path | function  

function ::= 
    if_not_exists (path, value) 
    | list_append (list1, list2)   

remove-action ::=
    path   

add-action ::= 
    path value

delete-action ::= 
    path value
SET path = operand语法中,不支持operand是path的场景。 
SET path = operand1 '+'|'-' operand2语法中,operand1必须等于path,operand2必须是属性值 
SET path = if_not_exists (path, value)语法中,两个path必须相等,且value只能是表达式属性值。 
所有的value只能是占位符,比如':placeholder'。 

兼容的接口列表

表2 CreateTable接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

CreateTable

请求参数

AttributeDefinitions

-

KeySchema

-

TableName

Table Name 字符长度3~48,正则表达式([\w-]+)。

BillingMode

-

GlobalSecondaryIndexes

-

LocalSecondaryIndexes

-

ProvisionedThroughput

-

SSESpecification

-

StreamSpecification

-

Tags

-

返回参数

TableDescription

-

-

表3 UpdateTable接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

UpdateTable

请求参数

AttributeDefinitions

-

BillingMode

-

GlobalSecondaryIndexesUpdates

-

ProvisionedThroughput

-

ReplicaUpdates

默认强一致性。

SSESpecification

-

StreamSpecification

-

TableName

-

返回参数

TableDescription

-

-

表4 DescribeTable接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

DescribeTable

请求参数

TableName

-

返回参数

Table

-

-

表5 ListTables接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

ListTables

请求参数

ExclusiveStartTableName

-

Limit

-

返回参数

LastEvaluatedTableName

-

-

TableNames

-

-

表6 DeleteTable接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

DeleteTable

请求参数

TableName

-

返回参数

TableDescription

-

-

表7 PutItem接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

PutItem

请求参数

Item

-

TableName

-

ConditionalOperator

-

ConditionExpression

-

Expected

-

ExpressionAttributeNames

-

ExpressionAttributeValues

-

ReturnConsumedCapacity

-

ReturnItemCollectionMetrics

-

ReturnValues

-

返回参数

Attributes

-

-

ConsumedCapacity

-

-

ItemCollectionMetrics

-

-

表8 UpdateItem接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

UpdateItem

请求参数

Key

-

TableName

-

AttributeUpdates

-

ConditionalOperator

-

ConditionExpression

-

Expected

-

ExpressionAttributeNames

-

ExpressionAttributeValues

-

ReturnConsumedCapacity

-

ReturnItemCollectionMetrics

-

ReturnValues

-

UpdateExpression

-

返回参数

Attributes

-

-

ConsumedCapacity

-

-

ItemCollectionMetrics

-

-

表9 GetItem接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

GetItem

请求参数

Key

-

TableName

-

AttributesToGet

-

ConsistentRead

默认强一致性。

ExpressionAttributeNames

-

ProjectionExpression

-

ReturnConsumedCapacity

-

返回参数

ConsumedCapacity

-

-

Item

-

-

表10 DeleteItem接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

DeleteItem

请求参数

Key

-

TableName

-

ConditionalOperator

-

ConditionExpression

-

Expected

-

ExpressionAttributeNames

-

ExpressionAttributeValues

-

ReturnConsumedCapacity

-

ReturnItemCollectionMetrics

-

ReturnValues

-

返回参数

Attributes

-

-

ConsumedCapacity

-

-

ItemCollectionMetrics

-

-

表11 BatchWriteItem接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

BatchWriteItem

请求参数

RequestItems

-

ReturnConsumedCapacity

-

ReturnItemCollectionMetrics

-

返回参数

ConsumedCapacity

-

-

ItemCollectionMetrics

-

-

UnprocessedItems

-

-

表12 BatchGetItem接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

BatchGetItem

请求参数

RequestItems

ReturnConsumedCapacity

-

返回参数

ConsumedCapacity

-

-

Responses

-

-

UnprocessedKeys

-

-

表13 Query接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

Query

请求参数

TableName

-

AttributesToGet

-

ConditionalOperator

-

ConsistentRead

默认强一致性。

ExclusiveStartKey

-

ExpressionAttributeNames

-

ExpressionAttributeValues

-

FilterExpression

-

IndexName

-

KeyConditionExpression

-

KeyConditions

-

Limit

-

ProjectionExpression

-

QueryFilter

-

ReturnConsumedCapacity

-

ScanIndexForward

-

Select

-

返回参数

ConsumedCapacity

-

-

Count

-

-

Items

-

-

LastEvaluatedKey

-

-

ScannedCount

-

-

表14 Scan接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

Scan

请求参数

TableName

-

AttributesToGet

-

ConditionalOperator

-

ConsistentRead

默认强一致性。

ExclusiveStartKey

-

ExpressionAttributeNames

-

ExpressionAttributeValues

-

FilterExpression

-

IndexName

-

Limit

-

ProjectionExpression

-

ReturnConsumedCapacity

-

ScanFilter

-

Segment

-

Select

-

TotalSegments

-

返回参数

ConsumedCapacity

-

Count

-

-

Items

-

-

LastEvaluatedKey

-

-

ScannedCount

-

-

表15 UpdateTimeToLive接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

UpdateTimeToLive

请求参数

TableName

-

TimeToLiveSpecification

-

返回参数

TimeToLiveSpecification

-

-

表16 DescribeTimeToLive接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

DescribeTimeToLive

请求参数

TableName

-

返回参数

TimeToLiveSpecification

-

-

相关文档