Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Examples/Sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
# ------------------------------
# Get all of the variables from the database and print their names to the console
allVars = read.getVariables()

print "\n-------- Information about Variables ---------"
for x in allVars:
print x.VariableCode + ": " + x.VariableNameCV



# Get all of the people from the database
allPeople = read.getPeople()

print "\n-------- Information about People ---------"
for x in allPeople:
print x.PersonFirstName + " " + x.PersonLastName

Expand All @@ -55,6 +55,7 @@

# Get all of the SamplingFeatures from the database that are Sites
try:
print "\n-------- Information about Sites ---------"
siteFeatures = read.getSamplingFeatures(type='Site')
numSites = len(siteFeatures)

Expand All @@ -66,8 +67,7 @@

# Now get the SamplingFeature object for a SamplingFeature code
try:
sf = read.getSamplingFeatures(code='USU-LBR-Mendon')[0]
print sf
sf = read.getSamplingFeatures(code=['USU-LBR-Mendon'])[0]
print "\n-------- Information about an individual SamplingFeature ---------"
print "The following are some of the attributes of a SamplingFeature retrieved using getSamplingFeature(code = x): \n"
print "SamplingFeatureCode: " + sf.SamplingFeatureCode
Expand Down Expand Up @@ -118,7 +118,7 @@
# Now get a particular Result using a ResultID
print "\n------- Example of Retrieving Attributes of a Time Series Result -------"
try:
tsResult = read.getResults(id = 1)[0]
tsResult = read.getResults(ids = [1])[0]
print (
"The following are some of the attributes for the TimeSeriesResult retrieved using getTimeSeriesResultByResultID(): \n" +
"ResultTypeCV: " + tsResult.ResultTypeCV + "\n" +
Expand Down
62 changes: 10 additions & 52 deletions odm2api/ODM2/services/createService.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ def __init__(self, session):
# Annotations
# ################################################################################

def create(self, values):
if len(values)>1:
self._session.add_all(values)
else:
self._session.add(values)
self._session.commit()

def createVariable(self, var):
self._session.add(var)
self._session.commit()
Expand Down Expand Up @@ -92,7 +99,8 @@ def createSimulation(self, simulation):

def createTimeSeriesResultValues(self, datavalues):
try:

tablename = TimeSeriesResultValues.__tablename__
print "I am TS saving name the table name"+ tablename
datavalues.to_sql(name="TimeSeriesResultValues",
schema=TimeSeriesResultValues.__table_args__['schema'],
if_exists='append',
Expand All @@ -106,10 +114,6 @@ def createTimeSeriesResultValues(self, datavalues):
print e
return None

# ################################################################################
# CV
# ################################################################################




Expand Down Expand Up @@ -448,53 +452,7 @@ def createTimeSeriesResultValues(self, datavalues):
#
# return result
#
#
# # ################################################################################
# # Data Quality
# # ################################################################################
#
#
#
# # ################################################################################
# # Equipment
# # ################################################################################
#
#
#
#
# # ################################################################################
# # ExtensionProperties
# # ################################################################################
#
#
#
#
#
# # ################################################################################
# # External Identifiers
# # ################################################################################
#
#
#
#
# # ################################################################################
# # Lab Analyses
# # ################################################################################
#
#
#
#
# # ################################################################################
# # Provenance
# # ################################################################################
#
#
#
#
# # ################################################################################
# # Results
# # ################################################################################
#

#
#
# def createTimeSeriesResult(self, result, aggregationstatistic, xloc=None, xloc_unitid=None, yloc=None,
Expand Down
Loading