24 new_tables = [
'tsdb',
'tsdb-uid',
'tsdb-tree',
'tsdb-meta']
26 connection = happybase.Connection(host=host, port=port)
27 existing_tables = connection.tables()
31 if (table ==
'tsdb')
or (table ==
'tsdb-tree'):
32 families = {
't': dict(max_versions=1, compression=
'none',
33 bloom_filter_type=
'ROW')}
34 elif table ==
'tsdb-uid':
35 families = {
'id': dict(compression=
'none', bloom_filter_type=
'ROW'),
36 'name': dict(compression=
'none', bloom_filter_type=
'ROW')}
37 elif table ==
'tsdb-meta':
38 families = {
'name': dict(compression=
'none', bloom_filter_type=
'ROW')}
40 sys.exit(
"Unknown table {} was requested.".
format(table))
42 print "Creating {}".
format(table)
43 connection.create_table(table, families)
44 if table
not in connection.tables():
45 sys.exit(
"Could not create {}".
format(table))
48 for table
in new_tables[:]:
49 if table
in existing_tables:
50 print "{} exist".
format(table)
51 new_tables.remove(table)
53 if len(new_tables) > 0:
54 for table
in new_tables:
57 print "All OpenTSDB tables already created"