Selim Raboudi
02/22/2024, 10:32 PMdagster._check.CheckError: Member of iterable mismatches type. Expected (<class 'dagster._core.definitions.assets.AssetsDefinition'>, <class 'dagster._core.definitions.source_asset.SourceAsset'>, <class 'dagster._core.definitions.cacheable_assets.CacheableAssetsDefinition'>). Got [<dagster._core.definitions.assets.AssetsDefinition object at 0x111f27e50>] of type <class 'list'>.
Has anyone faced the same issue ?
Here is my code:
from dagster_airbyte import build_airbyte_assets
from dagster_airbyte import AirbyteCloudResource
from dagster import EnvVar
from dagster import Definitions
airbyte_assets = build_airbyte_assets(
connection_id="4842929b-7169-4024-be39-fd6ff12fZHE4",
destination_tables=["deals", "contacts"],
)
airbyte_instance = AirbyteCloudResource(api_key=EnvVar("AIRBYTE_API_KEY"))
airbyte_definitions = Definitions(
assets=[airbyte_assets], resources={"airbyte": airbyte_instance}
)
Scout
02/22/2024, 10:32 PMassets
parameter is expecting an instance of AssetsDefinition
, SourceAsset
, or CacheableAssetsDefinition
, but it received a list instead.
Based on the documentation, when using build_airbyte_assets
, you should not wrap the result in a list when passing it to the Definitions
object. The build_airbyte_assets
function already returns an AssetsDefinition
object, which is directly usable by the Definitions
object.
Here is the corrected code snippet based on the documentation:
python
from dagster_airbyte import build_airbyte_assets
from dagster_airbyte import AirbyteCloudResource
from dagster import EnvVar
from dagster import Definitions
# Build Airbyte assets
airbyte_assets = build_airbyte_assets(
connection_id="4842929b-7169-4024-be39-fd6ff12fZHE4",
destination_tables=["deals", "contacts"],
)
# Create an AirbyteCloudResource instance
airbyte_instance = AirbyteCloudResource(api_key=EnvVar("AIRBYTE_API_KEY"))
# Define Dagster Definitions
airbyte_definitions = Definitions(
assets=airbyte_assets, # Pass the AssetsDefinition object directly, without wrapping it in a list
resources={"airbyte": airbyte_instance}
)
Make sure to pass airbyte_assets
directly to the Definitions
object without wrapping it in a list. This should resolve the type mismatch error you are encountering. If you continue to face issues, please refer to the documentation or consider reaching out to the community for further assistance. issue with build_airbyte_assets using ai... button DagsterInvalidDefinitionError when creat... button [dagster-airbyte] TypeError with Airbyte... button Dagster Docs button Thank you for your feedback!Selim Raboudi
02/22/2024, 10:36 PMSelim Raboudi
02/22/2024, 10:42 PMScout
02/22/2024, 10:42 PMScout
02/22/2024, 10:43 PMSelim Raboudi
02/22/2024, 10:55 PMScout
02/22/2024, 10:59 PM