Skip to content

Commit

Permalink
Merge pull request #8 from ekoepplin/addtoactions
Browse files Browse the repository at this point in the history
add to actions
  • Loading branch information
ekoepplin authored Dec 16, 2024
2 parents 04ac38a + eada4b9 commit 945b90b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/run_newsapi_articles_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ name: Run newsapi_articles pipeline from newsapi_pipeline.py
workflow_dispatch: null
env:
DESTINATION__FILESYSTEM__DATASET_NAME: newsapi
NEWSAPI_PIPELINE__DESTINATION__SCHEMA_NAME: "ingest_newsapi_v1"
DESTINATION__FILESYSTEM__BUCKET_URL: ${{ secrets.BUCKET_URL }}
NEWSAPI__DESTINATION__ATHENA__QUERY_RESULT_BUCKET: ${{ secrets.ATHENA__QUERY_RESULT_BUCKET }}
NEWSAPI__DESTINATION__BUCKET_URL: ${{ secrets.NEWSAPI__DESTINATION__BUCKET_URL_PROD }}
Expand Down
5 changes: 4 additions & 1 deletion newsapi_pipeline.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import argparse
from datetime import datetime, timedelta
from pathlib import Path

import dlt
from loguru import logger # Import Loguru
Expand All @@ -9,6 +10,8 @@
today = datetime.utcnow().date()
before_yesterday = today - timedelta(days=2)

target_schema_name: str = dlt.config[f"{Path(__file__).stem}.destination.schema_name"]


# Define a resource for fetching articles from the US
@dlt.resource(table_name="articles_us_en", write_disposition="append")
Expand Down Expand Up @@ -139,7 +142,7 @@ def run_pipeline(destination="filesystem", full_refresh=False):
pipeline = dlt.pipeline(
pipeline_name="newsapi_articles",
destination=destination,
dataset_name="newsapi_data",
dataset_name=target_schema_name,
)

load_info = pipeline.run(
Expand Down

0 comments on commit 945b90b

Please sign in to comment.