我有2个表import cv2, os
import numpy as np
waves = {}
# Opens the Video file
cap=cv2.VideoCapture('8atpo.mp4')
num_of_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) #1586
def open_frame(frame_no):
while(cap.isOpened()):
cap.set(1,frame_no)
ret, frame = cap.read()
if ret == False:
break
# frame consists of 1078 arrays. One for each height pixel.
# each array consists of 1360 arrays. One for each width pixel.
# each array consits of 3 values. RGB??
return frame
def read_box(frame_no, nx1=0,nx2=2016,ny1=0,ny2=1600):
cframe = open_frame(frame_no) # two slowest parts
pframe = open_frame(frame_no - 1) # two slowest parts
diff_frame = cframe[nx1:nx2, ny1:ny2] - pframe[nx1:nx2, ny1:ny2]
return np.mean(diff_frame)
和 stage ("Notify Developers of Success"){
env.ForEmailPlugin = env.WORKSPACE
emailext attachmentsPattern: 'Checkmarx\\Reports\\*.pdf',
to: "${primaryOwnerEmail},${secondaryOwners}",
subject: "${env.JOB_NAME} - (${env.BUILD_NUMBER}) Finished Successfuly!",
body: "Check console output at ${env.BUILD_URL} to view the results"
}
表users
具有列post
和users
,该列包含格式为id
的数组-其中post
是表中的[1, 2, 3, 4, 5]
1, 2, 3, 4, 5
在表id
中,以下列post
和posts
表id
:
https://i.stack.imgur.com/ywdS7.png
表text
:
https://i.stack.imgur.com/IBdpb.png
在hasura中建立了数组关系
https://i.stack.imgur.com/311sd.png
接下来,我发出了以下请求
users
我希望收到这样的数据作为响应:
posts
但是有了这样的请求,我得到了跟踪。错误:
{
users_test {
postz {
id
}
}
}
我在做什么错,我该如何解决?
答案 0 :(得分:3)
一些建议:
{
users {
id
posts {
text
}
}
}
post
表上的users
列。您只需要user_id
表上的posts
列,以及使用posts
和{{}从users
表到user_id
表的外键约束表的1}}列。在此处查看文档:https://docs.hasura.io/1.0/graphql/manual/schema/relationships/database-modelling/one-to-many.html
id
数组列,则可以使用计算字段在json数组和另一个表的ID之间创建“关系”。https://docs.hasura.io/1.0/graphql/manual/schema/computed-fields.html#table-computed-fields
您的功能将:
进入json数组列
提取ID的
从表中id为id的表中返回* *
示例:
https://jsonb-relationships-hasura.herokuapp.com/console/api-explorer
位于https://jsonb-relationships-hasura.herokuapp.com/console/data/schema/public/tables/authors/modify
的计算字段定义运行以下查询:
post
# Get list of articles for each author
query {
authors {
id
name
articles
}
}