Hi we have a mono-repo style code base with differ...
# ask-community
b
Hi we have a mono-repo style code base with different packages working as differnt asset + Repositories ( we are still using repositories ) One of our assets is in package
workflows.inventories.assets
and it is managed within its own definitions and materialization flows. But this asset is a re-usable asset and would like to pass in as input to many other downstream assets in different packages/modules. How do I enable sharing of such assets. if I have
inventories
asset in one package, if it were in same code file, the consumer of inventories would just use it by calling
Copy code
def inventory_consumer(inventories):
  pass
but because inventories is in different package, I am currently getting error
Copy code
Input asset '["inventories"]' for asset '["consolidated_sales"]' is not produced by any of the provided asset ops and is not one of the provided sources
What are my options ?
dagster bot responded by community 1
v
b
Is there a utility method that just converts an asset to source asset, similar to utility methods like
load_assets_from_package_module
something like
load_as_source_asset
explicitly defining a
SourceAsset
breaks my cohesiveness to the actual asset, leaving it for string manipulation values, that make it more fragile and breakage prone
v
You should be able to use
<http://AssetsDefinition.to|AssetsDefinition.to>_source_asset()
https://docs.dagster.io/_apidocs/assets#dagster.AssetsDefinition.to_source_asset
b
Ah ! Thank you