tombuildsstuff/giovanni

Query returns empty set when query existing entity with existing (primary key, row key) pair

Murphy-OrangeMud opened this issue · 0 comments

	entitiesClient := entities.New()
	entitiesClient.Client.Authorizer = storageAuth

	// what is partition key and row key
	input := entities.InsertEntityInput {
		PartitionKey: "abcabc1",
		RowKey: "123acb1",
		MetaDataLevel: entities.NoMetaData,
		Entity: map[string]interface{} {
			"company": "Microsoft",
			"department": "ADG",
		},
	}
	query := entities.QueryEntitiesInput {
		PartitionKey: "abcabc1",
		RowKey: "123acb1",
		MetaDataLevel: entities.NoMetaData,
	}
	if _, err := entitiesClient.Insert(ctx, accountName, tableName, input); err != nil {
		fmt.Printf("Error creating Entity: %s", err)
	}

	qresult, err := entitiesClient.Query(ctx, accountName, tableName, query)
	if err != nil {
		fmt.Printf("Error querying Entity: %s", err)
	}
	fmt.Printf("%v\n %v\n", *(qresult.Response.Response), qresult.Entities)

	return

The result is:

{200 OK 200 HTTP/1.1 1 1 map[Cache-Control:[no-cache] Content-Type:[application/json;odata=nometadata;streaming=true;charset=utf-8] Date:[Wed, 18 Aug 2021 07:43:05 GMT] Etag:[W/"datetime'2021-08-18T07%3A43%3A04.7865159Z'"] Server:[Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0] X-Content-Type-Options:[nosniff] X-Ms-Request-Id:[471b80b6-b002-0002-5b04-947141000000] X-Ms-Version:[2020-08-04]] 0xc0000743c0 -1 [chunked] false false map[] 0xc000492100 0xc0000b6370}
 []