Comments (5)
{% macro generate_yml_docsblock(model_name) %}
{% set model_yaml=[] %}
{% do model_yaml.append('version: 2') %}
{% do model_yaml.append('') %}
{% do model_yaml.append('models:') %}
{% do model_yaml.append(' - name: ' ~ model_name | lower) %}
{% do model_yaml.append(' description: ""') %}
{% do model_yaml.append(' columns:') %}
{% set relation=ref(model_name) %}
{%- set columns = adapter.get_columns_in_relation(relation) -%}
{% for column in columns %}
{% set docs_block = '''\'{{ doc("' ~ column.name ~ '") }}\'''' %}
{% do model_yaml.append(' - name: ' ~ column.name | lower ) %}
{% do model_yaml.append(' description: {}'.format(docs_block)) %}
{% do model_yaml.append('') %}
{% endfor %}
{% if execute %}
{% set joined = model_yaml | join ('\n') %}
{{ log(joined, info=True) }}
{% do return(joined) %}
{% endif %}
{% endmacro %}
from dbt-codegen.
@oscarlukersmithsc Do you mind sharing that modified macro? It sounds exactly what I was looking for 😄
from dbt-codegen.
Thank you very much, @oscarlukersmithsc!
from dbt-codegen.
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.
from dbt-codegen.
Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.
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.