forked from slowenthal/cql_kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
57 lines (36 loc) · 1.54 KB
/
test.py
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
from cql_kernel.kernel import CQLKernel
from cqlshlib.cql3handling import CqlRuleSet
cqlkernel = CQLKernel.instance()
def cutcode(code):
index = code.rfind(' ')
completed = code[:index+1]
partial = code[index+1:]
print 'completed: "%s"' % completed
print 'partial: "%s"' % partial
completions = CqlRuleSet.cql_complete(completed, partial, cassandra_conn=cqlkernel,
startsymbol='cqlshCommand')
print completions
cutcode("create")
cutcode("create ")
cutcode("create t")
# foo = cqlkernel.do_execute("select * from system.local xxx;", False)
foo = CqlRuleSet.cql_complete("CREATE", "", cassandra_conn=cqlkernel,
startsymbol='cqlshCommand')
print foo
foo = CqlRuleSet.cql_complete("CREATE ", "T", cassandra_conn=cqlkernel,
startsymbol='cqlshCommand')
print foo
foo = CqlRuleSet.cql_complete( "USE", "", cassandra_conn=cqlkernel,
startsymbol='cqlshCommand')
print foo
foo = CqlRuleSet.cql_complete( "", "CREATE", cassandra_conn=cqlkernel,
startsymbol='cqlshCommand')
print foo
foo = CqlRuleSet.cql_complete( "CREATE ", "", cassandra_conn=cqlkernel,
startsymbol='cqlshCommand')
print foo
foo = cqlkernel.cqlshell.onecmd("consistency quorum;")
foo = cqlkernel.cqlshell.onecmd("help;")
foo = cqlkernel.cqlshell.onecmd("select * from system.localsdf;")
foo = cqlkernel.cqlshell.onecmd("describe keyspace retail;")
x = 10