Giter VIP home page Giter VIP logo

Comments (3)

jaypeedevlin avatar jaypeedevlin commented on August 22, 2024

@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.

clrcrl avatar clrcrl commented on August 22, 2024

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.

clrcrl avatar clrcrl commented on August 22, 2024

(also TY for taking a look at this!!)

from dbt-codegen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.