-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add a Function to Allow Easy Hyperlinking Between Model Documentation #1334
Comments
Really great idea! I think this should be relatively straightforward for someone to add to dbt -- going to add a |
In addition, it would be nice to have the ability to have SQL queries executed and have their output actually appear in dbt docs. One use case could be including a line of documentation that says "The earliest record in X table has a timestamp of XXXXXXX" and have the value of the timestamp populated at runtime. Or have an aggregate query execute to count the number of transaction values by a certain lookup value, e.g. cars by color, and then have a table get populated in the documentation output to actually display what this looks like in the database. |
Tentatively pulling this issue in the wilt-chamberlain release, pending questions about what sort of dbt context we can provide in the |
Kicking this one out of Wilt Chamberlain, but excited to tackle it for a subsequent release! Just prioritized for Louisa May Alcott, which should be the first feature release after 0.14.0 (so, either 0.14.x, or 0.15.0, depending) |
related to #1503 |
Hi! Keen to get model references in docs! |
Hey @eugene-nikolaev, this isn't prioritized right now, but it's good to hear this is something you're interested in! All resources in the dbt-docs site today have URLs like:
So if you want to link to a specific model in a Markdown description, it can be as simple as: - name: model
description: >
Check out this [other_model](/#!/model/model.my_project.other_model)
Or this [source](/#!/source/model.my_project.my_source.src_table)
Or this [macro from a package](/#!/macro/macro.dbt_utils.date_spine) It is possible to render Jinja templates in the
|
@jtcohen6 thanks for reply! |
Would love to have this function in the future! Glad to have the href though! |
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 remove the stale label or comment on the issue, or it will be closed in 7 days. |
What's the status on this? As someone who makes heavy use of docs, I'd love to see this feature. How can I help? |
Waiting for this being released!! |
Our team had a chance to discuss this in more detail yesterday. The idea of writing something like: # resources.yml
models:
- name: one_model
description: "{{ link_to_ref('another_model') }}" And having it render as a Markdown relative link ( I'm not sure if that relative link makes much sense in other contexts where descriptions are used, though:
If we put those questions aside for the moment, and just solve for the @contextmember
# should this just be called ref()?
def link_to_ref(self, *args: str) -> str:
# return Markdown for a relative URL to the other resource's page
if len(args) == 1:
target_model_package = None
target_model_name = args[0]
elif len(args) == 2:
target_model_package, target_model_name = args
else:
raise dbt.exceptions.InternalException(
f"Refs should always be 1 or 2 arguments - got {len(ref)}"
)
target_model = self.manifest.resolve_ref(
target_model_name,
target_model_package,
self._project_name,
self.node.package_name,
)
name = target_model.name
unique_id = target_model.unique_id
resource_type = target_model.resource_type
return f"[{name}](/#!/{resource_type}/{unique_id})"
@contextmember
def link_to_source(self, *args: str) -> str:
... similar idea ... Then: # resources.yml
version: 2
models:
- name: one_model
description: "{{ link_to_ref('another_model') }}" @gshank Could you advise on the performance implications of an approach like that? I know we've discussed in the past that providing macros to the context for |
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 remove the stale label or comment on the issue, or it will be closed in 7 days. |
Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest; add a comment to notify the maintainers. |
I'm sad to see this closed, any possibility to revive this idea? Even the official docs says current solution with markdown href is quite hacky |
Function to Allow Easy Hyperlinking Between Model Documentation
Feature description
Right now, if you are writing a doc block for a model and want to embed a hyperlink to a different doc block, it is necessary to do syntax like this: [link text]link title. This is a bit clunky and difficult to follow. It would be nice to have a function like "link(model_name)" to make it easier to embed hyperlinks to other models in documentation.
Who will this benefit?
All users who want to be able to construct links between various documentation pages for models when using the "dbt docs" functionality.
The text was updated successfully, but these errors were encountered: