-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfull_example.py
More file actions
86 lines (67 loc) · 3.12 KB
/
full_example.py
File metadata and controls
86 lines (67 loc) · 3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import requests
import json
from time import sleep
from datasources import ds_csv_1, ds_jdbc
result = requests.post('http://localhost:8080/simjoin/api/addsource',
data=json.dumps(ds_csv_1),
headers={'Content-Type':'application/json',
'accept': 'application/json'})
print(result.json())
id1 = result.json()[0]['id']
api_key = result.headers['id']
result = requests.post('http://localhost:8080/simjoin/api/appendsource',
data=json.dumps(ds_jdbc),
headers={'Content-Type':'application/json',
'accept': 'application/json',
'api_key': api_key})
print(result.json())
id2 = result.json()[0]['id']
result = requests.post('http://localhost:8080/simjoin/api/catalog',
data=json.dumps({}),
headers={'Content-Type':'application/json',
'accept': 'application/json',
'api_key': api_key})
print(result.json())
rm_json = { "id": id2}
result = requests.post('http://localhost:8080/simjoin/api/removesource',
data=json.dumps(rm_json),
headers={'Content-Type':'application/json',
'accept': 'application/json',
'api_key': api_key})
print(result.json())
result = requests.post('http://localhost:8080/simjoin/api/catalog',
data=json.dumps({}),
headers={'Content-Type':'application/json',
'accept': 'application/json',
'api_key': api_key})
print(result.json())
join_json = {
"limit": 50,
"params": {
"input_dataSource": id1,
"join_type": "knn",
"k": 2,
"max_lines": 100000,
"threshold": 0
}
}
result = requests.post('http://localhost:8080/simjoin/api/startjoin',
data=json.dumps(join_json),
headers={'Content-Type':'application/json',
'accept': 'application/json',
'api_key': api_key})
print(result.json())
get_json = { 'id': result.json()['id']}
result = requests.post('http://localhost:8080/simjoin/api/getstatus',
data=json.dumps(get_json),
headers={'Content-Type':'application/json',
'accept': 'application/json',
'api_key': api_key})
print(result.json())
sleep(3)
result = requests.post('http://localhost:8080/simjoin/api/getstatus',
data=json.dumps(get_json),
headers={'Content-Type':'application/json',
'accept': 'application/json',
'api_key': api_key})
print(result.json())