Index Out Of Range due to Datatype mismatch?

The various system.db.*query*() function calls deliver a PyDataset. Components use a non-python Dataset object. You must use the toDataSet() function to convert before assignment. In most cases, you can also use the .underlyingDataset property of a PyDataset to get the corresponding Dataset.