Guilherme Petris
05/13/2022, 11:35 AMAnna Geller
Anna Geller
prefect diagnosticsGuilherme Petris
05/13/2022, 11:46 AM❯ prefect diagnostics
{
  "config_overrides": {
    "context": {
      "secrets": false
    }
  },
  "env_vars": [],
  "system_information": {
    "platform": "macOS-12.3.1-x86_64-i386-64bit",
    "prefect_backend": "cloud",
    "prefect_version": "1.2.1",
    "python_version": "3.9.10"
  }
}Guilherme Petris
05/13/2022, 11:46 AMGuilherme Petris
05/13/2022, 11:48 AMimport pandas as pd
from zdesk import Zendesk
from prefect.client.secrets import Secret
import prefect
from prefect import task, Flow
import pyarrow as pa
import datetime 
from modules.snowflake_utils import SnowflakeBaseTask
from prefect.executors import LocalDaskExecutor
from prefect.run_configs import LocalRun
from prefect.storage import Local
sn = SnowflakeBaseTask()
# Credentials and connections
zpass = Secret('ZDESK_PASSWORD').get()
zendesk = Zendesk(
    zdesk_email = X
    zdesk_url = Y,
    zdesk_password = zpass,
    zdesk_token= True)
#INCREMENTAL CALL TICKETS
@task
def latest_date():
    latest_date = sn._find_latest_date(
        schema='ZENDESK',
        table='TICKETS',
        date_column='updated_at')
    return print(latest_date)
with Flow("Zendesk_incremental_test",
    run_config = LocalRun(working_dir="/Users/guilherme.petris/Scrive/python_scripts"),
    storage=Local(),
    executor=LocalDaskExecutor()
    ) as flow:
    latest_date()
flow.register("zendesk_project_test")Anna Geller
prefect agent local start -p /Users/guilherme.petris/Scrive/python_scriptsprefect register --project xxx -p your_flow.pyGuilherme Petris
05/13/2022, 12:07 PM-p your_flow.pyAnna Geller
Guilherme Petris
05/13/2022, 12:39 PMAnna Geller
