I'm trying to migrate a SQL Server table using AWS DMS to a DynamoDb target. The table structure is as follows:
|SourceTableID|Title |Status|Display|LongDescription|
|-------------|-----------|------|-------|---------------|
|VARCHAR(100) |VARCHAR(50)|INT |BIT |NVARCHAR(MAX) |
Every field is being migrated without errors and is present in my target DynamoDb table except for the LongDescription
column. This is because it is a NVARCHAR(MAX)
column.
According to the documentation:
The following limitations apply when using DynamoDB as a target:
- AWS DMS doesn't support LOB data unless it is a CLOB. AWS DMS converts CLOB data into a DynamoDB string when migrating data.
https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.DynamoDB.html
Source Data Types for SQL Server
|SQL Server Data Types|AWS DMS Data Types| |----------------------------------------| |NVARCHAR (max) |NCLOB, TEXT |
https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.SQLServer.html
Depending on my task configuration the following two scenarios occur:
LongDescription
column is being migrated properly to DynamoDb, however the text is truncatedLongDescription
column is NOT migrated properly to DynamoDbHow can I correctly migrate an NVARCHAR(MAX)
column to DynamoDb without losing any data?
Thanks!
Progress Report
Limitations to Using Amazon S3 as a Target
- Full LOB mode is not supported.
https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.S3.html
I cannot use the compress T-SQL command in order to store the LongDescription
column as a binary, since my SQLServer version is 2014
I tried to run the migration task to Limited LOB mode and use the maximum byte size as the limit. My maximum byte size is 45155996 so I set 46000KB as the limit. This results in an error as follows:
Failed to put item into table 'TestMigration_4' with data record with source PK column 'SourceTableID' and value '123456'
Support for Microsoft SQL Server version 2019 as a source is available. AWS DMS supports migrating data from named instances of SQL Server. You can use the following notation in the server name when you create the source endpoint. For example, the following is a correct source endpoint server name.
Large binary objects (LOBs) can sometimes be difficult to migrate between systems. AWS DMS offers a number of options to help with the tuning of LOB columns. To see which and when data types are considered LOBs by AWS DMS, see the AWS DMS documentation.
To improve the performance of a task that uses Full LOB mode with multiple tables, identify the size of the largest LOB in your database. Then, you can use Limited LOB mode if the size of the largest LOB size isn't more than a few megabytes.
You might want to check this AWS' best practices page for storing large items/attributes in DynamoDB:
If your application needs to store more data in an item than the DynamoDB size limit permits, you can try compressing one or more large attributes or breaking the item into multiple items (efficiently indexed by sort keys). You can also store the item as an object in Amazon Simple Storage Service (Amazon S3) and store the Amazon S3 object identifier in your DynamoDB item.
I actually like the idea of saving your LongDescription
in S3 and referencing its identifier in DynamoDB. I never tried, but an idea would be to use their DMS ability to create multiple migration tasks to perform this, or even create some kind of ETL solution as last resort, making use of DMS' CDC capability. You might want to get in touch with their support team to make sure it works.
Hope it helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With