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

Malo PARIS

03/13/2023, 7:58 AM
Hi all, I hope you'r good :) One question : My goal is to be sure the connection is OK before executing extraciton assets. I tried to do it with a @CREATE_CONNECTION asset passing the connection object to @EXTRACT_ASSETS, if the connection is valid. How we can do it ? I think it's related to 'dagster type' but did'nt manage to make it work … Thanks for your help :) Example code of what i try to acheive :
@asset(key_prefix=["ETL"],compute_kind="Connection")
def CREATE_CONNECTION():
my_connection = RFC(user="xxxx",
passwd="xxxxx", system="xxxx")
return my_connection
@asset(key_prefix=["ETL"])
def EXTRACT_TABLE(CREATE_CONNECTION):
DATA = CREATE_CONNECTION.get_table(arg…)
return DATA
dagster bot responded by community 1
v

Vinnie

03/13/2023, 9:28 AM
Instead of putting the connection in an asset, which is meant to represent a persistent data object, you should wrap it in a
ResourceDefinition
https://docs.dagster.io/concepts/resources When using resources, the computation for the asset/job/op will only kick off once the resource is done initializing
❤️ 1
m

Malo PARIS

03/13/2023, 10:29 AM
I will try this appoach, thanks :)