Comments (3)
@clrcrl I took a pass at this today, but due to how pyyaml's dump style, the format differs substantially (despite being functionally identical).
Original Test Output:
version: 2
models:
- name: data__a_relation
description: ""
columns:
- name: col_a
description: ""
- name: col_b
description: ""
Test Output Using toyaml()
:
version: 2
models:
- name: data__a_relation
description: ''
columns:
- name: col_a
description: ''
- name: col_b
description: ''
The key differences:
- A list inside a dict is no longer indented.
- Blank lines between top-level keys and columns.
- Single quotes for empty strings instead of double quotes.
This bothers me because it departs from the fishtown style. If dbt core replaced pyyaml with the drop-in replacement ruamel we could add some code there that would set the indentation (IMO the biggest issue with the change), but I haven't yet found a fix for the blank lines or single quotes.
What are your thoughts here? Should we stick with the list of strings originally? I like the spirit of this issue because it's a more maintainable way, but I also don't like introducing something that messes with what seems like the default dbt yaml style.
from dbt-codegen.
Ah dang, that's a shame that we didn't hook it up to a yaml-dumper that is in our favorite Fishtown format. IIRC (from other projects) formatting YAML output is not a quick and easy task.
I think given the current constraints of the library, I'm going to close this issue, and leave the "append new lines" method in place! I'm excited to see some other developments in the space (e.g. dbt-sugar and dbt-helper) which might be better solutions that the current package-based approach!
from dbt-codegen.
(also TY for taking a look at this!!)
from dbt-codegen.
Related Issues (20)
- Allow default codegen macros to be overridden
- Include secure views in generate_source macro (via get_relations_by_pattern macro) HOT 2
- Generate source does not work on External schema in Redshift HOT 2
- dbt_project.yml version is not matching with the latest release version HOT 1
- `generate_model_yaml` with `upstream_descriptions: true` should also read descriptions from upstream `sources`.
- (Postgres) Macro generate_model_yaml does not work with Materialized Views HOT 6
- How to generate data types that include size, precision, scale, etc. HOT 2
- Sorted column support in generate_source HOT 4
- Generate basic tests in model yaml HOT 2
- Fill in model/column descriptions when available in database metadata HOT 2
- Support for preserving case in `generate_source` HOT 1
- create_base_models should accept leading_commas and case_sensitive_cols arguments
- `generate_base_model()` doesn't work across databases on Redshift
- Create a release for new features HOT 1
- get_models seems broken in 1.8 HOT 2
- Generate Source, but for external files
- generate_model_yaml: Argument for Quoted Identifiers
- On hub.getdbt.com you've got an error in arguments of generate_model_yaml (model_names not model_name) HOT 1
- Generate schema yaml macro does not retrieve upstream descriptions of versioned models
- Add generate_macro_yaml macro
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbt-codegen.