Commit 40c3d3bf authored by Micaël Bergeron's avatar Micaël Bergeron

make missing fields a warning

parent c4705ef5
......@@ -60,6 +60,7 @@ class SchemaError(Error):
"""Base exception for schema errors."""
class InapplicableChangeError(SchemaError):
"""Raise for inapplicable schema changes."""
......@@ -96,7 +97,7 @@ class ExceptionAggregator:
aggregate_type = self.etype.Aggregate
if len(self.failures):
exceptions = map(lambda f: f[0], self.failures)
exceptions = [f[0] for f in self.failures]
raise aggregate_type(exceptions)
......@@ -106,10 +107,10 @@ def with_error_exit_code(main):
main(*args, **kwargs)
except Error as err:
except Exception as e:
raise e
return f
......@@ -6,7 +6,7 @@ import psycopg2.extras
from typing import Sequence, Callable, Set
from enum import Enum
from collections import OrderedDict, namedtuple
from elt.error import ExceptionAggregator, InapplicableChangeError
from elt.error import ExceptionAggregator, SchemaError, InapplicableChangeError
class DBType(str, Enum):
......@@ -95,6 +95,12 @@ class Schema:
return {SchemaDiff.COLUMN_OK}
def __getitem__(self, column_key):
return self.columns[column_key]
except KeyError as e:
raise SchemaError("{}.{} is missing.".format(*column_key))
def db_schema(db_conn, schema_name) -> Schema:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment