Forum Discussion
A best practice across all programming disciplines is to avoid repeating identical lines or values when writing code. In my case, I have 3 tables with identical columns but differing data. The "import with csv" action looks *almost* the same for each table. This yaml syntax allows me to write the value for `header_row:` once and define a reference to that value in-line. Any time I need that same value, I can use the reference instead of the actual value.
Keep in mind this is a purely textual modification to the yaml, and after the yaml is loaded, the resulting values are hard coded again. After loading a pipeline with yaml references, you could edit the pipeline in the UI to have different `header_row` values.
I am using yaml references to define the fields i import, however this simple reference is insufficient to create a valid "import with csv" block. Each field must also have mapping in the form of `qb_field_for_a` then `qb_field_for_really`, then `qb_field_for_long`... one for each field listed in `header_row`. The value of the mapping is the field ID for the destination table. For me, the destination field ID is not consistent, so I can't simply repeat all the `qb_field_for` using yaml references, because the values differ.
Honestly, it's not clear how useful it is, but I figured someone might get some use.
------------------------------
Dan Locks
------------------------------
Dan,
Thanks for introducing something new. You have me thinking about it.
Don
------------------------------
Don Larson
------------------------------
- DanLocks2 years agoQrew Trainee
There are a few other automation systems out there that use yaml files for specifications (kubernetes, AWS CloudFormation, Terraform, Gitlab, AWS Codebuild, probably others) Most of them seem to use templating to pre-process the yaml similar to what I suggest here. Some use jinja for their templating system. These systems publish a rigorous spec for the yaml documents and don't provide a pretty GUI.
It would be great if QB would publish a spec and treat the yaml as the primary source for pipelines. I think the GUI gets in the way of managing pipelines of any complexity at all. Granted, I am quite new to QB, so take my opinions as uninformed.
------------------------------
Dan Locks
------------------------------