https://dagster.io/ logo
#ask-community
Title
# ask-community
k

Kevin Otte

02/08/2023, 1:59 AM
Curious how I should set my project up: Lets take a very simple example - I have 3 tasks (A, B, C) and C is dependent on B and B is dependent on A. In other words it looks like this A->B->C. In each of these tasks, Im querying an API and creating a table in my warehouse. I need to make sure that A finishes before B and B before C. Anyone have good code examples for this? Should I use ops or assets?
🤖 1
sorry for the late night ping @daniel but any chance you could offer guidance here (either tonight if youre around or early AM is fine) ? Im supposed to demo something tomorrow night and Im relying on dagster for orchestrating this.
in my head, it would look something like this:
Copy code
@asset
def asset1():
    write to tableA

@asset(wait_for_asset1_finish)
def asset2():
    write to tableB

@asset(wait_for_asset2_finish)
def asset3():
    write to tableC


test_job = define_asset_job(name="testing")

defs = Definitions(
    assets=[asset1, asset2, asset3],
    jobs=[test_job],
)
d

daniel

02/08/2023, 3:54 AM
in my head, it would look something like this:
Copy code
@asset
def asset1():
    write to tableA
Copy code
@asset
def asset2(asset1):
    write to tableB
Copy code
@asset
def asset3(asset2):
    write to tableC
Copy code
test_job = define_asset_job(name="testing")
Copy code
defs = Definitions(
    assets=[asset1, asset2, asset3],
    jobs=[test_job],
)
k

Kevin Otte

02/08/2023, 4:10 AM
thanks!
2 Views