Exemplo n.º 1
0
    def test_model_from_path(self):
        model = cubes.model_from_path(self.model_path)
        self.assertEqual(model.name, "public_procurements", "Model was not properely loaded")
        self.assertEqual(len(model.dimensions), 6, "Model dimensions were not properely loaded")
        self.assertEqual(len(model.cubes), 1, "Model cubes were not loaded")
        cube = model.cubes.get("contracts")
        self.assertNotEqual(None, cube, 'No expected "contracts" cube found')
        self.assertEqual(cube.name, "contracts", "Model cube was not properely loaded")

        self.assertModelValid(model)
Exemplo n.º 2
0
def translate_model(args):
    raise NotImplementedError("Temporarily disabled.")
    model = cubes.model_from_path(args.model)
    trans_path = args.translation

    with open(trans_path) as f:
        trans_dict = json.load(f)

    model = model.localize(trans_dict)
    dump_model(model)
Exemplo n.º 3
0
def translate_model(args):
    raise NotImplementedError("Temporarily disabled.")
    model = cubes.model_from_path(args.model)
    trans_path = args.translation

    with open(trans_path) as f:
        trans_dict = json.load(f)

    model = model.localize(trans_dict)
    dump_model(model)
Exemplo n.º 4
0
    def test_model_from_path(self):
        model = cubes.model_from_path(self.model_path)

        self.assertEqual(model.name, "public_procurements")
        self.assertEqual(len(model.dimensions), 6)
        self.assertEqual('cpv', model.dimension('cpv').name)
        self.assertEqual(len(model.cubes), 1)

        cube = model.cube("contracts")
        self.assertNotEqual(None, cube)
        self.assertEqual(cube.name, "contracts")
Exemplo n.º 5
0
    def test_model_from_path(self):
        model = cubes.model_from_path(self.model_path)

        self.assertEqual(model.name, "public_procurements")
        self.assertEqual(len(model.dimensions), 6)
        self.assertEqual('cpv', model.dimension('cpv').name)
        self.assertEqual(len(model.cubes), 1)

        cube = model.cube("contracts")
        self.assertNotEqual(None, cube)
        self.assertEqual(cube.name, "contracts")
Exemplo n.º 6
0
 def setUp(self):
     self.model_path = os.path.join(DATA_PATH, 'model.json')
     self.model = cubes.model_from_path(self.model_path)
     self.cube = self.model.cubes.get("contracts")
Exemplo n.º 7
0
def extract_locale(args):
    raise NotImplementedError("Temporarily disabled.")
    model = cubes.model_from_path(args.model)
    print(json.dumps(model.localizable_dictionary()))
Exemplo n.º 8
0
def extract_locale(args):
    raise NotImplementedError("Temporarily disabled.")
    model = cubes.model_from_path(args.model)
    print(json.dumps(model.localizable_dictionary()))
Exemplo n.º 9
0
 def setUp(self):
     self.model_path = os.path.join(DATA_PATH, 'model.json')
     self.model = cubes.model_from_path(self.model_path)
     self.cube = self.model.cubes.get("contracts")
Exemplo n.º 10
0
 def setUp(self):
     self.model_path = os.path.join(cubes.tests.tests_path, 'model')
     self.model = cubes.model_from_path(self.model_path)
Exemplo n.º 11
0
 def setUp(self):
     self.model_path = os.path.join(cubes.tests.tests_path, 'model')
     self.model = cubes.model_from_path(self.model_path)
     self.cube = self.model.cubes.get("contracts")
Exemplo n.º 12
0
 def setUp(self):
     self.model_path = os.path.join(DATA_PATH, 'model.json')
     self.model = cubes.model_from_path(self.model_path)
     self.cube = self.model.cubes["contracts"]
     self.browser = cubes.AggregationBrowser(self.cube)
import sqlalchemy
import cubes

# Config
model_path = "model.json"
db_connect = "mysql://*****:*****@localhost:3306/datashuttle"
cube_name = "mortality"

# Load cube
model = cubes.model_from_path(model_path)
engine = sqlalchemy.create_engine(db_connect)
connection = engine.connect()
cube = model.cube(cube_name)

# Build view
builder = cubes.backends.SQLDenormalizer(cube, connection)
builder.create_view("view_" + cube_name, materialize=True)

print "Successfully created view\n"
Exemplo n.º 14
0
 def setUp(self):
     self.model_path = os.path.join(cubes.tests.tests_path, 'model')
     self.model = cubes.model_from_path(self.model_path)
     self.cube = self.model.cubes["contracts"]
     self.browser = cubes.AggregationBrowser(self.cube)