Skip to content

Commit

Permalink
Merge branch 'dev/octavius-catto' into feature/schema-yml-rendering-3
Browse files Browse the repository at this point in the history
  • Loading branch information
beckjake authored Apr 27, 2020
2 parents 4c2968e + f7b8e5c commit fcdca0f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
- Sources (and therefore freshness tests) can be enabled and disabled via dbt_project.yml ([#2283](https://github.com/fishtown-analytics/dbt/issues/2283), [#2312](https://github.com/fishtown-analytics/dbt/pull/2312), [#2357](https://github.com/fishtown-analytics/dbt/pull/2357))
- schema.yml files are now fully rendered in a context that is aware of vars declared in from dbt_project.yml files ([#2269](https://github.com/fishtown-analytics/dbt/issues/2269), [#2357](https://github.com/fishtown-analytics/dbt/pull/2357))
- Sources from dependencies can be overridden in schema.yml files ([#2287](https://github.com/fishtown-analytics/dbt/issues/2287), [#2357](https://github.com/fishtown-analytics/dbt/pull/2357))
- Snowflake now uses "describe table" to get the columns in a relation ([#2260](https://github.com/fishtown-analytics/dbt/issues/2260), [#2324](https://github.com/fishtown-analytics/dbt/pull/2324))
- Added a '--no-browser' argument to "dbt docs serve" so you can serve docs in an environment that only has a CLI browser which would otherwise deadlock dbt ([#2004](https://github.com/fishtown-analytics/dbt/issues/2004), [#2364](https://github.com/fishtown-analytics/dbt/pull/2364))

### Fixes
- When a jinja value is undefined, give a helpful error instead of failing with cryptic "cannot pickle ParserMacroCapture" errors ([#2110](https://github.com/fishtown-analytics/dbt/issues/2110), [#2184](https://github.com/fishtown-analytics/dbt/pull/2184))
Expand All @@ -30,6 +32,7 @@
- Fix skipped node count in stdout at the end of a run ([#2095](https://github.com/fishtown-analytics/dbt/issues/2095), [#2310](https://github.com/fishtown-analytics/dbt/pull/2310))
- Fix an issue where BigQuery incorrectly used a relation's quote policy as the basis for the information schema's include policy, instead of the relation's include policy. ([#2188](https://github.com/fishtown-analytics/dbt/issues/2188), [#2325](https://github.com/fishtown-analytics/dbt/pull/2325))
- Fix "dbt deps" command so it respects the "--project-dir" arg if specified. ([#2338](https://github.com/fishtown-analytics/dbt/issues/2338), [#2339](https://github.com/fishtown-analytics/dbt/issues/2339))
- Fix "Object of type Decimal is not JSON serializable" error when BigQuery queries returned numeric types in nested data structures ([#2336](https://github.com/fishtown-analytics/dbt/issues/2336), [#2348](https://github.com/fishtown-analytics/dbt/pull/2348))

### Under the hood
- Added more tests for source inheritance ([#2264](https://github.com/fishtown-analytics/dbt/issues/2264), [#2291](https://github.com/fishtown-analytics/dbt/pull/2291))
Expand Down
3 changes: 2 additions & 1 deletion core/dbt/clients/agate_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import datetime
import isodate
import json
import dbt.utils
from typing import Iterable, List, Dict, Union, Optional, Any

from dbt.exceptions import RuntimeException
Expand Down Expand Up @@ -92,7 +93,7 @@ def table_from_data_flat(data, column_names: Iterable[str]) -> agate.Table:
row = []
for value in list(_row.values()):
if isinstance(value, (dict, list, tuple)):
row.append(json.dumps(value))
row.append(json.dumps(value, cls=dbt.utils.JSONEncoder))
else:
row.append(value)
rows.append(row)
Expand Down
5 changes: 5 additions & 0 deletions core/dbt/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,11 @@ def _build_docs_serve_subparser(subparsers, base_subparser):
Specify the port number for the docs server.
'''
)
serve_sub.add_argument(
'--no-browser',
dest='open_browser',
action='store_false',
)
serve_sub.set_defaults(cls=serve_task.ServeTask, which='serve',
rpc_method=None)
return serve_sub
Expand Down
9 changes: 5 additions & 4 deletions core/dbt/task/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ def run(self):
SimpleHTTPRequestHandler # type: ignore
) # type: ignore

try:
webbrowser.open_new_tab('http://127.0.0.1:{}'.format(port))
except webbrowser.Error:
pass
if self.args.open_browser:
try:
webbrowser.open_new_tab(f'http://127.0.0.1:{port}')
except webbrowser.Error:
pass

try:
httpd.serve_forever() # blocks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def test__bigquery_fetch_nested_records(self):
cast('Stonebreaker' as string) as lname
) as user,
[
struct(1 as val_1, 2 as val_2),
struct(3 as val_1, 4 as val_2)
struct(1 as val_1, cast(2.12 as numeric) as val_2),
struct(3 as val_1, cast(4.83 as numeric) as val_2)
] as val
union all
Expand All @@ -39,8 +39,8 @@ def test__bigquery_fetch_nested_records(self):
cast('Brickmaker' as string) as lname
) as user,
[
struct(7 as val_1, 8 as val_2),
struct(9 as val_1, 0 as val_2)
struct(7 as val_1, cast(8 as numeric) as val_2),
struct(9 as val_1, cast(null as numeric) as val_2)
] as val
"""

Expand All @@ -55,8 +55,8 @@ def test__bigquery_fetch_nested_records(self):
'{"fname": "Johnny", "lname": "Brickmaker"}'
],
"val": [
'[{"val_1": 1, "val_2": 2}, {"val_1": 3, "val_2": 4}]',
'[{"val_1": 7, "val_2": 8}, {"val_1": 9, "val_2": 0}]'
'[{"val_1": 1, "val_2": 2.12}, {"val_1": 3, "val_2": 4.83}]',
'[{"val_1": 7, "val_2": 8}, {"val_1": 9, "val_2": null}]'
]
}

Expand Down

0 comments on commit fcdca0f

Please sign in to comment.