Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用getRow查询单行无返回结果 #65

Open
grapewheel opened this issue Sep 14, 2023 · 0 comments
Open

使用getRow查询单行无返回结果 #65

grapewheel opened this issue Sep 14, 2023 · 0 comments

Comments

@grapewheel
Copy link

使用getRow单行查询:

const tableStoreService = await useInject(TableStoreService)

const result = await tableStoreService.getRow({
    tableName: 'install',
    primaryKey: [{ sn: 'I2023091317390264223' }],
    maxVersions: 1,
})

返回(无结果):

 {
    "consumed": {
      "capacityUnit": {
        "read": 1,
        "write": 0
      }
    },
    "row": ""
  }

使用BatchGetRow多行查询:

const tableStoreService = await useInject(TableStoreService)

const result = await tableStoreService.batchGetRow({
      tables: [
	      {
		      tableName: 'install',
		      primaryKey: [
			      [{ sn: 'I2023091317390264223' }]
		      ],
		      maxVersions: 1,
	      },
      ],
})

返回(有结果):

{
    "tables": [
      [
        {
          "isOk": true,
          "errorCode": null,
          "errorMessage": null,
          "tableName": "install",
          "capacityUnit": {
            "read": 1,
            "write": 0
          },
          "primaryKey": [
            {
              "name": "sn",
              "value": "I2023091317390264223"
            }
          ],
          "attributes": [
            {
              "columnName": "electricPrice",
              "columnValue": 0.8,
              "timestamp": 1694597943098
            },
           ...
          ]
        }
      ]
    ],
}

使用阿里云tablestore后台是能查询的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant