-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate model properties with types #39
Comments
I plan to take this issue. Currently the column information is from MACROS = {
'_log_columns_list': (
"\n{# This macro is intended for use by dbt-invoke #}"
"\n{% macro _log_columns_list(sql=none, resource_name=none) %}"
"\n {% if sql is none %}"
"\n {% set sql = 'select * from ' ~ ref(resource_name) %}"
"\n {% endif %}"
"\n {% if execute %}"
"\n {{ log(get_columns_in_query(sql), info=True) }}"
"\n {% endif %}"
"\n{% endmacro %}\n"
)
} Based on information https://discourse.getdbt.com/t/is-there-a-way-to-get-the-column-data-types-from-sql-in-v1-4-4/7834, there is a new macro Then this information is passed to def _get_property_column(column_name):
"""
Create a dictionary representing column properties
:param column_name: Name of column
:return: A dictionary representing column properties
"""
column_dict = {'name': column_name, 'description': ""}
return column_dict Current proposal is:
|
@NUSTemple thanks for your evaluation of the issue! I appreciate your willingness to take it on. Here are some of my initial thoughts:
|
This would be useful for us too. I'd expect a flag called --add-data-type to simply add the data_type in without setting up model contracts. If the goal is to set up model contracts then something like --model-contracts = True|False I would use it to
So since i select the consumption tables anyway, ephemeral limitations doesn't bother me |
On top of generating the list of all columns, it would be great if dbt-invoke could also pull the data_type and write it to the properties, so that one might use model contracts
The text was updated successfully, but these errors were encountered: