Hey guys, what is a convenient way to load source ...
# ask-community
r
Hey guys, what is a convenient way to load source assets from different repositories?
Copy code
servis_tickets = SourceAsset(key=AssetKey("usm_request"))

@asset
def test_asset(servis_tickets):
    return servis_tickets

asset_group = AssetGroup(
    assets=[
        test_asset 
    ],
    source_assets=[
        servis_tickets,
    ]
)
Copy code
@asset(
    compute_kind="Pandas",
    metadata={
        "tag": "bronze"
    },
    description=f"{DSN}",
)
def usm_request() -> pd.DataFrame:
    bp_request_data = pd.read_sql_table(
        "usm_request",
        con=bp,
    )
    return bp_request_data

asset_group = AssetGroup([
    usm_request,
])
This is the definition that materializes fine
Above does not work for me:
c
Hi Rasmus. The input argument to
test_asset
is actually the asset key of the source asset, so you'd write this instead:
Copy code
servis_tickets = SourceAsset(key=AssetKey("usm_request"))

@asset
def test_asset(usm_request):
    return usm_request

asset_group = AssetGroup(
    assets=[
        test_asset
    ],
    source_assets=[
        servis_tickets,
    ]
)
But I think this is really unclear and I think we should support inputting the variable name of the source asset. I'll file an issue request and we should be able to reduce confusion about this behavior after fixing.
@Dagster Bot issue source asset variable name fails as input arg to downstream asset
d
r
Awesome, thanks!