Skip to content

How to iterate over the output of a solid? #3211

Answered by helloworld
abelsonlive asked this question in Q&A
Discussion options

You must be logged in to vote

We don't have support for mapping over results like this yet, but it is planned for an upcoming release. Here is the relevant issue: #462. @catherinewu can give more info here.

You could refactor this to do all the mapping in each solid. Here's one way to re-organize this logic:

from dagster import pipeline, solid
from my_dags import resources,  modes

SOURCE_SCHEMA='pantheon'
DEST_SCHEMA='raw_mysql_drupal'

@solid(required_resource_keys={'mysql_drupal'})
def fetch_mysql_tables(context):
    result = context.resources.mysql_drupal.query(
        f"SELECT table_name FROM information_schema.tables WHERE schema_name='{SOURCE_SCHEMA}'"
    )

    yield Output([table in result.table_name])

@s…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@helloworld
Comment options

@abelsonlive
Comment options

Answer selected by helloworld
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants