host='localhost', port=9000, user='******', password='******', database='TriaDB', trace=0) mis.connect_to_metastore(dbms='mariadb', host='localhost', port=3306, user='******', password='******', database='TRIADB', trace=0) # Get an overview of the DataResourcesSystem mis.get(what='datasets') # Initialize MIS with a data resource datres = mis.set_drs(242, 0) print(mis) print(datres, '\n', mis.drs) # General Overview datres.get(what='overview') # Data Resource Overview datres.get() # Tables and Fields datres.get_tables() datres.get_tables(out='objects') datres.get_tables(out='keys') datres.get_tables(out='dict')
# =========================================================================== # Create a Management Information System (MIS) object and connect to DBMS # =========================================================================== mis = MIS(debug=1) mis.connect_to_metastore(dbms='mariadb', host='localhost', port=3306, user='******', password='******', database='TRIADB', trace=0) mis.connect_to_datastore(dbms='clickhouse', host='localhost', port=9000, user='******', password='******', database='TriaDB', trace=0) # =========================================================================== # Select DataModel, DataResource, Start MIS # =========================================================================== mis.get(what='datasets') mis.get(what='models') mis.restart(200, 242) print(mis) # Parts, Columns, Engines, Info mis.get_parts(alias='hatom') mis.get_parts(alias='hatomStates') mis.get_parts(alias='hatomStates', hb2=12) mis.get_parts(alias='hlink') mis.get_parts(alias='Float32') mis.get_parts(table='DAT_242_1') mis.get_columns(alias='hatom') mis.get_columns(alias='hlink') mis.get_columns(alias='hlink', aggregate=True)
# ************************************************************************************************************ # ===================================================================== # Add MySQL databases # ===================================================================== # Supplier-Part-Catalog MySQL database mis.drs.add_dataset(cname='Supplier Part Catalogue in MySQL', alias='SPC_MySQL', ctype='MYSQL', db='SPC', descr='It is a toy database with three tables that form a many to many relationship ') # Northwind Traders MySQL database mis.drs.add_dataset(cname='Northwind Traders', alias='NORTHWIND', ctype='MYSQL', db='Northwind', descr='Northwind Traders Access database is a sample database that shipped with Microsoft Office') # ===================================================================== # Add Flat File DataSets # ===================================================================== ETL.change_cwd('/var/lib/clickhouse/user_files/demo/FlatFiles') # Supplier-Part-Catalog TSV flat files mis.drs.add_dataset(cname='Supplier Part Catalogue TSV flat files', alias='SPC_TSV', ctype='TSV', path=ETL.get_full_path('SupplierPartCatalog'), descr='Supplier, Part, Catalog and denormalized data') # ======================================================================== # Sanity test # ======================================================================== print(mis.get(what='overview'))
creating an instance of top level management information system object (MIS) get_entities(), get_attributes(), get() methods of triadb.subsystems.DataModelSystem switching and setting DataModelSystem objects (C) October 2019 By Athanassios I. Hatzis """ from triadb import MIS mis = MIS(debug=1) mis.connect_to_datastore(dbms='clickhouse', host='localhost', port=9000, user='******', password='******', database='TriaDB', trace=0) mis.connect_to_metastore(dbms='mariadb', host='localhost', port=3306, user='******', password='******', database='TRIADB', trace=0) # Get an overview of the DataModelSystem mis.get(what='models') # Initialize MIS with a data model datmodel = mis.set_dms(alias='SPC') print(mis) print(datmodel, '\n', mis.dms) # General Overview datmodel.get(what='overview') # Data Model Overview datmodel.get() # Entities and Attributes datmodel.get_entities() datmodel.get_attributes() datmodel.get_attributes(select='dim4, dim3, dim2, alias') datmodel.get_attributes(select='dim4, dim3, dim2, alias, vtype, junction', index='dim4, dim3, dim2')