Answered Projection Error Message

  • 2011年10月6日 下午 03:06
     
     

    Hello,

    i tried to minimize the selected data using projection:

    http://blogs.msdn.com/b/windowsazurestorage/archive/2011/09/15/windows-azure-tables-introducing-upsert-and-query-projection.aspx

    I tried the anonymus Version:

                    DateTime interval = DateTime.UtcNow.AddDays(-14).Date;
                    var query = from data in _Context.CreateQuery<CloudUserSelectEntity>(_CloudUserSelectTable)
                                where data.CreateDate >= interval && data.IsContract == false
                                select new
                                {
                                    data.PartitionKey
                                };

                    foreach (var cude in query)
                    {
                        System.Diagnostics.Debug.Print(cude.PartitionKey);
                    }

    and the type based version:

                    DateTime interval = DateTime.UtcNow.AddDays(-14).Date;
                    var query = from data in _Context.CreateQuery<CloudUserSelectEntity>(_CloudUserSelectTable)
                                where data.CreateDate >= interval && data.IsContract == false
                                select new CloudUserSelectEntity
                                {
                                    PartitionKey = data.PartitionKey
                                };

                    foreach (CloudUserSelectEntity cude in query)
                    {
                        System.Diagnostics.Debug.Print(cude.PartitionKey);
                    }

    but it always gives me an error: [One of the request inputs is not valid.]

    Query: {http://127.0.0.1:10002/devstoreaccount1/CloudUserSelect()?$filter=(CreateDate ge datetime'2011-09-22T00:00:00Z') and (IsContract eq false)&$select=PartitionKey}

    It also does not work if the where clause is removed.

    If i select the whole Entity:

                DataServiceQuery<CloudUserSelectEntity> dsq = (from data in _Context.CreateQuery<CloudUserSelectEntity>(_CloudUserSelectTable)
                                                               where data.CreateDate >= interval && data.IsContract == false
                                                               select data) as DataServiceQuery<CloudUserSelectEntity>;

    this works.

    Target Framework is v4, i am using Development storage.

    Any Ideas or did i missed something?

    Thanks Martin

所有回覆

  • 2011年10月6日 下午 05:46
     
     

    Hi,

    Please note that projections are still not supported in the development storage (http://msdn.microsoft.com/en-us/library/dd179421.aspx). That could be the reason of this error.

    Hope this helps.

    Thanks

    Gaurav Mantri

    Cerebrata Software

    http://www.cerebrata.com

     

  • 2011年10月7日 上午 08:40
     
     

    Hi,

    thanks for your hint, i missed that.

    I tried to use the Azure Environment, from my development machine but it gives me the same error for the request:

    {https://xxx.table.core.windows.net/CloudUserSelect()?$filter=(CreateDate ge datetime'2011-09-23T00:00:00Z') and (IsContract eq false)&$select=PartitionKey}

    There is no difference if i remove the params or select PartitionKey and RowKey.

    Thanks,

    Martin

     

  • 2011年10月10日 上午 02:02
     
     

    Hi Martin,

     Can you give us the error details? Please send the below info to jharidas @ microsoft.

    1> Account name, Request id (x-ms-request-id header in response), date time of teh request

    2> error details

    We will have a look and get back.

    -Jai

  • 2012年2月21日 上午 08:35
     
     已答覆

    Sorry - realized that we did not close this thread. The problem here was that the version 2011-08-18 was not being set using the sending request event.