示例#1
0
文件: Demo.py 项目: Castronova/EMIT
from ODM2.Core.services import readCore as CSread
from ODM2.Core.services import CoreServices
from ODM2.SamplingFeatures.services import readSamplingFeatures as SFread
from ODM2.Results.services import readResults as Rread

from ODMconnection import dbconnection


# create connection to the database
conn = dbconnection.createConnection("mssql", "(local)", "TestODM2", "ODM", "odm")
# conn = dbconnection.createConnection('postgresql', 'castro-server.bluezone.usu.edu', 'ODM2', 'postgres', 'postgres')

# create a connection for each of the schemas. Currently the schemas each of a different
# connection but it will be changed to all the services sharing a connection
core_read = CSread(conn)
core = CoreServices(conn)
result_read = Rread(conn)
sampfeat_read = SFread(conn)


# run some basic sample queries.
vars = core.read.getAllVariables()
print "Get all variable: ", vars
people = core_read.getAllPersons()
print "Get all People: ", people

sfs = core_read.getAllSamplingFeatures()
print "Get all SamplingFeatures: ", sfs
temp = sfs[0]
print temp.SamplingFeatureCode
示例#2
0
from ODM2.DataQuality.model import Dataquality


from ODMconnection import dbconnection





#conn = dbconnection.createConnection('mssql', '(local)', 'TestODM2', 'ODM', 'odm')
conn = dbconnection.createConnection('postgresql', 'localhost:5432', 'TestODM2', 'postgres', 'odm')



cs = CSread(conn)
sf = SFread(conn)
dq =DQread(conn)
anno = Annoread(conn)
eq = EQread(conn)
pr = PRread(conn)
ep = EPread(conn)
ei = EIread(conn)
la = LAread(conn)
r = Rread(conn)
cv = CVread(conn)
s = Sread(conn)
#print "Get Geometry Test 1: ",cs.getGeometryTest()
print "Get all equipment: " ,eq.getAllEquipment()
print "Get all dataquality: " ,dq.getAllDataQuality()
print "Get all variable: " ,cs.getAllVariables()
示例#3
0
文件: Demo.py 项目: twhiteaker/ODM2
from ODM2.CV.services import readCV as CVread

from ODM2.DataQuality.model import Dataquality


from ODMconnection import dbconnection




conn = dbconnection.createConnection('postgresql', 'castro-server.bluezone.usu.edu', 'ODM2', 'postgres', 'postgres')


#create a connection for each of the schemas. Currently the schemas each of a different
#connection but it will be changed to all the services sharing a connection
cs = CSread(conn)
sf = SFread(conn)
dq =DQread(conn)
anno = Annoread(conn)
eq = EQread(conn)
pr = PRread(conn)
ep = EPread(conn)
ei = EIread(conn)
la = LAread(conn)
r = Rread(conn)
cv = CVread(conn)
s = Sread(conn)



示例#4
0
文件: Demo.py 项目: LejoFlores/ODM2
directory = os.path.dirname(this_file)
sys.path.insert(0, directory)

# Create a connection to the ODM2 database
# ----------------------------------------
conn = dbconnection.createConnection('mysql', 'localhost', 'odm2', 'ODM',
                                     'ODM123!!')
#conn = dbconnection.createConnection('mysql', 'jws.uwrl.usu.edu', 'odm2', 'ODM', 'ODM123!!')
#conn = dbconnection.createConnection('mssql', '(local)', 'ODM2SS', 'ODM', 'odm')
#conn = dbconnection.createConnection('postgresql', 'arroyo.uwrl.usu.edu:5432', 'ODMSS', 'Stephanie', 'odm')
#conn = dbconnection.createConnection('mysql', '127.0.0.1:3306', 'ODM2', 'Stephanie', 'odm')

# Create a connection for each of the schemas. Currently the schemas each have a different
# connection but it will be changed to all the services sharing a connection
# ----------------------------------------------------------------------------------------
core_read = CSread(conn)
core = CoreServices(conn)
result_read = Rread(conn)
sampfeat_read = SFread(conn)

# Run some basic sample queries.
# ------------------------------
# Get all of the variables from the database and print their names to the console
allVars = core.read.getVariables()
numVars = len(allVars)
print "\n------------ Simple Variables Query ---------------"
print "There are " + str(
    numVars
) + " Variables in the ODM2 database retrieved using getVariables()."
print "The list of variables includes:"
for x in allVars:
示例#5
0
文件: Demo.py 项目: MachineAi/EMIT
from ODM2.Core.services import readCore as CSread
from ODM2.Core.services import CoreServices
from ODM2.SamplingFeatures.services import readSamplingFeatures as SFread
from ODM2.Results.services import readResults as Rread

from ODMconnection import dbconnection

#create connection to the database
conn = dbconnection.createConnection('mssql', '(local)', 'TestODM2', 'ODM',
                                     'odm')
#conn = dbconnection.createConnection('postgresql', 'castro-server.bluezone.usu.edu', 'ODM2', 'postgres', 'postgres')

#create a connection for each of the schemas. Currently the schemas each of a different
#connection but it will be changed to all the services sharing a connection
core_read = CSread(conn)
core = CoreServices(conn)
result_read = Rread(conn)
sampfeat_read = SFread(conn)

#run some basic sample queries.
vars = core.read.getAllVariables()
print "Get all variable: ", vars
people = core_read.getAllPersons()
print "Get all People: ", people

sfs = core_read.getAllSamplingFeatures()
print "Get all SamplingFeatures: ", sfs
temp = sfs[0]
print temp.SamplingFeatureCode
val = core.read.getSamplingFeatureByCode(temp.SamplingFeatureCode)
示例#6
0
文件: Demo.py 项目: LejoFlores/ODM2
sys.path.insert(0, directory)


# Create a connection to the ODM2 database
# ----------------------------------------
conn = dbconnection.createConnection('mysql', 'localhost', 'odm2', 'ODM', 'ODM123!!')
#conn = dbconnection.createConnection('mysql', 'jws.uwrl.usu.edu', 'odm2', 'ODM', 'ODM123!!')
#conn = dbconnection.createConnection('mssql', '(local)', 'ODM2SS', 'ODM', 'odm')
#conn = dbconnection.createConnection('postgresql', 'arroyo.uwrl.usu.edu:5432', 'ODMSS', 'Stephanie', 'odm')
#conn = dbconnection.createConnection('mysql', '127.0.0.1:3306', 'ODM2', 'Stephanie', 'odm')


# Create a connection for each of the schemas. Currently the schemas each have a different
# connection but it will be changed to all the services sharing a connection
# ----------------------------------------------------------------------------------------
core_read = CSread(conn)
core = CoreServices(conn)
result_read = Rread(conn)
sampfeat_read = SFread(conn)


# Run some basic sample queries.
# ------------------------------
# Get all of the variables from the database and print their names to the console
allVars = core.read.getVariables()
numVars = len(allVars)
print "\n------------ Simple Variables Query ---------------"
print "There are " + str(numVars) + " Variables in the ODM2 database retrieved using getVariables()."
print "The list of variables includes:"
for x in allVars:
    print x.VariableCode + ": " + x.VariableNameCV