I have built an appender that writes Log4Net logs to a SimpleDB table/domain called LogTable. I am now trying to write a windows service which will delete old records from this table. The AmazonSimpleDB client is definitely being created and the query when run manually does return records. However when the code is executed through a unit test no results are returned. The table and column name case sensitivity are correct.
using (AmazonSimpleDB simpleDbClient = AWSClientFactory.CreateAmazonSimpleDBClient(accessKey, secretKey))
{
String selectExpression = String.Format("select * from LogTable where Timestamp < '{0:o}'", purgeDate);
SelectRequest selectRequestAction = new SelectRequest().WithSelectExpression(selectExpression);
SelectResponse selectResponse = simpleDbClient.Select(selectRequestAction);
if (selectResponse.IsSetSelectResult())
{
BatchDeleteAttributesRequest deleteRequest = new BatchDeleteAttributesRequest().WithDomainName("LogTable");
deleteRequest.Item = new List<DeleteableItem>();
SelectResult selectResult = selectResponse.SelectResult;
foreach (Item item in selectResult.Item)
{
deleteRequest.Item.Add(new DeleteableItem { ItemName = item.Name });
}
if (deleteRequest.Item.Count > 0)
{
simpleDbClient.BatchDeleteAttributes(deleteRequest);
}
logger.InfoFormat("Success - {0} log records deleted from LogTable", deleteRequest.Item.Count);
}
}
Would really appreciate some help on this one.