更新时间:2026-09-07 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

-

是

-

相关文档