Skip to content
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

Implementation of wikis and tags feature #250

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

99Lys
Copy link

@99Lys 99Lys commented Dec 3, 2024

Summary

Wikis and tags feature implementation.

Description

One of dbt's core features is source documentation. Right now, this documentation does not propagate into Dremio’s wiki, leading to two separate sources of truth.

The goal is to display dbt documentation - more specifically, wikis and tags - inside of Dremio.

Test Results

All added tests are running

  • Added tests to check wikis and tags creation for table models
  • Added tests to check wikis and tags creation, update and deletion for view models

Changelog

  • Possibility to integrate wikis and tags by enabling relation option from persist_docs configuration
    • New macro dremio__persist_docs created
    • Views also perform persist_docs macro
    • Integration via REST API

Related Issue

#86
#196

@simonpannek simonpannek marked this pull request as draft December 3, 2024 16:50
@simonpannek simonpannek self-requested a review December 3, 2024 16:50
@bcmeireles bcmeireles self-requested a review December 3, 2024 17:14
@99Lys 99Lys requested a review from howareyouman December 4, 2024 10:25
@99Lys 99Lys changed the title [DRAFT] Implemented wiki management methods and performed simple hardcoded tests Implementation of wikis and tags feature Dec 16, 2024
@99Lys 99Lys force-pushed the DX-98038-DBT-wiki-and-tags-extension-implementation branch from 67892c0 to 79bb2f9 Compare January 6, 2025 13:09
@howareyouman howareyouman changed the base branch from DX-98038-DBT-wiki-and-tags-extension-implementation to main January 8, 2025 10:59
@99Lys 99Lys force-pushed the DX-98038-DBT-wiki-and-tags-extension-implementation branch 2 times, most recently from ec03855 to 2a84e48 Compare January 9, 2025 10:59
@99Lys 99Lys force-pushed the DX-98038-DBT-wiki-and-tags-extension-implementation branch from 2a84e48 to 47f998f Compare January 9, 2025 12:55
@99Lys 99Lys marked this pull request as ready for review January 9, 2025 13:55
Copy link
Contributor

@howareyouman howareyouman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's great that you Liliana did it yourself!
All the comments I have are more about style and naming.
I don't see any huge blockers to get it merged soon!

CHANGELOG.md Outdated Show resolved Hide resolved
dbt/adapters/dremio/connections.py Outdated Show resolved Hide resolved
dbt/adapters/dremio/connections.py Outdated Show resolved Hide resolved
dbt/adapters/dremio/connections.py Outdated Show resolved Hide resolved
dbt/adapters/dremio/connections.py Outdated Show resolved Hide resolved
dbt/adapters/dremio/connections.py Outdated Show resolved Hide resolved
dbt/adapters/dremio/connections.py Outdated Show resolved Hide resolved
dbt/include/dremio/macros/adapters/persist_docs.sql Outdated Show resolved Hide resolved
Copy link
Contributor

@bcmeireles bcmeireles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR!
@howareyouman already pointed pretty much everything, I just have a few questions where I might be lacking context to understand

Comment on lines +220 to +222
def setUp(self, project):
run_dbt(["seed"])
run_dbt()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asking as from what I know dbt seed is used to load csv files from /seeds but I don't see any

Copy link
Author

@99Lys 99Lys Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This setUp function originally exists in BasePersistDocsBase class (from where BasePersistDocs is inherited). This is a fixture set to be running automatically @pytest.fixture(scope="class", autouse=True) in autouse=True. Since I wanted to have control on when to run dbt, I just copy pasted it and changed the annotation to autouse=False. Maybe I should've added a comment about this.
I did something similar for function test_has_comments_pglike by replacing its content so this test is not being run.
I don't know what is the best practice here, please let me know if there is a best way to do this! Thanks

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we chain dbt commands here? seed and run in 1 command?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@99Lys If you will take a look on the code of run_dbt() function you will take a look that it's uses command run. So to chain operations in this function you can easily run run_dbt(["seed", "run"]) and that will be 1 dbt command run

return {
"table_model.sql": _MODELS__TABLE,
"view_model.sql": _MODELS__VIEW,
"schema.yml": _PROPERTIES__SCHEMA_YML,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to set the schema in here? Isn't this handled by the unique_schema fixture? I'm unsure if the models fixture should also be used to set a schema.yml

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I understood, unique_schema is only "building" the correct path where the models are being created and that is later used in dbt_profile_data to update the project configuration.
Initially, I was setting schema.yml in properties. But since I needed to update it later, I moved to models because properties/ doesn't seem to exist so I could only perform write_file(<updated_schema.yml>, project.project_root, "models", "schema.yml").
Also I don't think it's a problem to configure schema.yml in models because in an actual project by default there is where it is stored.

simonpannek
simonpannek previously approved these changes Jan 10, 2025
Copy link

@simonpannek simonpannek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! No blockers on my side, just a few small comments!

dbt/adapters/dremio/api/rest/client.py Outdated Show resolved Hide resolved
dbt/adapters/dremio/connections.py Show resolved Hide resolved
howareyouman
howareyouman previously approved these changes Jan 10, 2025
Copy link
Contributor

@howareyouman howareyouman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please also answer and finish all the discussions we have here?
Great PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants