我有一个名为Track的DynamoDb表,其中包含分区键' id' (字符串)和排序键'时间戳' (数字),以毫秒为单位。数据每5秒插入一次。
现在我想获取数据,结果每小时有一个项目而不是全部。
如何查询数据库?
我正在使用python和boto3库。
我的表格如下:
function url2obj(url) {
var pattern = /^(?:([^:\/?#\s]+):\/{2})?(?:([^@\/?#\s]+)@)?([^\/?#\s]+)?(?:\/([^?#\s]*))?(?:[?]([^#\s]+))?\S*$/;
var matches = url.match(pattern);
var params = {};
if (matches[5] != undefined) {
matches[5].split('&').map(function(x){
var a = x.split('=');
params[a[0]]=a[1];
});
}
return {
protocol: matches[1],
user: matches[2] != undefined ? matches[2].split(':')[0] : undefined,
password: matches[2] != undefined ? matches[2].split(':')[1] : undefined,
host: matches[3],
hostname: matches[3] != undefined ? matches[3].split(/:(?=\d+$)/)[0] : undefined,
port: matches[3] != undefined ? matches[3].split(/:(?=\d+$)/)[1] : undefined,
segments : matches[4] != undefined ? matches[4].split('/') : undefined,
params: params
};
}
console.log(url2obj("protocol://user:password@hostname:12345/segment1/segment2?p1=val1&p2=val2"));
console.log(url2obj("http://hostname"));
console.log(url2obj(":password@"));
console.log(url2obj("?p1=val1"));
console.log(url2obj("ftp://usr:pwd@[FFF::12]:345/testIP6"));
数据看起来像这样: