The following is an example of using the API to create a scanner and read data from an accumulo instance.

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
from accumulo import *
 
from argparse import ArgumentParser
from ctypes import cdll
import ctypes
 
 
 
parser = ArgumentParser()
parser.add_argument("-d", "--dll", dest="dll_file",
                    help="DLL filename", metavar="FILE")
parser.add_argument("-i", "--instance", dest="instance",
                    help="DLL filename")
parser.add_argument("-z", "--zookeepers", dest="zookeepers",
                    help="DLL filename")
parser.add_argument("-u", "--username", dest="username",
                    help="DLL filename")
parser.add_argument("-p", "--password", dest="password",
                    help="DLL filename")
args = parser.parse_args()
 
""" dll_file is the path to the shared object """
conn = Conector(dll_file=args.dll_file, instance = args.instance, zookeepers = args.zookeepers, user = args.username, password = args.password)
 
tabletocreate = "blahblah3".encode('utf-8')
 
tableOps = conn.create_table(tabletocreate)
 
writer = conn.create_writer(tableOps,2)
 
mutation = writer.createMutation("blah")
 
mutation.put("cf","cq","")
 
mutation.put("cf2","cq","")
 
writer.addMutation(mutation)
 
writer.close()