Skip to content

Commit

Permalink
bug 880378 make ADU throw exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
selenamarie committed Jul 1, 2013
1 parent 32e15fa commit 35c7d51
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 deletions.
32 changes: 32 additions & 0 deletions alembic/versions/2cbb29fc9b77_bug_880378_make_upda.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""bug 880378 make update_adu throw exceptions
Revision ID: 2cbb29fc9b77
Revises: 2b285e76f71d
Create Date: 2013-06-28 15:09:38.750774
"""

# revision identifiers, used by Alembic.
revision = '2cbb29fc9b77'
down_revision = '4d4b48f86d4b'

import os
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
from sqlalchemy import types
from sqlalchemy.sql import table, column

def upgrade():
app_path=os.getcwd()
procs = [
'update_adu.sql'
, 'update_build_adu.sql'
]
for myfile in [app_path + '/socorro/external/postgresql/raw_sql/procs/' + line for line in procs]:
with open(myfile, 'r') as file:
op.execute(file.read())

def downgrade():
# No automated backout
pass
7 changes: 2 additions & 5 deletions socorro/external/postgresql/raw_sql/procs/update_adu.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ PERFORM 1 FROM raw_adu
WHERE "date" = updateday
LIMIT 1;

IF NOT FOUND and checkdata THEN
RAISE NOTICE 'raw_adu not updated for %', updateday;
RETURN FALSE;
ELSIF NOT FOUND THEN
RETURN FALSE;
IF NOT FOUND THEN
RAISE EXCEPTION 'raw_adu not updated for %', updateday;
END IF;

-- check if ADU has already been run for the date
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ PERFORM 1 FROM raw_adu
WHERE "date" = updateday
LIMIT 1;
IF NOT FOUND THEN
IF checkdata THEN
RAISE NOTICE 'raw_adu has not been updated for %',updateday;
RETURN FALSE;
ELSE
RETURN FALSE;
END IF;
RAISE EXCEPTION 'raw_adu has not been updated for %',updateday;
END IF;

-- insert nightly, aurora
Expand Down

0 comments on commit 35c7d51

Please sign in to comment.