Exemplo n.º 1
0
# 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

# Get all of the people from the database
allPeople = core_read.getPeople()
numPeople = len(allPeople)
print "\n------------ Simple People Query ------------------"
print "There are " + str(
    numPeople) + " People in the ODM2 database retrieved using getPeople()."
print "The list of People includes: "
for x in allPeople:
    print x.PersonFirstName + " " + x.PersonLastName

# Get all of the SamplingFeatures from the database that are Sites
siteFeatures = core_read.getSamplingFeaturesByType('Site')
numSites = len(siteFeatures)
print "\n--------------- Information about Site SamplingFeatures ------------"
print "There are " + str(
    numSites
) + " Site SamplingFeatures in the ODM2 database retrieved using getSamplingFeaturesByType()."
Exemplo n.º 2
0

# 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


# Get all of the people from the database
allPeople = core_read.getPeople()
numPeople = len(allPeople)
print "\n------------ Simple People Query ------------------"
print "There are " + str(numPeople) + " People in the ODM2 database retrieved using getPeople()."
print "The list of People includes: "
for x in allPeople:
    print x.PersonFirstName + " " + x.PersonLastName


# Get all of the SamplingFeatures from the database that are Sites
siteFeatures = core_read.getSamplingFeaturesByType('Site')
numSites = len(siteFeatures)
print "\n--------------- Information about Site SamplingFeatures ------------"
print "There are " + str(numSites) + " Site SamplingFeatures in the ODM2 database retrieved using getSamplingFeaturesByType()."
print "The list of Site SamplingFeatures includes: "
for x in siteFeatures: