I have been looking all over for the answer, but can't seem to find what I'm looking for

I want to create an api endpoint that can pass information to the dagster assets and trigger a run. For example, I have the following asset in dagster

@asset def player_already_registered(player_name: str): q = text( f''' SELECT COUNT(*) FROM `player_account_info` WHERE summonerName = :player_name ''' ) result = database.conn.execute(q, player_name=player_name).fetchone()[0] return bool(result) 

Say that I have an endpoint already made where I can pass the player_name via a get-parameter. How can I pass the parameter to the asset and then run the job itself?

1 Answer

  1. use the instance object provided (docs). You can use the python object "instance" like shown in the link to basically access everything, which you could also acces from dagit. ( I have not excessively used it, but mybe the linke helps you.

  2. Using Dagster GraphQL api (documentation). Nothing done with it yet, so I can only point you to the link

  3. Use partitions (docs). You can use partitions to trigger executing a job for each partition. I am using this often, because it gives you really got control of what assets were materialized with which partitions (parameters). The link leads to an example of a dynamic partition, which is discovered by a sensor, which then executes a job for each partition and also keeps track of the partitions in dagit.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.