DynamoDB Dashboard can't Save/Update Item: ConditionalCheckFailedException - amazon-web-services

I need to update an item in a table, using the AWS Console DDB Dashboard. But when I go into "Edit item" and click "Save", I keep getting a ConditionalCheckFailedException error.
I assume this means the existing item has a ConditionExpression which my new data is somehow violating. But I can't figure out how to view that expression from the Dashboard so I can determine what the issue is.
How can I view the ConditionExpression for an Item in a Table, from the AWS Console DDB Dashboard?

I had the same problem and with the help of AWS support have solved it.
The issue arises because the DynamoDB console for the "Items" tab is a static display which takes a snapshot of all your items when it is first displayed. If you select an item and then return to the screen you still see the same snapshot - it is not updated.
When you try to update an item, the console sends the values of all the existing fields from the snapshot for this item and if any of these fields differ from their current values in DynamoDB then the update is rejected. So the "conditional expression" is referring to the requirements which the console is making for the update to be allowed.
So the workaround is to perform a browser window refresh on the item list before selecting the item you wish to edit and then hope you are fast enough with the edit to finish it before any external updates to the table change the data. Of course if you have a rapidly changing table then you will not be able to be quick enough and so the console is not the right tool for the job.

Related

Is there a delay in DynamoDB console to show the table's latest contents?

I am deleting an item from a DynamoDB table using SDK, but if I check the console, sometimes it remains there even after clicking the refresh button.
Is there a delay in DynamoDB console to show the table's latest contents? I need to make sure whether my code has some issues or the console has some delay. Because, it is quite confusing, in some cases, the item gets disappeared, and in some cases not.

ApEx 19.1 form region item value not passing on insert/create

I've been designing a new app in ApEx 19.1 and one of the form/reports which I have created will not save a specific column when I click CREATE (SQL Insert action). Debug data shows that the data is in the session state when the CREATE request is being processed. I have verified that the value is not inserted with the other columns by querying the table in SQL Developer.
When I click to edit the item, the page item is blank and the value is not in the session state. I can then choose a value, and it saves correctly (SQL Update action).
I have several other 19.1 form/reports in the app which do not have this problem.
Details:
-ApEx 19.1
-Modal Form page on an Interactive Report
-New Form Region, not legacy DML setup
-DATETIME column type, Date Picker item type
-Required column, Value Required = Yes (and errors occur correctly if left blank)
-The biggest difference between this page and others is that rather than navigating directly from the report page to this form dialog on Create, there is a different modal dialog form that must be filled, and then the user navigates to the form in question.
All of the other fields insert data correctly to their corresponding columns, and I haven't changed any of the Source settings after creation, so I'm not sure what is causing the issue. I've even deleted the pages and rebuilt them with the same results.
The issue had nothing to do with ApEx, and everything to do with poor DB & app design.
There was an insert trigger on the table which inserted a value to the column in question from an application item which had not been set.
I'll definitely clear that up to avoid future confusion.

Query DynamoDB from within AWS

Ive been looking around, and have not been able to find anywhere on the AWS console a place where i can query the tables i have created in DynamoDB.
Is it possible for me to run quick queries against any of the tables i have in DynamoDB from within AWS itself. Or will i actually have to go ahead and build a quick app that lets me run the queries??
I would have thought that there would be some basic tool provided that lets me run queries against the tables. If there is, its well hidden....
Any help would be great!
DynamoDB console -> Tables -> click the table you want to query -> select the Items tab
You will then see an interface to Scan or Query the table. You can change the first drop-down from "Scan" to "Query" based on what you want to do, and change the second drop-down to select the table index you want to query.

refresh of one report region in apex

I have page with 10 clasic reports and 10 form region (one for each report). On each form region is button with Dynamic action witch
insert data in table. My problem is how to refresh just one report after I insert data so that new data is shown in report. I tried to add another
true action in Dynamic action (refresh region) but it has no effect. Anyone had any idea? Apex version is 4.2
Thanks in advance.
One thing you can do is.
Assign Static ID to your every reports, Like 'myReport1', 'myReport2' or what ever you want (ignore if you already did).
on each button click when you are updating database,
add one more True Action with Execute JavaScipt Code in your existing Dynamic Action.
and put $('#myReport1').trigger('apexrefresh');
repeat this for all of your Reports with relevant Report ID.
This is a frustrating issue and one which I have hit a few times...
Things to check:
Report region is region type: SQL query (PL/SQL Function body returning SQL Query - cannot be refreshed using a standard refresh dynamic action).
Ensure that: id="#REGION_STATIC_ID#" is in the Report template you are trying to refresh
Navigate to: Report Attributes > Layout and Pagination: ensure that "Partial page Refresh" is set to Yes.
Ensure that: any page item values which your SQL report is based on are submitted, these can be entered under Region Source in the "Page Items to Submit" box.
In the "Attributes" in "Pagination", "Partial Page Refresh" should be "Yes". otherwise classic report does not refresh.
Check if you have selected the Template "Standard" in Section "Appearance" of your Classic Report. This solved my problem with refreshing in Apex 5.

How to rename a DynamoDB table

I have DynamoDB table and I would like to rename it. There does not seems to be any commands or options to rename a table. Has anybody renamed a table before?
I know this is an old question and I don't want to steal the thunder from user6500852's answer but for anyone stumbling upon this needing an answer:
Select the table you want to rename in the Web UI so it's highlighted and the various tabs show up to the right.
Click on the Backups tab and feast your eyes upon the lower half of the page ("On-Demand Backup and Restore").
3. Smash that "Create Backup" button. You'll be prompted for a backup name. Name it whatever you want. The world is yours!
Give it time to complete the backup. If you just have a few records, this will be seconds. If you have a ton of records it could be hours. Buckle up or just go home and get some rest.
Once the backup is ready, highlight it in the list. You'll see the "Restore Backup" button light up. Click it.
You'll get a prompt asking you to enter the NEW table name. Enter the name you wanted to rename this table to. Note: the way the UI is you may have to click out of the field in the static page area for the "Restore table" button at the bottom of the page to light up.
Once you're ready to go, you click on the "Restore table" button. Note the info on that page indicating it can take several hours to complete. My table with just five test records took over 10 minutes to restore. I thought it was because the original was a Global Table but the restored table was NOT set up as a Global Table (which defeats the purpose of this for Global Tables since you have to empty the table to make it global).
Bear in mind that last note! If you're working with a Global Table, you will lose the Global part after the restore. Buyer beware! You may have to consider an export and import via Data Pipeline...
If you're not, then the Backup and Restore is a pretty easy process to use (without having to go and setup a pipeline, S3 store, etc.). It can just take some time.
Hope this helps someone!
Currently no, you would need to create a new table and copy the data from one to the other if you really needed a new table name.
You can use the Export/Import feature to backup your data to S3. Then delete your old table, and create a new one with the new name. Import your data from S3. Done. No code change necessary. If you don't delete CloudWatch alarms and Pipelines when deleting the old table, then those will automatically hook up to the new table. The ARN even stays the same.
The downside to this, of course, is that the table will be unusable during the time after you delete it and before you recreate it. This may or may not be a problem, but that needs to be considered. Additionally, once you recreate the table, it can be accessed while you work on the data import. You may want to stop your app's access to the table until the import is complete.
Create first backup from backup tab.
While creating restore backup, it prompt with request of new table name.
In that we can apply new/backup table name.
Hope this will help.
You should be able to achieve this using on demand backup / restore functionality.
Check out a walk through on backing up a table, and restore to a new table:
https://www.abhayachauhan.com/2017/12/dynamodb-scheduling-on-demand-backups/