drobert commented on a change in pull request #19053:
URL: https://github.com/apache/airflow/pull/19053#discussion_r732249957
##########
File path: docs/apache-airflow/tutorial.rst
##########
@@ -410,23 +431,25 @@ Let's break this down into 2 steps: get data & merge data:
@task
def get_data():
+ # NOTE: configure this as appropriate for your airflow environment
data_path = "/usr/local/airflow/dags/files/employees.csv"
url =
"https://raw.githubusercontent.com/apache/airflow/main/docs/apache-airflow/pipeline_example.csv"
- response = requests.request("GET", url)
-
- with open(data_path, "w") as file:
- for row in response.text.split("\n"):
- if row:
- file.write(row + "\n")
+ with requests.get(url, stream=True) as req:
+ req.raise_for_status()
+ with open("/opt/airflow/dags/files/employees.csv", "wb") as file:
+ for chunk in req.iter_content(chunk_size=1024):
+ if chunk:
Review comment:
Unclear to me. It *was* a big deal previous when strings were used and a
trailing newline at the end of the file was causing issues. I can remove but
was also thinking "meh, works fine"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]