Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Gonzalez <migonzalvar@activitycentral.com>2013-08-06 18:10:27 (GMT)
committer Miguel Gonzalez <migonzalvar@activitycentral.com>2013-08-06 18:10:27 (GMT)
commitaf5f8cfa6445a288009e16c9e3fb71a2063d96a3 (patch)
tree2b38196ead644373294714477a828ce7d324820f
parent502ca57270eb0c64a1172254879c58848f42506f (diff)
Use SQLAlchemy errors when creating tables
-rw-r--r--stats_consolidation/db.py7
-rw-r--r--test2/Makefile2
2 files changed, 4 insertions, 5 deletions
diff --git a/stats_consolidation/db.py b/stats_consolidation/db.py
index e57d4da..57a26a7 100644
--- a/stats_consolidation/db.py
+++ b/stats_consolidation/db.py
@@ -73,12 +73,9 @@ class DB_Stats:
log.info('Creating table %s:', name)
cursor.execute(ddl)
except sa.exc.DBAPIError as err:
- if err.errno == errorcode.ER_TABLE_EXISTS_ERROR:
- log.warning('Table %s already exists.', name)
- else:
- raise Exception ("Error: {0}".format(err))
+ raise err
else:
- log.info('Table %s crated', name)
+ log.info('Table %s created', name)
def create (self):
self.connect()
diff --git a/test2/Makefile b/test2/Makefile
index 1b2c50d..6ecf8fb 100644
--- a/test2/Makefile
+++ b/test2/Makefile
@@ -33,6 +33,8 @@ COVERAGE=python ../.venv/bin/coverage run --source=../stats_consolidation,../sql
.coverage: dropdb createdb
$(COVERAGE)\
../stats_consolidation/stats_consolidation_run --config_file test.conf
+ $(COVERAGE)\
+ ../stats_consolidation/stats_consolidation_run --config_file test.conf
$(COVERAGE) -a\
../sql/make_report --query all --db_name sc --db_user sc --db_pass sc --start_date 2013-01-01 --end_date 2013-12-12
$(COVERAGE) -a\