Repository: dbt-labs/dbt-core

Issue:
`dbt seed --show` fails
## Issue

### Issue description

`dbt seed --show` command fails with 2 exit code.

### Results
``` fish
❯ dbt seed --show
Found 25 models, 8 tests, 0 archives, 0 analyses, 109 macros, 2 operations, 1 seed files

15:12:45 | Concurrency: 1 threads (target='default')
15:12:45 |
15:12:45 | 1 of 1 START seed file ANALYTICS_PROD.cancellation_coeff............. [RUN]
15:12:47 | 1 of 1 OK loaded seed file ANALYTICS_PROD.cancellation_coeff......... [INSERT 14 in 1.74s]
15:12:47 |
15:12:47 | Finished running 1 seeds in 5.03s.
Encountered an error:
'agate_table'

❯ echo $status
2

```

In the logs I see this:
```
2019-02-12 10:58:28,566 (MainThread): Sending event: {'category': 'dbt', 'action': 'invocation', 'label': 'end', 'context': [<snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x10bcc7e48>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x108697518>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x10bca7358>]}
2019-02-12 10:58:29,028 (MainThread): Flushing usage events
2019-02-12 10:58:29,028 (MainThread): Encountered an error:
2019-02-12 10:58:29,029 (MainThread): 'agate_table'
2019-02-12 10:58:29,029 (MainThread): Traceback (most recent call last):
  File "/usr/local/Cellar/dbt/0.12.2/libexec/lib/python3.7/site-packages/dbt/main.py", line 77, in main
    results, succeeded = handle_and_check(args)
  File "/usr/local/Cellar/dbt/0.12.2/libexec/lib/python3.7/site-packages/dbt/main.py", line 151, in handle_and_check
    task, res = run_from_args(parsed)
  File "/usr/local/Cellar/dbt/0.12.2/libexec/lib/python3.7/site-packages/dbt/main.py", line 207, in run_from_args
    results = run_from_task(task, cfg, parsed)
  File "/usr/local/Cellar/dbt/0.12.2/libexec/lib/python3.7/site-packages/dbt/main.py", line 215, in run_from_task
    result = task.run()
  File "/usr/local/Cellar/dbt/0.12.2/libexec/lib/python3.7/site-packages/dbt/task/seed.py", line 20, in run
    self.show_tables(results)
  File "/usr/local/Cellar/dbt/0.12.2/libexec/lib/python3.7/site-packages/dbt/task/seed.py", line 42, in show_tables
    self.show_table(result)
  File "/usr/local/Cellar/dbt/0.12.2/libexec/lib/python3.7/site-packages/dbt/task/seed.py", line 26, in show_table
    table = result.node['agate_table']
  File "/usr/local/Cellar/dbt/0.12.2/libexec/lib/python3.7/site-packages/dbt/api/object.py", line 93, in __getitem__
    return self._contents[key]
KeyError: 'agate_table'
```

### System information
The output of `dbt --version`:
```
installed version: 0.12.2
   latest version: 0.12.2

Up to date!
```

The operating system you're running on:
macOS 10.13

The python version you're using (probably the output of `python --version`)

```fish
❯ python --version
Python 3.6.4
```

### Steps to reproduce
I have added a csv file and tried to load it into Snowflake using `dbt seed --show` command and it failed. `dbt seed` completes without errors. In `dbt_project.yml` the configuration looks like this:
```yml
data-paths: ["dbt/data"]
```



Discussion:
Thanks @pavel-popov - you're totally right - just reproduced this locally. Should be a quick fix - I'll add this in for 0.13.0!

Resolving patch:
diff --git a/core/dbt/task/seed.py b/core/dbt/task/seed.py
--- a/core/dbt/task/seed.py
+++ b/core/dbt/task/seed.py
@@ -23,11 +23,11 @@ def run(self):
         return results
 
     def show_table(self, result):
-        table = result.node['agate_table']
+        table = result.node.agate_table
         rand_table = table.order_by(lambda x: random.random())
 
-        schema = result.node['schema']
-        alias = result.node['alias']
+        schema = result.node.schema
+        alias = result.node.alias
 
         header = "Random sample of table: {}.{}".format(schema, alias)
         logger.info("")


Test patch:
diff --git a/test/integration/005_simple_seed_test/test_simple_seed.py b/test/integration/005_simple_seed_test/test_simple_seed.py
--- a/test/integration/005_simple_seed_test/test_simple_seed.py
+++ b/test/integration/005_simple_seed_test/test_simple_seed.py
@@ -30,8 +30,9 @@ def test_simple_seed(self):
         self.assertEqual(len(results),  1)
         self.assertTablesEqual("seed_actual","seed_expected")
 
-        # this should truncate the seed_actual table, then re-insert
-        results = self.run_dbt(["seed"])
+        # this should truncate the seed_actual table, then re-insert.
+        # also, '--show' should not crash dbt!
+        results = self.run_dbt(["seed", '--show'])
         self.assertEqual(len(results),  1)
         self.assertTablesEqual("seed_actual","seed_expected")