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

fix: change target path for nodes defined in yml #11323

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

Conversation

joshuanits
Copy link

Resolves #11321

Problem

Models defined in yaml files (such as the new snapshots) are built to a file path such as target/run/models/schema.yml/schema.yml/snapshot.sql.

This is both unclear and introduces possible collisions if target/run/models/schema.yml is a file.

This path is made from joining the file path models/schema.yml with the 'logical' path schema.yml/snapshot.sql.

Solution

If the basename of the file path matches the dirname of the logical path, construct a new path from:

  • dirname of the file path models/
  • dirname of the logical path, replacing . with _: schema_yml/
  • basename of the logical path: snapshot.sql

Joined result being models/schema_yml/snapshot.sql

Checklist

  • I have read the contributing guide and understand what's expected of me.
  • I have run this code in development, and it appears to resolve the stated issue.
  • This PR includes tests, or tests are not required or relevant for this PR.
  • This PR has no interface changes (e.g., macros, CLI, logs, JSON artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX.
  • This PR includes type annotations for new and modified functions.

@joshuanits joshuanits requested a review from a team as a code owner February 19, 2025 12:42
@cla-bot cla-bot bot added the cla:yes label Feb 19, 2025
@github-actions github-actions bot added the community This PR is from a community member label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes community This PR is from a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Snapshots defined in yaml fail if yaml file exists in target/run directory
1 participant