Skip to content

Commit 310e36e

Browse files
committed
ISSUE-99 Implement new schema updates to tagbase-schema.sql to accomodate multiple position dataset solutions per tag deployment
1 parent 1c544ec commit 310e36e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

tagbase_server/tagbase_server/utils/processing_utils.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def process_etuff_file(file, notes=None, version=1):
9090
variable_id = row[0]
9191
else:
9292
try:
93+
logger.info(variable_name, tokens.strip())
9394
cur.execute(
9495
"INSERT INTO observation_types("
9596
"variable_name, variable_units) VALUES (%s, %s) "
@@ -101,16 +102,15 @@ def process_etuff_file(file, notes=None, version=1):
101102
psycopg2.DatabaseError,
102103
) as error:
103104
logger.error(
104-
"'variable_id' %s already exists in 'observation_types'.",
105+
"variable_id '%s' already exists in 'observation_types'. tokens:"
106+
" '%s. \nerror: " % s,
105107
variable_name,
108+
tokens,
109+
error,
106110
)
107111
conn.rollback()
108-
return 1
109-
logger.info(
110-
"Successfully staged INSERT into 'observation_types'"
111-
)
112112
cur.execute(
113-
"SELECT currval('observation_types_variable_id_seq')"
113+
"SELECT nextval('observation_types_variable_id_seq')"
114114
)
115115
variable_id = cur.fetchone()[0]
116116
variable_lookup[variable_name] = variable_id
@@ -140,7 +140,7 @@ def process_etuff_file(file, notes=None, version=1):
140140
e_time = time.perf_counter()
141141
sub_elapsed = round(e_time - s_time, 2)
142142
logger.info(
143-
"Built raw 'proc_observations' data structure from %s observations in: %s second(s)",
143+
"Built raw 'proc_observations' data structure from %s observations in: %s second(s)",
144144
len_proc_obs,
145145
sub_elapsed,
146146
)
@@ -202,8 +202,9 @@ def process_etuff_file(file, notes=None, version=1):
202202
e_time = time.perf_counter()
203203
sub_elapsed = round(e_time - s_time, 2)
204204
logger.info(
205-
"Successful copy of %s observations into 'proc_observations' and execution of "
205+
"Successful copy of %s observations from %s into 'proc_observations' and execution of "
206206
"'data_migration' TRIGGER. Elapsed time: %s second(s).", # Average writes p/s: %s",
207+
file,
207208
len_proc_obs,
208209
sub_elapsed,
209210
# math.ceil(len_proc_obs / sub_elapsed),

0 commit comments

Comments
 (0)