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

Can you add a slightly more realistic example of a data pipeline in the cloud? #55

Closed
r39132 opened this issue Jun 21, 2015 · 3 comments

Comments

@r39132
Copy link
Contributor

r39132 commented Jun 21, 2015

For example, the Luigi example walks through a case that involves importing data into a DB. It would be cool if there were some examples that read from one location (e.g. S3) and wrote to another (e.g. DB).

@artwr
Copy link
Contributor

artwr commented Jun 22, 2015

We have an operator that transfers files from s3 to Hive, as well as a Hive to Mysql operator, which is unfortunately missing from the documentation. The hooks being already in place, a s3 to Postgres operator should not be too difficult. Here is an example of how our s3 to Hive operator would work :

from collections import OrderedDict
from airflow.operators import S3ToHiveTransfer

S3ToHiveTransfer(
    task_id='s3_to_hive',
    s3_key='s3://bucket-name/user_list_{{ ds }}.tsv',
    field_dict=OrderedDict([("user_id", "BIGINT")
                            , ("first_name", "STRING")
                            , ("last_name", "STRING")
                            , ("registered_at", "TIMESTAMP")]),
    hive_table='{{ params.db_name }}.user_list_{{ ds_nodash }}',
    create=True,
    recreate=True,
    delimiter='\t',
    s3_conn_id='s3_connection_name',
    dag=dag)

Usually, the transfer is a separate operation of any transform and has its own operator.
I hope this helps.
Best,
Arthur

@mistercrunch
Copy link
Member

Agreed, the current tutorial is really just focused on the mechanics of Airflow with very foobar-y examples. I didn't want to write a pipeline that was too stack specific (MySQL / Hive / ...) and wanted to make sure it would work for anyone, regardless of the stack they might have.

Maybe using a SqliteOperator to do some analytics on some data scraped from the Internet would be a good example. It could be interesting to re-write the Luigi example for comparison :)

But yeah, it's on the TODO list.

@r39132
Copy link
Contributor Author

r39132 commented Jun 22, 2015

Cool. I'll close this for now.

@r39132 r39132 closed this as completed Jun 22, 2015
mobuchowski pushed a commit to mobuchowski/airflow that referenced this issue Jan 4, 2022
Signed-off-by: wslulciuc <willy@datakin.com>
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

No branches or pull requests

3 participants