Hi All! quick question, previously in prefect vers...
# prefect-community
f
Hi All! quick question, previously in prefect version 0.14.17 a flow could be visualized as long as the package
prefect[viz]
was installed, but with the current version ,<2.3.1> , I'm having difficulties get some basic code to work - Could someone please assist? Thanks!
Copy code
import requests
from pprint import pprint as pp
from prefect import flow, task, Flow
import pandas as pd
import json

## extract

@task(name="extract")
def get_data():
    r = requests.get("<https://rickandmortyapi.com/api/character/>")
    return r.json()

@task
def transform(r: dict):
    df = pd.json_normalize(r["results"])
    print(df)

@task(name="load")
def write_frame(df: pd.DataFrame):
    pass

"""
## This is the way to visualize flow before current version

with Flow("ETL") as flow:
    e = get_data()
    t = transform(e)
    l = write_frame(t)
flow.visualize()
"""

@flow
def flow_test():
    e = get_data()
    t = transform(e)
    l = write_frame(t)
    
flow_test().visualize() # This doesn't work...
1
a
Prefect 2 is an entirely different product, check our docs at docs.prefect.io and https://www.prefect.io/guide/blog/the-global-coordination-plane/
in short, Prefect 2 doesn't have this kind of pre-run visualization feature as of today and to get a view of that, you could first run it locally with an ephemeral API and a testing profile before running your flows in production