awslabs / amazon-qldb-driver-dotnet

Apache License 2.0
9 stars 16 forks source link

[question] Paging #345

Open victor-nerdunited opened 9 months ago

victor-nerdunited commented 9 months ago

If my query results return over 200 documents, I get a 405 error (No open transaction). I noticed if I use the console in AWS the call to ExecuteStatement returns a response that has a NextPageToken field. I assume this is what would be used for paing (like Google BigQuery or Azure Cosmos DB). Is this something that is on the roadmap to be implemented in the driver?

trstephen-amazon commented 7 months ago

Hi @victor-nerdunited , thanks for letting us know (and apologies for the delay!)

I tried to reproduce the behavior with an integration test

[TestMethod]
public void Execute_ManyDocuments_NoFetchError()
{
    Logger.Info($"Seeding documents in {Constants.TableName}");

    var insertQuery = $"INSERT INTO {Constants.TableName} ?";
    Enumerable.Range(1, 250).ToList().ForEach(i =>
    {
        var ionStruct = ValueFactory.NewEmptyStruct();
        ionStruct.SetField(Constants.ColumnName, ValueFactory.NewInt(i));

        qldbDriver.Execute(txn => txn.Execute(insertQuery, ionStruct));
    });

    Logger.Info($"Finished seeding {Constants.TableName}");

    var selectQuery = $"SELECT * FROM {Constants.TableName}";
    int docCount = qldbDriver.Execute(txn => txn.Execute(selectQuery).ToList().Count);

    Assert.AreEqual(250, docCount);
}

This passed without issue. I added some extra logging (and sniffed around on the backend) to verify that FetchPage [code, docs] was used. As expected, I see a single FetchPage call for the additional 50 results.

Are you able to share code that can reproduce the error?

edit: I wrote a similar test for the async driver. Again, couldn't reproduce the failure