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

add initial support for semantic_manifest files #106

Closed

Conversation

MiConnell
Copy link

This PR begins the process for supporting semantic manifest files. I'd love your feedback on the logic I set up and if I missed anything. As of now, there's no semantic_manifest schema defined in dbt's schema site, but there's some discussion of that getting updated shortly.
Fixes #105

Copy link

coderabbitai bot commented Aug 13, 2024

Walkthrough

This change enhances the library's functionality by adding support for parsing semantic manifest files from DBT. It introduces a new function to handle JSON data structures specific to semantic manifests, expanding the parser's capabilities. Additionally, new data models are established for validation and organization, ensuring compliance and accuracy when handling these artifacts. Overall, this improvement aims to better integrate semantic artifacts into the existing framework.

Changes

Files Change Summary
README.md, dbt_artifacts_parser/parser.py Introduced new function parse_semantic_manifest to handle semantic_manifest.json.
dbt_artifacts_parser/parsers/semantic_manifest/__init__.py Added licensing information for legal compliance.
dbt_artifacts_parser/parsers/semantic_manifest/semantic_manifest_v1.py Defined data models for semantic manifests using Pydantic for structure and validation.
dbt_artifacts_parser/parsers/version_map.py Added SEMANTIC_MANIFEST_V1 constant to ArtifactTypes enumeration for semantic manifests.
tests/parsers/test_utils.py, tests/test_parser.py Included imports and commented-out tests for future integration of semantic manifest parsing.

Assessment against linked issues

Objective Addressed Explanation
Add support for semantic manifest files (#105)

🐇 Hop along, hear the tale,
Semantic parsing now won't fail!
JSON files, both new and bright,
With models clear, they bring delight.
In the garden of code, we expand our view,
Thank you, dear devs, for all that you do! 🌼✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range, codebase verification and nitpick comments (1)
tests/test_parser.py (1)

136-155: Planned Test: Semantic Manifest Parsing

The commented-out test function test_parse_semantic_manifest indicates a plan to test semantic manifest parsing. Ensure to implement and activate this test once the relevant schema details are finalized.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7ac8c85 and 95a8649.

Files ignored due to path filters (1)
  • tests/resources/v1/jaffle_shop/semantic_manifest.json is excluded by !**/*.json
Files selected for processing (7)
  • README.md (1 hunks)
  • dbt_artifacts_parser/parser.py (2 hunks)
  • dbt_artifacts_parser/parsers/semantic_manifest/init.py (1 hunks)
  • dbt_artifacts_parser/parsers/semantic_manifest/semantic_manifest_v1.py (1 hunks)
  • dbt_artifacts_parser/parsers/version_map.py (2 hunks)
  • tests/parsers/test_utils.py (2 hunks)
  • tests/test_parser.py (1 hunks)
Files skipped from review due to trivial changes (1)
  • dbt_artifacts_parser/parsers/semantic_manifest/init.py
Additional context used
Ruff
tests/parsers/test_utils.py

38-38: dbt_artifacts_parser.parsers.semantic_manifest.semantic_manifest_v1.SemanticManifestV1 imported but unused

Remove unused import: dbt_artifacts_parser.parsers.semantic_manifest.semantic_manifest_v1.SemanticManifestV1

(F401)

Additional comments not posted (14)
dbt_artifacts_parser/parsers/semantic_manifest/semantic_manifest_v1.py (9)

6-13: LGTM!

The NodeRelation class is well-defined with appropriate fields and configuration.


16-22: LGTM!

The Measure class is well-defined with appropriate fields and configuration.


25-36: LGTM!

The TypeParams class is well-structured with appropriate fields and default values.


39-48: LGTM!

The Metric class is well-defined with appropriate fields and configuration.


51-57: LGTM!

The TimeSpineTableConfiguration class is well-defined with appropriate fields and configuration.


60-66: LGTM!

The ProjectConfiguration class is well-structured with appropriate fields and configuration.


69-75: LGTM!

The SavedQueryExportConfig class is well-defined with appropriate fields and configuration.


95-104: LGTM!

The SavedQuery class is well-structured with appropriate fields and configuration.


123-127: LGTM!

The SemanticManifestV1 class is well-defined with appropriate fields and configuration.

dbt_artifacts_parser/parsers/version_map.py (2)

41-41: LGTM!

The import statement for SemanticManifestV1 is correctly added and necessary for the new functionality.


98-100: LGTM!

The new enum entry SEMANTIC_MANIFEST_V1 is correctly added and consistent with existing patterns.

tests/parsers/test_utils.py (1)

124-125: LGTM! Consider tracking this task.

The commented-out line for SemanticManifestV1 indicates planned future work. Consider tracking this task in an issue if not already done.

README.md (1)

240-251: Documentation Update: Semantic Manifest Parsing

The addition of the semantic manifest parsing example is clear and consistent with existing documentation. It effectively demonstrates the new functionality.

dbt_artifacts_parser/parser.py (1)

306-318: New Function: parse_semantic_manifest

The addition of parse_semantic_manifest is well-structured and aligns with the existing parser functions. The placeholder for future schema version handling is a good practice for extensibility.

@@ -35,6 +35,7 @@
from dbt_artifacts_parser.parsers.run_results.run_results_v2 import RunResultsV2
from dbt_artifacts_parser.parsers.run_results.run_results_v3 import RunResultsV3
from dbt_artifacts_parser.parsers.run_results.run_results_v4 import RunResultsV4
from dbt_artifacts_parser.parsers.semantic_manifest.semantic_manifest_v1 import SemanticManifestV1
Copy link

Choose a reason for hiding this comment

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

Remove unused import.

The import SemanticManifestV1 is currently unused and should be removed to address the static analysis warning.

- from dbt_artifacts_parser.parsers.semantic_manifest.semantic_manifest_v1 import SemanticManifestV1
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
from dbt_artifacts_parser.parsers.semantic_manifest.semantic_manifest_v1 import SemanticManifestV1
Tools
Ruff

38-38: dbt_artifacts_parser.parsers.semantic_manifest.semantic_manifest_v1.SemanticManifestV1 imported but unused

Remove unused import: dbt_artifacts_parser.parsers.semantic_manifest.semantic_manifest_v1.SemanticManifestV1

(F401)

@yu-iskw
Copy link
Owner

yu-iskw commented Aug 13, 2024

@MiConnell Thank you for opening this. I want to support semantic_manifest.json after it is open-sourced, because we can't reproduce to generate the class without the schema.

@yu-iskw
Copy link
Owner

yu-iskw commented Aug 19, 2024

@MiConnell Let me close this once. Please feel free to reopen it, when it gets ready.

@yu-iskw yu-iskw closed this Aug 19, 2024
@pgoslatara
Copy link

@yu-iskw What actions do you need before this is considered ready? I see semantic_manifest.json listed here so I'm not sure what else is required before we can add this to dbt-artifacts-parser.

@yu-iskw
Copy link
Owner

yu-iskw commented Sep 4, 2024

As far as I know, semantic_manifest.json isn't listed at the subsequent links, because it isn't a part of dbt-core I suppose. But, I don't know dbt Labs make it public. We need JSON schemas which are publicly available to maintain this project so that any developer of this project can regenerate pydantic classes.

@MiConnell
Copy link
Author

To be fair the example semantic manifest file on the docs site wasn't even up to date, I opened a PR to add missing fields so who knows what the actual schema is.

@yu-iskw
Copy link
Owner

yu-iskw commented Sep 5, 2024

It is an example of semantic_manifest.json, not the JSON schema. We need the complete JSON schema to generate a pydantic class.

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

Successfully merging this pull request may close these issues.

Add support for semantic manifest files
3 participants