更新时间:2026-05-21 GMT+08:00
分享

接口兼容性介绍

本章节介绍GeminiDB兼容DynamoDB接口支持的接口详情以及注意事项。

使用须知

  • GeminiDB兼容DynamoDB接口支持使用DynamoDB的API对表进行增删改操作,控制台只支持读操作。
  • 非DynamoDB的API创建的表,无法在GeminiDB兼容DynamoDB接口中使用。
  • 当前版本不支持流量统计、流量限制、事务功能(TransactWriteItems, TransactGetItems)。
  • 当前版本不支持按需备份接口:CreateBackup、DescribeBackup、 DeleteBackup、 ListBackups、 RestoreTableFromBackup。
  • 在DynamoDB中,哈希键(或分区键)决定项目存储在DynamoDB内部存储中的位置。DynamoDB使用专有的哈希函数,GeminiDB兼容DynamoDB接口使用的是Murmur3算法,这种差异会导致Scan操作返回的数据顺序不同。
  • 表/索引名称中不能包含的字符有:"."。
  • 由于编码方式不同,GeminiDB兼容DynamoDB接口表中的每行数据不会严格限制400KB大小。
  • DDL接口均为同步接口。
  • 通常情况下,索引同步可在1秒内完成;在极端场景下,延迟最多延长至1~2分钟。

支持的表达式

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

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'。

不兼容的接口列表

表1 接口列表

接口名称

BatchExecuteStatement

CreateBackup

CreateGlobalTable

DeleteBackup

DescribeBackup

DescribeEndpoints

DescribeExport

DescribeGlobalTable

DescribeGlobalTableSettings

DescribeImport

DescribeLimits

ExecuteStatement

ExecuteTransaction

ExportTableToPointInTime

ImportTable

ListBackups

ListExports

ListGlobalTables

ListImports

ListTagsOfResource

PutResourcePolicy

RestoreTableFromBackup

RestoreTableToPointInTime

TagResource

TransactGetItems

TransactWriteItems

UpdateGlobalTable

UpdateGlobalTableSettings

表3 CreateTable接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

CreateTable

请求参数

AttributeDefinitions

-

KeySchema

-

TableName

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

BillingMode

计费属性,暂不支持。

GlobalSecondaryIndexes

-

LocalSecondaryIndexes

-

ProvisionedThroughput

-

SSESpecification

当前版本不支持,规划中。

StreamSpecification

-

Tags

当前版本不支持,规划中。

返回参数

TableDescription

-

-

表4 UpdateTable接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

UpdateTable

请求参数

AttributeDefinitions

-

BillingMode

计费属性,不予支持。

GlobalSecondaryIndexesUpdates

支持Create和Delete,不支持Update。

ProvisionedThroughput

计费属性,不予支持。

ReplicaUpdates

默认强一致性。

SSESpecification

当前版本不支持,规划中。

StreamSpecification

-

TableName

-

返回参数

TableDescription

-

-

表5 DescribeTable接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

DescribeTable

请求参数

TableName

-

返回参数

Table

-

不支持itemCount字段。

表6 ListTables接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

ListTables

请求参数

ExclusiveStartTableName

-

Limit

-

返回参数

LastEvaluatedTableName

-

-

TableNames

-

-

表7 DeleteTable接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

DeleteTable

请求参数

TableName

-

返回参数

TableDescription

-

-

表8 PutItem接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

PutItem

请求参数

Item

-

TableName

-

ConditionalOperator

遗弃参数,见ConditionExpression。

ConditionExpression

-

Expected

遗弃参数,见该接口中ConditionExpression字段。

ExpressionAttributeNames

-

ExpressionAttributeValues

-

ReturnConsumedCapacity

计费属性,暂不支持。

ReturnItemCollectionMetrics

统计属性,暂不支持。

ReturnValues

-

返回参数

Attributes

-

-

ConsumedCapacity

-

计费属性,暂不支持。

ItemCollectionMetrics

-

统计属性,暂不支持。

表9 UpdateItem接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

UpdateItem

请求参数

Key

-

TableName

-

AttributeUpdates

遗弃参数,见该接口中UpdateExpression字段。

ConditionalOperator

遗弃参数,见该接口中UpdateExpression字段。

ConditionExpression

-

Expected

遗弃参数,见该接口中UpdateExpression字段。

ExpressionAttributeNames

-

ExpressionAttributeValues

-

ReturnConsumedCapacity

计费属性,暂不支持。

ReturnItemCollectionMetrics

统计属性,暂不支持。

ReturnValues

-

UpdateExpression

-

返回参数

Attributes

-

-

ConsumedCapacity

-

计费属性,暂不支持。

ItemCollectionMetrics

-

统计属性,暂不支持。

表10 GetItem接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

GetItem

请求参数

Key

-

TableName

-

AttributesToGet

遗弃参数,见该接口中ProjectionExpression字段。

ConsistentRead

默认强一致性。

ExpressionAttributeNames

-

ProjectionExpression

-

ReturnConsumedCapacity

计费属性,暂不支持。

返回参数

ConsumedCapacity

-

计费属性,暂不支持。

Item

-

-

表11 DeleteItem接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

DeleteItem

请求参数

Key

-

TableName

-

ConditionalOperator

遗弃参数,见该接口中ConditionExpression字段。

ConditionExpression

-

Expected

遗弃参数,见该接口中ConditionExpression字段。

ExpressionAttributeNames

-

ExpressionAttributeValues

-

ReturnConsumedCapacity

计费属性,暂不支持。

ReturnItemCollectionMetrics

统计属性,暂不支持。

ReturnValues

-

返回参数

Attributes

-

-

ConsumedCapacity

-

计费属性,暂不支持。

ItemCollectionMetrics

-

统计属性,暂不支持。

表12 BatchWriteItem接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

BatchWriteItem

请求参数

RequestItems

-

ReturnConsumedCapacity

计费属性,暂不支持。

ReturnItemCollectionMetrics

统计属性,暂不支持。

返回参数

ConsumedCapacity

-

计费属性,暂不支持。

ItemCollectionMetrics

-

统计属性,暂不支持。

UnprocessedItems

-

-

表13 BatchGetItem接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

BatchGetItem

请求参数

RequestItems

ReturnConsumedCapacity

计费属性,暂不支持。

返回参数

ConsumedCapacity

-

统计属性,暂不支持。

Responses

-

-

UnprocessedKeys

-

-

表14 Query接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

Query

请求参数

TableName

-

AttributesToGet

遗弃参数,见该接口中ProjectionExpression字段。

ConditionalOperator

遗弃参数,见该接口中ProjectionExpression字段。

ConsistentRead

默认强一致性。

ExclusiveStartKey

-

ExpressionAttributeNames

-

ExpressionAttributeValues

-

FilterExpression

-

IndexName

-

KeyConditionExpression

-

KeyConditions

遗弃参数,见该接口中KeyConditionExpression字段。

Limit

-

ProjectionExpression

-

QueryFilter

遗弃参数,见该接口中FilterExpression字段。

ReturnConsumedCapacity

计费属性,暂不支持。

ScanIndexForward

-

Select

不支持Count。

返回参数

ConsumedCapacity

-

计费属性,暂不支持。

Count

-

-

Items

-

-

LastEvaluatedKey

-

-

ScannedCount

-

-

表15 Scan接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

Scan

请求参数

TableName

-

AttributesToGet

遗弃参数,见该接口中ProjectionExpression字段。

ConditionalOperator

遗弃参数,见该接口中ConditionExpression字段。

ConsistentRead

默认强一致性。

ExclusiveStartKey

-

ExpressionAttributeNames

-

ExpressionAttributeValues

-

FilterExpression

-

IndexName

-

Limit

-

ProjectionExpression

-

ReturnConsumedCapacity

计费属性,暂不支持。

ScanFilter

遗弃参数,该接口中FilterExpression字段。

Segment

-

Select

不支持Count类型。

TotalSegments

-

返回参数

ConsumedCapacity

计费属性,暂不支持。

Count

-

-

Items

-

-

LastEvaluatedKey

-

-

ScannedCount

-

-

表16 UpdateTimeToLive接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

UpdateTimeToLive

请求参数

TableName

-

TimeToLiveSpecification

-

返回参数

TimeToLiveSpecification

-

-

表17 DescribeTimeToLive接口兼容性介绍

接口名称

参数

是否必选

是否支持

备注

DescribeTimeToLive

请求参数

TableName

-

返回参数

TimeToLiveSpecification

-

-

相关文档