Skip to content

Commit

Permalink
Added snippet file
Browse files Browse the repository at this point in the history
  • Loading branch information
r34ctor committed Aug 7, 2024
1 parent f4f8098 commit 5373572
Showing 1 changed file with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# <snippet name="cloud/connect/0.18-airflow_example_dag.py full example code">
import os

import pendulum
from airflow.decorators import dag, task

import great_expectations as gx


@dag(
schedule=None,
start_date=pendulum.datetime(2023, 8, 9),
catchup=False,
)
def gx_dag_with_deco():
os.environ["NO_PROXY"] = "*" # https://github.com/apache/airflow/discussions/24463
print("Great Expectations DAG Started")

@task
def run_checkpoint():
print("Running Checkpoint")
# Replace <YOUR_ACCESS_TOKEN>, <YOUR_CLOUD_ORGANIZATION_ID>, and <CHECKPOINT_NAME> with your credentials
# You can also set GX_CLOUD_ACCESS_TOKEN and GX_CLOUD_ORGANIZATION_ID as environment variables
GX_CLOUD_ACCESS_TOKEN = "<YOUR_ACCESS_TOKEN>"
GX_CLOUD_ORGANIZATION_ID = "<YOUR_CLOUD_ORGANIZATION_ID>"
# alternativey set CHECKPOINT_NAME to be a runtime parameter
CHECKPOINT_NAME = "<CHECKPOINT_NAME>"
context = gx.get_context(
cloud_access_token=GX_CLOUD_ACCESS_TOKEN,
cloud_organization_id=GX_CLOUD_ORGANIZATION_ID,
)
checkpoint = context.get_checkpoint(name=CHECKPOINT_NAME)
checkpoint.run()
return f"Checkpoint ran: {CHECKPOINT_NAME}"

run_checkpoint()


run_this = gx_dag_with_deco()

0 comments on commit 5373572

Please sign in to comment.