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)
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)
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")
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")
def extract_locale(args): raise NotImplementedError("Temporarily disabled.") model = cubes.model_from_path(args.model) print(json.dumps(model.localizable_dictionary()))
def setUp(self): self.model_path = os.path.join(cubes.tests.tests_path, 'model') self.model = cubes.model_from_path(self.model_path)
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")
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"
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)