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

Allow profiles_yml_filepath to be a str type #419

Merged
merged 11 commits into from
Aug 1, 2023

Conversation

CorsettiS
Copy link
Contributor

Description

In the documentation of astronomer, user-supplied profiles are defined as follows

from cosmos.config import ProfileConfig

profile_config = ProfileConfig(
    profile_name="my_snowflake_profile",
    target_name="dev",
    profiles_yml_filepath="/path/to/profiles.yml",
)

dag = DbtDag(profile_config=profile_config, ...)

however in the code the profiles_yml_filepath crashes if a string is supplied to it, since it assumes a Path type instead of a str type. In the code logic, self.profiles_yml_filepath.exists() crashes if the profiles_yml_filepath is a str. this PR just makes a few adjustment to allow users to supply a custom filepath in a string format without having to wrap it over a Path()

Related Issue(s)


Breaking Change?

No

Checklist

  • I have made corresponding changes to the documentation (if required)
  • I have added tests that prove my fix is effective or that my feature works

@CorsettiS CorsettiS requested a review from a team as a code owner August 1, 2023 09:10
@CorsettiS CorsettiS requested a review from a team August 1, 2023 09:10
@CorsettiS CorsettiS changed the title Change from path to str Allow profiles_yml_filepath to be a str type Aug 1, 2023
@netlify
Copy link

netlify bot commented Aug 1, 2023

👷 Deploy Preview for amazing-pothos-a3bca0 processing.

Name Link
🔨 Latest commit 4a60d38
🔍 Latest deploy log https://app.netlify.com/sites/amazing-pothos-a3bca0/deploys/64c8cc1a9c31250008b999bc

@codecov
Copy link

codecov bot commented Aug 1, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -10.54% ⚠️

Comparison is base (dfabbfe) 89.99% compared to head (4a60d38) 79.45%.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #419       +/-   ##
===========================================
- Coverage   89.99%   79.45%   -10.54%     
===========================================
  Files          48       48               
  Lines        1689     1689               
===========================================
- Hits         1520     1342      -178     
- Misses        169      347      +178     
Files Changed Coverage Δ
cosmos/config.py 90.00% <100.00%> (-2.50%) ⬇️

... and 9 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@harels harels left a comment

Choose a reason for hiding this comment

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

good catch! thanks @CorsettiS!

@harels harels merged commit 9cc5c00 into astronomer:main Aug 1, 2023
22 of 39 checks passed
@CorsettiS CorsettiS deleted the change_from_path_to_str branch August 1, 2023 13:12
tatiana pushed a commit that referenced this pull request Aug 9, 2023
## Description

In the documentation of astronomer, user-supplied profiles are defined
as follows

```
from cosmos.config import ProfileConfig

profile_config = ProfileConfig(
    profile_name="my_snowflake_profile",
    target_name="dev",
    profiles_yml_filepath="/path/to/profiles.yml",
)

dag = DbtDag(profile_config=profile_config, ...)
```

however in the code the _profiles_yml_filepath_ crashes if a string is
supplied to it, since it assumes a Path type instead of a str type. In
the code logic, **self.profiles_yml_filepath.exists()** crashes if the
profiles_yml_filepath is a str. this PR just makes a few adjustment to
allow users to supply a custom filepath in a string format without
having to wrap it over a Path()

## Related Issue(s)

---

## Breaking Change?

No
## Checklist

- [X] I have made corresponding changes to the documentation (if
required)
- [ ] I have added tests that prove my fix is effective or that my
feature works

---------

Co-authored-by: giovanni.corsetti <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Harel Shein <[email protected]>
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.

3 participants