我有2个csv文件。
Person.csv
ID,PetID,Jumps
1,101,Yes
2,102,No
3,103,Yes
Pet.csv
ID,Name
101,Dog
102,Cat
103,Rabbit
我正在编写ETL以使用这两个实体填充我的图表。 我想在Person和Pet之间添加一个HAS_PET边。我也希望这个边缘有一个名为Jumps的属性。我怎样才能做到这一点?
我尝试了如下,
{
"source":{
"file":{
"path":"C:/Users/60886/Project/person.csv"
}
},
"extractor":{
"row":{
}
},
"transformers":[
{
"csv":{
}
},
{
"vertex":{
"class":"Person"
}
},
{
"edge":{
"class":"HAS_PET",
"joinFieldName":"PETID",
"lookup":"PET.ID",
"direction":"out",
"unresolvedLinkAction":"NOTHING"
}
}
],
"loader":{
"orientdb":{
"dbURL":"remote:localhost/GratefulDeadConcerts",
"dbType":"graph",
"wal":false,
"tx":false,
"batchCommit":1000
}
}
}
答案 0 :(得分:2)
在边缘变换器中使用<form action="" method="POST" id="payment-form">
<span class="payment-errors"></span>
<div class="form-row">
<label>
<span>Card Number</span>
<input type="text" size="20" data-stripe="number"/>
</label>
</div>
<div class="form-row">
<label>
<span>CVC</span>
<input type="text" size="4" data-stripe="cvc"/>
</label>
</div>
<div class="form-row">
<label>
<span>Expiration (MM/YYYY)</span>
<input type="text" size="2" data-stripe="exp-month"/>
</label>
<span> / </span>
<input type="text" size="4" data-stripe="exp-year"/>
</div>
<button type="submit">Submit Payment</button>
</form>
<?php
require '../stripe-php/init.php';
//this next line is very wrong
$post = 'client_secret=['sk_07C5ukIdqx'].'&grant_type=authorization_code&code='.$_GET['code'];
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $system['stipe']['token_url']);
curl_setopt($ch,CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
$decode = json_decode($result);
\Stripe\Stripe::setApiKey("my_secret");
\Stripe\Charge::create(array(
"amount" => 500,
"currency" => "usd",
"source" => $decode[2], // I am totally guessing the value will be in element #2
"description" => "Charge for test@example.com"
));
来绑定边缘中的属性。例如:
edgeFields
请记住在边缘变换器之后从顶点删除“跳转”,使用:
"edge":{
"class":"HAS_PET",
"joinFieldName":"PETID",
"lookup":"PET.ID",
"direction":"out",
"edgeFields": { "Jumps": "${input.Jumps}" },
"unresolvedLinkAction":"NOTHING"
}