-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.visidatarc
43 lines (42 loc) · 1.3 KB
/
.visidatarc
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
import visidata
@VisiData.api
def openurl_yottadb(vd, path, filetype='None'):
return Yotta(path.name, source=path)
class Yotta(Sheet):
def iterload(self):
import mg_python
import sys
sect=str(self.source).split("/")
glbal=sect[3]
hostport=sect[2]
hostport1=hostport.split(":")
host=hostport1[0]
port=hostport1[1]
delim=sect[4]
try:
mg_python.m_set_host(0, host, int(port), "", "")
except:
sys.exit(1)
try:
key = mg_python.m_order(0, glbal, "")
except:
sys.exit(1)
if key == "":
sys.exit(1)
bits=mg_python.m_get(0, glbal, key).split(delim)
count=0
self.columns = []
self.addColumn(Column(key, getter=lambda col, row: row[0]))
while count < len(bits):
cmd = "self.addColumn(Column('" + bits[count] + "', getter=lambda col, row: row[" + str(count+1) + "]))"
eval(cmd)
count+=1
self.rows = []
key = mg_python.m_order(0, glbal, key)
MyList=[]
while key != "":
stryng=key + delim + mg_python.m_get(0, glbal, key)
bits=stryng.split(delim)
MyList.append(bits)
key = mg_python.m_order(0, glbal, key)
yield from Progress(MyList, total=len(MyList))