PolarDB for PostgreSQL supports the mainstream Amazon DynamoDB API operations. Before you migrate data or run your application against PolarDB, read this topic to understand which operations are supported, how PolarDB behavior differs from native DynamoDB, and what limits apply.
Assess compatibility before migrating
PolarDB provides a local static code analysis tool, polardb_ddb_code_digest, to help you evaluate how much of your existing codebase will work without modification.
How it works
Code scanning: The tool recursively scans your project directories and parses source files. Go and Python are supported.
API analysis: The tool extracts all DynamoDB API calls, parameter names, constants, and expression structures based on the official AWS SDK specifications.
Report generation: The tool removes all business data values and generates a structured report listing the APIs, parameters, and their usage frequency in your project.
Use this report to check your API usage against the limits in this topic.
Install and run the tool
Prerequisites
Before you begin, ensure that you have:
Python 3.9.6 or later
The project directory containing your Go or Python source files
Steps
Download polardb_ddb_code_digest.tar.gz to your application environment.
Unzip the file and go to the unzipped directory.
(Optional) Create a virtual environment to isolate project dependencies:
python3 -m venv venv && source venv/bin/activateInstall the project dependencies:
pip3 install -r requirements.txtScan your source files:
Python project: ``
bash python3 main.py --dir <path/to/dir> --lang python > scan_output.log``Go project: ``
bash python3 main.py --dir <path/to/dir> --lang go > scan_output.log``
Behavior differences and limits
This section describes how PolarDB differs from native DynamoDB. Unsupported parameters fall into two categories:
Ignored: The parameter is silently accepted but has no effect. The request succeeds, but the parameter value is not applied.
Error: The parameter is rejected and causes the request to fail with an error.
Deprecated parameters
PolarDB follows the current DynamoDB API specification. Deprecated parameters are not supported. Replace them with their modern equivalents before migrating.
| Deprecated parameter | Replacement |
|---|---|
AttributeUpdates | UpdateExpression |
Expected | ConditionExpression |
AttributesToGet | ProjectionExpression |
ConditionalOperator | ConditionExpression or FilterExpression |
KeyConditions | KeyConditionExpression |
QueryFilter | FilterExpression |
ScanFilter | FilterExpression |
Consistency
PolarDB does not support per-request strong consistency reads (ConsistentRead=true). The consistency level is configured at the DynamoDB endpoint and applies to all requests on that endpoint.
Billing and capacity parameters
All DynamoDB billing and capacity parameters are ignored or not returned. This includes:
Request parameters ignored:
ReturnConsumedCapacityResponse fields not returned:
ConsumedCapacity,ItemCollectionMetricsStatistics parameters not supported:
ReturnItemCollectionMetrics
Index projections
When specifying NonKeyAttributes for a secondary index, the projected fields cannot include the table's primary key (partition key or sort key) or the index's own primary key.
Atomicity in batch operations
In PolarDB, batch operations are atomic: all operations in a single request either succeed or fail together.
`BatchWriteItem`:
UnprocessedItemsin the response is always empty because partial failures do not occur.`BatchGetItem`:
UnprocessedKeysin the response is always empty for the same reason.
Primary key conflicts in batch and transactional operations
PolarDB and native DynamoDB handle primary key conflicts differently:
| Operation | Native DynamoDB | PolarDB |
|---|---|---|
BatchWriteItem: PutItem and DeleteItem on the same primary key in one request | Not allowed | Allowed |
BatchGetItem: duplicate primary keys in one request | Not allowed | Allowed; returns one item per duplicate key |
TransactWriteItems: multiple operations on the same primary key in one transaction | Not allowed | Allowed |
TransactGetItems: multiple operations on the same primary key in one transaction | Not allowed | Allowed |
Transaction failure behavior
When a TransactWriteItems transaction is canceled because a condition check fails, PolarDB and native DynamoDB behave differently.
Native DynamoDB attempts all operations and then returns the status of each one:
TransactionCanceledException: Transaction cancelled, please refer cancellation reasons for specific reasons [ConditionalCheckFailed, None, ConditionalCheckFailed]PolarDB aborts immediately at the first failed operation and returns a single error:
ConditionalCheckFailedException: The conditional request failedUpdate your error handling logic to account for this difference if your application inspects per-operation failure details.
UpdateItem: removing a non-existent nested attribute
When using REMOVE a.b to remove a nested attribute where the parent attribute a does not exist:
Native DynamoDB: returns an error.
PolarDB: silently succeeds and performs no operation.
Query and Scan: ScannedCount and Count
In PolarDB, ScannedCount and Count in the response always have the same value. PolarDB does not differentiate between the number of items scanned before and after a FilterExpression is applied. Native DynamoDB returns different values when a filter reduces the result set.
Error messages
Error messages for some operations may differ from those returned by native DynamoDB.
Detailed parameter support
The tables below list every request and response parameter for each supported API operation.
Column legend:
| Value | Meaning |
|---|---|
| Yes | Supported |
| No | Not supported |
The Remarks column explains the behavior for unsupported parameters: whether the parameter is silently ignored or causes the request to fail with an error.
CreateTable
| API name | Parameter type | Parameter name | Required | Supported | Remarks |
|---|---|---|---|---|---|
| CreateTable | Request parameters | AttributeDefinitions | Yes | Yes | - |
| KeySchema | Yes | Yes | - | ||
| TableName | Yes | Yes | - | ||
| BillingMode | No | No | Ignored if included in the request. | ||
| DeletionProtectionEnabled | No | Yes | - | ||
| GlobalSecondaryIndexes | No | Yes | - | ||
| LocalSecondaryIndexes | No | Yes | - | ||
| OnDemandThroughput | No | No | Ignored if included in the request. | ||
| ProvisionedThroughput | No | Yes | Ignored if included in the request. | ||
| ResourcePolicy | No | No | Ignored if included in the request. | ||
| SSESpecification | No | No | Ignored if included in the request. To enable encryption, use Set TDE. | ||
| StreamSpecification | No | No | Ignored if included in the request. For streaming replication, use Subscription Management. | ||
| TableClass | No | No | Ignored if included in the request. | ||
| Tags | No | No | Ignored if included in the request. | ||
| WarmThroughput | No | No | Ignored if included in the request. | ||
| Response parameters | TableDescription | - | Yes | - |
DescribeTable
| API name | Parameter type | Parameter name | Required | Supported | Remarks |
|---|---|---|---|---|---|
| DescribeTable | Request parameters | TableName | Yes | Yes | - |
| Response parameters | Table | - | Yes | - |
ListTables
| API name | Parameter type | Parameter name | Required | Supported | Remarks |
|---|---|---|---|---|---|
| ListTables | Request parameters | ExclusiveStartTableName | No | Yes | - |
| Limit | No | Yes | - | ||
| Response parameters | LastEvaluatedTableName | - | Yes | - | |
| TableNames | - | Yes | - |
UpdateTable
| API name | Parameter type | Parameter name | Required | Supported | Remarks |
|---|---|---|---|---|---|
| UpdateTable | Request parameters | TableName | Yes | Yes | - |
| AttributeDefinitions | No | Yes | - | ||
| BillingMode | No | No | Ignored if included in the request. | ||
| DeletionProtectionEnabled | No | Yes | - | ||
| GlobalSecondaryIndexUpdates | No | Yes | This is a synchronous operation. Perform it during off-peak business hours. | ||
| GlobalTableWitnessUpdates | No | No | An error is reported if included in the request. | ||
| MultiRegionConsistency | No | No | An error is reported if included in the request. | ||
| OnDemandThroughput | No | No | Ignored if included in the request. | ||
| ProvisionedThroughput | No | No | Ignored if included in the request. | ||
| ReplicaUpdates | No | No | An error is reported if included in the request. | ||
| SSESpecification | No | No | Ignored if included in the request. To enable encryption, use Set TDE. | ||
| StreamSpecification | No | No | Ignored if included in the request. For streaming replication, use Subscription Management. | ||
| TableClass | No | No | Ignored if included in the request. | ||
| WarmThroughput | No | No | Ignored if included in the request. | ||
| Response parameters | TableDescription | - | Yes | - |
DeleteTable
| API name | Parameter type | Parameter name | Required | Supported | Remarks |
|---|---|---|---|---|---|
| DeleteTable | Request parameters | TableName | Yes | Yes | - |
| Response parameters | TableDescription | - | Yes | - |
PutItem
| API name | Parameter type | Parameter name | Required | Supported | Remarks |
|---|---|---|---|---|---|
| PutItem | Request parameters | Item | Yes | Yes | - |
| TableName | Yes | Yes | - | ||
| ConditionalOperator | No | No | Deprecated. Use ConditionExpression. | ||
| ConditionExpression | No | Yes | - | ||
| Expected | No | No | Deprecated. Use ConditionExpression. | ||
| ExpressionAttributeNames | No | Yes | - | ||
| ExpressionAttributeValues | No | Yes | - | ||
| ReturnConsumedCapacity | No | Yes | Billing-related parameter. Ignored. | ||
| ReturnItemCollectionMetrics | No | No | Statistics-related parameter. Not supported. | ||
| ReturnValues | No | Yes | - | ||
| ReturnValuesOnConditionCheckFailure | No | Yes | - | ||
| Response parameters | Attributes | - | Yes | - | |
| ConsumedCapacity | - | No | Billing-related parameter. Not returned. | ||
| ItemCollectionMetrics | - | No | Statistics-related parameter. Not returned. |
UpdateItem
| API name | Parameter type | Parameter name | Required | Supported | Remarks |
|---|---|---|---|---|---|
| UpdateItem | Request parameters | Key | Yes | Yes | - |
| TableName | Yes | Yes | - | ||
| AttributeUpdates | No | No | Deprecated. Use UpdateExpression. | ||
| ConditionalOperator | No | No | Deprecated. Use UpdateExpression. | ||
| ConditionExpression | No | Yes | - | ||
| Expected | No | No | Deprecated. Use UpdateExpression. | ||
| ExpressionAttributeNames | No | Yes | - | ||
| ExpressionAttributeValues | No | Yes | - | ||
| ReturnConsumedCapacity | No | Yes | Billing-related parameter. Ignored. | ||
| ReturnItemCollectionMetrics | No | No | Statistics-related parameter. Not supported. | ||
| ReturnValues | No | Yes | - | ||
| ReturnValuesOnConditionCheckFailure | No | Yes | - | ||
| UpdateExpression | No | Yes | - | ||
| Response parameters | Attributes | - | Yes | - | |
| ConsumedCapacity | - | No | Billing-related parameter. Not returned. | ||
| ItemCollectionMetrics | - | No | Statistics-related parameter. Not returned. |
GetItem
| API name | Parameter type | Parameter name | Required | Supported | Remarks |
|---|---|---|---|---|---|
| GetItem | Request parameters | Key | Yes | Yes | - |
| TableName | Yes | Yes | - | ||
| AttributesToGet | No | No | Deprecated. Use ProjectionExpression. | ||
| ConsistentRead | No | No | Can only be set to false. Configure the consistency level at the endpoint. | ||
| ExpressionAttributeNames | No | Yes | - | ||
| ProjectionExpression | No | Yes | - | ||
| ReturnConsumedCapacity | No | Yes | Billing-related parameter. Ignored. | ||
| Response parameters | ConsumedCapacity | - | No | Billing-related parameter. Not returned. | |
| Item | - | Yes | - |
DeleteItem
| API name | Parameter type | Parameter name | Required | Supported | Remarks |
|---|---|---|---|---|---|
| DeleteItem | Request parameters | Key | Yes | Yes | - |
| TableName | Yes | Yes | - | ||
| ConditionalOperator | No | No | Deprecated. Use ConditionExpression. | ||
| ConditionExpression | No | Yes | - | ||
| Expected | No | No | Deprecated. Use ConditionExpression. | ||
| ExpressionAttributeNames | No | Yes | - | ||
| ExpressionAttributeValues | No | Yes | - | ||
| ReturnConsumedCapacity | No | Yes | Billing-related parameter. Ignored. | ||
| ReturnItemCollectionMetrics | No | No | Statistics-related parameter. Not supported. | ||
| ReturnValues | No | Yes | - | ||
| ReturnValuesOnConditionCheckFailure | No | Yes | - | ||
| Response parameters | Attributes | - | Yes | - | |
| ConsumedCapacity | - | No | Billing-related parameter. Not returned. | ||
| ItemCollectionMetrics | - | No | Statistics-related parameter. Not returned. |
BatchWriteItem
| API name | Parameter type | Parameter name | Required | Supported | Remarks |
|---|---|---|---|---|---|
| BatchWriteItem | Request parameters | RequestItems | Yes | Yes | - |
| ReturnConsumedCapacity | No | No | Billing-related parameter. Ignored. | ||
| ReturnItemCollectionMetrics | No | No | Statistics-related parameter. Not supported. | ||
| Response parameters | ConsumedCapacity | - | No | Billing-related parameter. Not returned. | |
| ItemCollectionMetrics | - | No | Statistics-related parameter. Not returned. | ||
| UnprocessedItems | - | Yes | Behavior differs from native DynamoDB. Always empty. See Atomicity in batch operations. |
| Parameter | Secondary parameter | Tertiary parameter | Required | Supported | Remarks |
|---|---|---|---|---|---|
| RequestItems | DeleteRequest | Key | Yes | Yes | - |
| PutRequest | Item | Yes | Yes | - |
BatchGetItem
| API name | Parameter type | Parameter name | Required | Supported | Remarks |
|---|---|---|---|---|---|
| BatchGetItem | Request parameters | RequestItems | Yes | Yes | - |
| ReturnConsumedCapacity | No | No | Billing-related parameter. Ignored. | ||
| Response parameters | ConsumedCapacity | - | No | Billing-related parameter. Not returned. | |
| Responses | - | Yes | - | ||
| UnprocessedKeys | - | Yes | Behavior differs from native DynamoDB. Always empty. See Atomicity in batch operations. |
| Parameter | Secondary parameter | Required | Supported | Remarks |
|---|---|---|---|---|
| RequestItems | ConsistentRead | No | Yes | - |
| ExpressionAttributeNames | No | Yes | - | |
| Keys | Yes | Yes | - | |
| ProjectionExpression | No | Yes | - | |
| AttributesToGet | No | No | Deprecated. Use ProjectionExpression. An error is reported if included in the request. |
Query
| API name | Parameter type | Parameter name | Required | Supported | Remarks |
|---|---|---|---|---|---|
| Query | Request parameters | TableName | Yes | Yes | - |
| AttributesToGet | No | No | Deprecated. Use ProjectionExpression. | ||
| ConditionalOperator | No | No | Deprecated. Use FilterExpression. | ||
| ConsistentRead | No | No | Can only be set to false. Configure the consistency level at the endpoint. | ||
| ExclusiveStartKey | No | Yes | - | ||
| ExpressionAttributeNames | No | Yes | - | ||
| ExpressionAttributeValues | No | Yes | - | ||
| FilterExpression | No | Yes | - | ||
| IndexName | No | Yes | - | ||
| KeyConditionExpression | No | Yes | - | ||
| KeyConditions | No | No | Deprecated. Use KeyConditionExpression. | ||
| Limit | No | Yes | - | ||
| ProjectionExpression | No | Yes | - | ||
| QueryFilter | No | No | Deprecated. Use FilterExpression. | ||
| ReturnConsumedCapacity | No | No | Billing-related parameter. Ignored. | ||
| ScanIndexForward | No | Yes | - | ||
| Select | No | Yes | - | ||
| Response parameters | ConsumedCapacity | - | No | Billing-related parameter. Not returned. | |
| Count | - | Yes | Behavior differs. Always equals ScannedCount. | ||
| Items | - | Yes | - | ||
| LastEvaluatedKey | - | Yes | - | ||
| ScannedCount | - | Yes | - |
Scan
| API name | Parameter type | Parameter name | Required | Supported | Remarks |
|---|---|---|---|---|---|
| Scan | Request parameters | TableName | Yes | Yes | - |
| AttributesToGet | No | No | Deprecated. Use ProjectionExpression. | ||
| ConditionalOperator | No | No | Deprecated. Use FilterExpression. | ||
| ConsistentRead | No | No | Can only be set to false. Configure the consistency level at the endpoint. | ||
| ExclusiveStartKey | No | Yes | - | ||
| ExpressionAttributeNames | No | Yes | - | ||
| ExpressionAttributeValues | No | Yes | - | ||
| FilterExpression | No | Yes | - | ||
| IndexName | No | Yes | - | ||
| Limit | No | Yes | - | ||
| ProjectionExpression | No | Yes | - | ||
| ReturnConsumedCapacity | No | No | Billing-related parameter. Ignored. | ||
| ScanFilter | No | No | Deprecated. Use FilterExpression. | ||
| Segment | No | No | Not supported. An error is reported if included in the request. | ||
| Select | No | Yes | - | ||
| TotalSegments | No | Yes | - | ||
| Response parameters | ConsumedCapacity | - | No | Billing-related parameter. Not returned. | |
| Count | - | Yes | Behavior differs. Always equals ScannedCount. | ||
| Items | - | Yes | - | ||
| LastEvaluatedKey | - | Yes | - | ||
| ScannedCount | - | Yes | - |
TransactWriteItems
| API name | Parameter type | Parameter name | Required | Supported | Remarks |
|---|---|---|---|---|---|
| TransactWriteItems | Request parameters | TransactItems | Yes | Yes | - |
| ClientRequestToken | No | Yes | - | ||
| ReturnConsumedCapacity | No | Yes | Billing-related parameter. Ignored. | ||
| ReturnItemCollectionMetrics | No | No | Statistics-related parameter. Not supported. | ||
| Response parameters | ConsumedCapacity | - | No | Billing-related parameter. Not returned. | |
| ItemCollectionMetrics | - | No | Statistics-related parameter. Not returned. |
| Parameter | Secondary parameter | Required | Supported | Remarks |
|---|---|---|---|---|
| TransactItems | ConditionCheck | No | Yes | - |
| Put | No | Yes | - | |
| Update | No | Yes | - | |
| Delete | No | Yes | - |
TransactGetItems
| API name | Parameter type | Parameter name | Required | Supported | Remarks |
|---|---|---|---|---|---|
| TransactGetItems | Request parameters | TransactItems | Yes | Yes | - |
| ReturnConsumedCapacity | No | Yes | Billing-related parameter. Ignored. | ||
| Response parameters | ConsumedCapacity | - | No | Billing-related parameter. Not returned. | |
| Responses | - | Yes | - |
DescribeTimeToLive
| API name | Parameter type | Parameter name | Required | Supported | Remarks |
|---|---|---|---|---|---|
| DescribeTimeToLive | Request parameters | TableName | Yes | Yes | - |
| Response parameters | TimeToLiveDescription | - | Yes | - |
UpdateTimeToLive
| API name | Parameter type | Parameter name | Required | Supported | Remarks |
|---|---|---|---|---|---|
| UpdateTimeToLive | Request parameters | TableName | Yes | Yes | - |
| TimeToLiveSpecification | Yes | Yes | - | ||
| Response parameters | TimeToLiveSpecification | - | Yes | - |
| Parameter | Secondary parameter | Required | Supported | Remarks |
|---|---|---|---|---|
| TimeToLiveSpecification | AttributeName | Yes | Yes | - |
| Enabled | Yes | Yes | - |