-
Notifications
You must be signed in to change notification settings - Fork 43
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 the readme.md example dag to example dags folder #681
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this DAG just a subset of https://github.com/astronomer/astro-sdk/blob/main/example_dags/example_transform.py ?
We could just use that. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@feluelle I didn't see any way to change the size of the code snippet. I'll check and get back. |
README.md
Outdated
), | ||
) | ||
``` | ||
https://github.com/astronomer/astro-sdk/blob/d5aa768b2d4bca72ef98f8d533fe3f99624b172f/example_dags/calculate_popular_movies.py#L1-L37 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about the following instead, thoughts? cc @kentdanas @feluelle @mikeshwe @jwitz
https://github.com/astronomer/astro-sdk/blob/d5aa768b2d4bca72ef98f8d533fe3f99624b172f/example_dags/calculate_popular_movies.py#L1-L37 | |
curl -O https://raw.githubusercontent.com/astronomer/astro-sdk/main/example_dags/calculate_popular_movies.py |
README.md
Outdated
@@ -50,42 +50,7 @@ pip install astro-sdk-python[amazon,google,snowflake,postgres] | |||
|
|||
1. Copy the following DAG into a file named `calculate_popular_movies.py` and add it to the `dags` directory of your Airflow project: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd actually prefer if we kept the DAG code visible in the README. Even though it's longer, the reader won't have to click into another page/ run a command before they see how the SDK works. We can still keep the other DAG file, but this would serve as the window into what the SDK can do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we could embed the code it would be the best scenario from both perspectives
from astro.files import File | ||
from astro.sql.table import Table | ||
|
||
@aql.transform() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we add this back to the README as code, it would be great to add some more inline comments about what the code/ SDK is doing here.
README.md
Outdated
), | ||
) | ||
``` | ||
curl -O https://raw.githubusercontent.com/astronomer/astro-sdk/main/example_dags/calculate_popular_movies.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@utkarsharma2 why did you favour this approach instead of adding the code snipped with permalink? Is it because the permalink would have the version of the code hard-coded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use the permalink, otherwise we could end up having a 404 (completely missing) in our README.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tatiana @feluelle initially permalinks was my approach - 21f7bd8#r949124948
But I guess @kaxil felt the alternative would be better. I personally inclined towards the permalinks approach.
refer below link for that discussion - #681 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I felt that mainly because users would otherwise have to copy/paste it and because of scrolling involved with code-snippet that might result in issues.
However, if all of you think snippet + permalink is a better approach then go for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@utkarsharma2 What if we kept both of them? The code snipped & the curl command - so we would meet the requirement from the doc team while also simplifying for those who may want to download it straightway - without having to have the code hard-coded in the README?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tatiana I think we can keep both if we are able to verify the curl link is working. Just a little worried if move the file somewhere else and the links are broken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tatiana Never mind - CI job takes care of that - gaurav-nelson/github-action-markdown-link-check@v1. I'm going ahead with adding both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind - CI job takes care of that - gaurav-nelson/github-action-markdown-link-check@v1. I'm going ahead with adding both.
Right. That's great! +1 for using main
version.
f2fac59
to
815a607
Compare
README.md
Outdated
imdb_movies = aql.load_file(imdb_src, imdb_movies) | ||
https://github.com/astronomer/astro-sdk/blob/d5aa768b2d4bca72ef98f8d533fe3f99624b172f/example_dags/calculate_popular_movies.py#L1-L37 | ||
|
||
Alternatively you can download the file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively you can download the file | |
Alternatively, you can download the file by running: |
README.md
Outdated
4. Ensure that your Airflow environment is set up correctly by running the following commands: | ||
|
||
top_animations = Table(name="top_animation") | ||
top_animations = top_five_animations(input_table=imdb_movies, output_table=top_animations) | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't fully understand this part. Do we need it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tatiana yes, we do, was a typo fixed it.
Codecov Report
@@ Coverage Diff @@
## main #681 +/- ##
=======================================
Coverage 93.26% 93.26%
=======================================
Files 43 43
Lines 1855 1855
Branches 232 232
=======================================
Hits 1730 1730
Misses 97 97
Partials 28 28 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Description
What is the current behavior?
Currently, we have examples in the README.md file which are not getting tested as we update the code.
closes: #680
What is the new behavior?
We can move our code to example_dags and refer to that file in README.md so that this file is tested with every change.
Does this introduce a breaking change?
Nope
Checklist