Introduction
The SimpleDB driver attempts to provide a unified interface to the SimpleDB service. While SimpleDB is not a relational database (nor does it attempt to function as one), this driver is designed to abstract the functionality of SimpleDB such as to provide a front-end which functions similarly to that of a relational database while maintaining as many features of the original back-end as possible.
Though the aforementioned attempts limit the functionality of SimpleDB in your application, the driver attempts to add value by both enforcing hard limits, as well as attempting to abstract some away (such as breaking up a write operation which hits the hard limit of 25 items in a BatchPutAttributes request).
Requirements
In order to run, the SimpleDB driver requires the following prerequisites:
cURL
Details
Shortcomings
In general, the length of names or values for attributes is not checked. When data is escaped, if a chunk of data is longer than 1024 bytes, it is automatically truncated.
Currently, there are no checks to ensure the number of comparisons made in a Fetch operation are within the hard limits imposed by Amazon.
Functions
Update
When updating, you cannot update _primary_key. Though this feature may be virtualized in the future, it is currently not a highly demanded (or useful) feature, and as such it is not included.
Notes
Hard Limits
Though the driver attempts to abstract away a lot of the limitations of SimpleDB, it is simply not possible to remove the hard limits imposed on data. The following concessions have been made to help prevent errors:
- String data is automatically truncated to 1024 bytes (to allow for overhead)
- Column (Attribute) names and item names are also truncated to 1024 characters
Write Transactions
When taking advantage of write transactions for a table, deletion operations will not be included in the buffer. As such, the following scenario will produce unexpected results:
- Write transaction initiated
- Item XYZ upserted with new values
- Item XYZ deleted
- Write transaction flushed
In this situation, Item XYZ will be deleted and subsequently recreated with the values upserted in the second action.
Asynchronous "Light" Operations
When an action takes place that does not return a result (such as running PutAttributes or DeleteAttributes), it is called as a "light" operation. In a light operation, the HTTP request is made asynchronous so as not to block code from running.
As such, an asynchronous operation may occur after the point it is otherwise expected to be completed by. Though it is a bad practice, it is sometimes necessary to access information that has been posted to the database immediately prior to the request (i.e.: recreating a table after it has been deleted). This sequence may not execute in the correct order as a result of these operations being asynchronous.
As an additional note, SimpleDB may have delays of up to a few minutes for information to fully propagate the servers at Amazon. As such, requesting information or changing information immediately after changing it in some way will likely not yield the expected results anyway.
Performance Concerns
Across the entire Cloud library, $no_quotes is an alternate parameter for any escape functions. It effectively accepts a boolean value which disables quote escaping (such as mysql_real_escape_quotes) and automatic quoting. This is to enable support for URL parameter data submission (such as with PutAttributes). Because string escaping for SimpleDB is unnecessary for parameter submission (string escapes simply involve escaping quotes or ticks and adding quotes or ticks), this may be removed in the future. The reason for including this functionality is for possible future escape procedures or for working with non-ASCII data. The performance implications are negligible, but if this functionality is not taken advantage of for some time, it can be removed.