Repository: dbt-labs/dbt-core
Issue: JSON Decoding error with Python2 + Anaconda: Decimal('0') is not JSON serializable

## Issue

### Issue description
The `dbt test` command can fail with an error like:
```
Decimal('0') is not JSON serializable
```

dbt explicitly implements a Decimal-aware JSON serializer, but it appears that there is more than one type of Decimal at play here. The `agate` library will optionally include the `cdecimal` version of Decimal if it is available (code [here](https://github.com/wireservice/agate/blob/master/agate/data_types/number.py#L5)).

dbt does a check [here](https://github.com/fishtown-analytics/dbt/blob/5be8c7f85f3bea2527ddff17e9a51f74b2d847a8/dbt/utils.py#L473) that looks like:
```
        if isinstance(obj, Decimal):
            return float(obj)
        return super(JSONEncoder, self).default(obj)
```

here, `Decimal` is `decimal.Decimal`, but it could be that `obj` is of type `cdecimal.Decimal`. This leads to a confusing error.

Instead, dbt should check if the `obj` is of type `decimal.Decimal` or `cdecimal.Decimal`.

I _think_ the Anaconda part of this is crucial, as I'm unsure how else someone might have `cdecimal` installed in their system. You can install it manually with `pip install m3-cdecimal`.

### Results
```
"/Users/xxx/anaconda2/lib/python2.7/json/encoder.py", line 207, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/Users/xxx/anaconda2/lib/python2.7/json/encoder.py", line 270, in iterencode
    return _iterencode(o, 0)
  File "/Users/xxx/anaconda2/lib/python2.7/site-packages/dbt/utils.py", line 481, in default
    return super(JSONEncoder, self).default(obj)
  File "/Users/xxx/anaconda2/lib/python2.7/json/encoder.py", line 184, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: Decimal('0') is not JSON serializable
```

### System information
The output of `dbt --version`:
```
0.12.1
```

The operating system you're running on: OSX

The python version you're using (probably the output of `python --version`)
2.7.15 installed via Anaconda.

Changed files:
dbt/utils.py, dbt/compat.py

diff --git a/dbt/compat.py b/dbt/compat.py
index bbd76f5cb..0a3499ef9 100644
--- a/dbt/compat.py
+++ b/dbt/compat.py
@@ -1,6 +1,14 @@
 import codecs
 import json
 import warnings
+import decimal
+
+try:
+    import cdecimal
+except ImportError:
+    DECIMALS = (decimal.Decimal,)
+else:
+    DECIMALS = (decimal.Decimal, cdecimal.Decimal)
 
 WHICH_PYTHON = None
 
diff --git a/dbt/utils.py b/dbt/utils.py
index 6ee01c41f..a13e77938 100644
--- a/dbt/utils.py
+++ b/dbt/utils.py
@@ -14,7 +14,7 @@ import dbt.exceptions
 import dbt.flags
 
 from dbt.include import GLOBAL_DBT_MODULES_PATH
-from dbt.compat import basestring
+from dbt.compat import basestring, DECIMALS
 from dbt.logger import GLOBAL_LOGGER as logger
 from dbt.node_types import NodeType
 from dbt.clients import yaml_helper
@@ -476,6 +476,6 @@ class JSONEncoder(json.JSONEncoder):
     converted to floats.
     """
     def default(self, obj):
-        if isinstance(obj, Decimal):
+        if isinstance(obj, DECIMALS):
             return float(obj)
         return super(JSONEncoder, self).default(obj)