DynamoDB AWS best way to retrieve data in a recurring way - ios

So as the question states, I have a dynamoDB setup from which I am fetching data. My User end is configured in iOS, hence I am using the AWS iOS SDK. Although the documentation is alright, but its outdated a lot, and going through the documentations, many classes are deprecated.
I have 2 questions -
I have to fetch the latest entry from the DB always, so I am doing this by setting the scanforward = false and limit = 1 . Now I am calling query method from the dynamoDBObjectMapper, but there is also load method which also can be configured to do the same. My first question is that what is the difference between query and load if I have to fetch only the latest entry in the DB. Also what is the correct way to retrieve it?
I have to fetch this data in the most instantaneous way possible. I know about DynamoDBStream, but that is NOT an option. Basically I have to implement a long polling kind of feature, where I will get a call? whenever any data is changed OR continuously fetch data from the dynamoDB at a particular interval. Shall i use NSTimer and the same method call (load vs query) to fetch the latest entry in the DB?
Any help is greatly appreciated. Also if any developer working in Amazon can see this question, please remove the old documentation from AWS console and keep the latest ones. There are 5 documentation on the same thing, and all of them are outdated and deprecated.

Thanks for pointing that out. Can you give the links of the documentation that has deprecated classes? We will try to keep the latest ones and remove if there are any redundant deprecated references.
load() API is used to retrieve an item: Using an object's primary key load the corresponding item from the database. Look for an example here: http://docs.aws.amazon.com/mobile/sdkforios/developerguide/dynamodb-object-mapper.html under "Retrieve an item" section.
query() API can be used to return any number of records that match the query. The query API enables you to query a table or a secondary index.
To answer your question, if you know the primary key of the record that you are trying to retrieve, you can use load() API, otherwise use query() API.
DynamoDBStreams work well for your use case. Otherwise you can intgerate AWS Lambda with DynamoDB table to do polling which will be cleaner than a timer based approach. This question is partially answered here: Hooks for AWS DynamoDB streams

Related

Finding delete entity calls to Azure storage table

Is there a way to find out if there was any delete entity call to a azure table in last 'N' minutes? Basically my goal is to find all operations that updated the table in last 'N' minutes.
Update: I am looking for a way to do it with a rest api call for a specific table in the storage.
If using Azure Portal an option, you can find this information via Metrics. For example, see the screenshot below
]
Basically here I am taking a sum of all transactions against my table storage where API call was DeleteEntity.
You can find more information about it here: https://learn.microsoft.com/en-us/azure/storage/common/storage-metrics-in-azure-monitor?toc=%2fazure%2fstorage%2fblobs%2ftoc.json.
UPDATE
If you wish to get this information programmatically, I believe you will need to use Azure Monitoring REST API. I looked up the request sent by Portal and it is sending a request to /subscriptions/<my-subscription-id>/resourceGroups/<my-resource-group>/providers/Microsoft.Storage/storageAccounts/<my-storage-account>/tableServices/default/providers/Microsoft.Insights/metrics/Transactions endpoint.
UPDATE 2
For a specific table, the only option I can think of is to fetch the data from Storage Analytics Logs which is stored in $logs blob container and then parse the CSV file manually. You may find these links helpful:
https://learn.microsoft.com/en-us/rest/api/storageservices/storage-analytics-log-format
https://learn.microsoft.com/en-us/rest/api/storageservices/storage-analytics-logged-operations-and-status-messages#logged-operations

create relationship in parse dashboard

does anyone know if it is possible to create relationships in the dashboard of parse?
I'm running the bitnami parse api 1.0.18 through aws ec2 and can't see anyway of doing it and the documentations only says you can do it through code. i want to have these set up in the background as the user won't write to them, probably just download some data and images.
i could just go and create a whole heap of tables with unique identifiers but this seems a bit of a dumb work around.
I strongly suggest you look into Cloud code. This is one of the reason why cloud code works so well! Simple to setup and little bit of javascript you'll be on your way.
http://parseplatform.github.io/docs/cloudcode/guide/
If its something that needs to happen before the insert, look at the beforeSave method.

Should we use the Neo4J internal id?

We are currently working with a Neo4j database, and we need some kind of id to identify nodes.
For example we have functions like CurrentUserHasAccess(NodeId)
On other Stackoverflow posts I read that it's a bad idea to use the internal neo4j-identifier, because it can change over time. However I think that's not an issue when we do not use this id to link data.
However I cannot seem to find any official sources about this topic.
I would like to use this ID because then we do not need to worry about uniqueness, and more importantly indexing.
You are right that it is generally not recommended to use the internal Neo4j node IDs. This is mainly because if a node gets deleted, its original internal ID may get recycled/reused. If you're looking for a quick and elegant solution to this, have a look at the UUID module of the GraphAware Framework here https://github.com/graphaware/neo4j-uuid and let us know if it works for you.

Volusion API - How to retrieve orders by date

I am making a call to the volusion api generic order export and I want to be able to only get orders for a single day however the date it is being compared to is a full timestamp stored in the volusion database so you'd have to have the entire timestamp and not just d/mm/yyyy. Seems like it is impossible to pull orders by date via the api. If anyone has experience with the generic orders export with the Volusion api your help would be much appreciated.
You cannot do this directly via the Volusion API as you have already stated.
You can however run a stored SQL query. The method to do this is explained here...
https://stackoverflow.com/a/29134928/357034
You just have to create your specific SQL query which returns the data you require.
For other who might come along later... I had the same error and I believe I solved the problem by switching the user to SuperAdmin rights.

Synchronization with RestKit

I'm about to write a simple iPhone app that uses Core Data to store local copy of remote data that is fetched via RESTful web service. The data changes (new records being added) quite often. I came across RestKit and I'm wondering if it can do what I need. And what I need is to load all records in the beginning and then periodically download ONLY records that were added since previous check. Obviously there is no mystery about how that can be accomplished even by simply using NSURLConnection, but I hoped RestKit (probably in combination with a proper web service) would do that without me having to write all the synchronization logic. Again the key for me is that only new/changed data is fetched from the server.
I agree - RestKit can do this, we've recently used it to do something similar in a recent project. We used a last-modified-date request header to indicate the last successful 'sync' time, which the server can use to return only the records modified since that date. A http 304 'not modified' status code was used to indicate no change when appropriate.
RestKit also includes a seeding facility, so you know up front the initial data set - you can seed it as the initial database easily, and fetch the updates, even upon first use of the application.
Some information I found useful regarding RestKit & CoreData mapping - https://github.com/RestKit/RestKit/blob/master/Docs/Object%20Mapping.md, and the Google group is a good source as well - https://groups.google.com/group/restkit. Hope this all helps.
First of all: YES
RestKit handles CoreData very well. All you need to do is to provide mapping of your entities and it does the work for you.
For the second thing about selective sync, I really recommend checking StorageRoomApp it is a great, and not so expensive service that does exactly what you need.
They have a very good API that extends RestKit, it is very easy to use and their support is great. Take a look.

Resources