|
| 1 | +__author__ = 'stephanie' |
| 2 | + |
| 3 | +import matplotlib.pyplot as plt |
| 4 | +from matplotlib import dates |
| 5 | +import pprint |
| 6 | +from api.ODMconnection import dbconnection |
| 7 | +from api.ODM1_1_1.services import SeriesService |
| 8 | + |
| 9 | + |
| 10 | +# Create a connection to the ODM2 database |
| 11 | +# ---------------------------------------- |
| 12 | + |
| 13 | +#createconnection (dbtype, servername, dbname, username, password) |
| 14 | +#session_factory = dbconnection.createConnection('mysql', 'localhost', 'odm2', 'ODM', 'odm') |
| 15 | +session_factory = dbconnection.createConnection('mysql', 'jws.uwrl.usu.edu', 'odm2', 'ODM', 'ODM123!!', 2) |
| 16 | + |
| 17 | + |
| 18 | +#ODM1 DB |
| 19 | +#conn = dbconnection.createConnection('mysql', 'jws.uwrl.usu.edu', 'odm', "ODM", "ODM123!!", 1.1) |
| 20 | + |
| 21 | +pp = pprint.PrettyPrinter(indent=8) |
| 22 | + |
| 23 | +print |
| 24 | +print "************************************************" |
| 25 | +print "\t\tODM2 -> ODM1 Demo: " |
| 26 | +print "************************************************" |
| 27 | +print |
| 28 | + |
| 29 | +odm1service = SeriesService(session_factory) |
| 30 | +pp.pprint(session_factory) |
| 31 | + |
| 32 | +print |
| 33 | +print "************************************************" |
| 34 | +print "\t\tUnits: get_all_units()" |
| 35 | +print "************************************************" |
| 36 | +print |
| 37 | + |
| 38 | +pp.pprint(odm1service.get_all_units()) |
| 39 | + |
| 40 | +print |
| 41 | +print "************************************************" |
| 42 | +print "\t\tSites: get_all_sites()" |
| 43 | +print "************************************************" |
| 44 | +print |
| 45 | + |
| 46 | +pp.pprint(odm1service.get_all_sites()) |
| 47 | + |
| 48 | +print |
| 49 | +print "************************************************" |
| 50 | +print "\t\tMethods: get_all_methods()" |
| 51 | +print "************************************************" |
| 52 | +print |
| 53 | + |
| 54 | +pp.pprint(odm1service.get_all_methods()) |
| 55 | + |
| 56 | +print |
| 57 | +print "************************************************" |
| 58 | +print "\t\tVariables: get_all_variables()" |
| 59 | +print "************************************************" |
| 60 | +print |
| 61 | + |
| 62 | +pp.pprint(odm1service.get_all_variables()) |
| 63 | + |
| 64 | +print |
| 65 | +print "************************************************" |
| 66 | +print "\t\tData Sources: get_all_Source()" |
| 67 | +print "************************************************" |
| 68 | +print |
| 69 | + |
| 70 | +pp.pprint(odm1service.get_all_sources()) |
| 71 | + |
| 72 | + |
| 73 | +print |
| 74 | +print "************************************************" |
| 75 | +print "\t\tData Values: get_all_series()" |
| 76 | +print "************************************************" |
| 77 | +print |
| 78 | + |
| 79 | +pp.pprint(odm1service.get_all_series()) |
| 80 | + |
| 81 | + |
| 82 | +print |
| 83 | +print "************************************************" |
| 84 | +print "\t\tData Values: get_all_DataValues()" |
| 85 | +print "************************************************" |
| 86 | +print |
| 87 | + |
| 88 | +pp.pprint(odm1service.get_values_by_series(1)) |
| 89 | + |
0 commit comments