#!/usr/bin/env python

import sys

LETTERS = '0123456789abcdef'

def create_table_for_node(node, create_table_template):
    for letter1 in LETTERS:
        for letter2 in LETTERS:
            newtable = '%s_%s%s' % (node, letter1, letter2)
            print create_table_template.replace('@TABLE_NAME@', newtable)

if __name__ == '__main__':
    SQL_CREATE_TABLE_TEMPLATE_FILENAME = 'sql/CreateTableTemplate.sql'
    create_table_template = ''
    for line in open(SQL_CREATE_TABLE_TEMPLATE_FILENAME):
        create_table_template += line

    print 'CREATE DATABASE IF NOT EXISTS DisksMonitoring;'
    print 'USE DisksMonitoring;'

#    for node in open('/home/panstarrs/schastel/local/share/ippMhpccStorageNodes'):
    for node in ['ipp004\n']:
        sys.stderr.write('%s\n' % node)
        create_table_for_node( node[:-1], 
                               create_table_template)

