question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Explore adding a union type

See original GitHub issue

I think this could leverage a lot of the same stuff the other wrapper types like List and Optional do.

Example from user:

from type import Union



### The reason why I'd like to have something like this is that I want to acts a combiner function that accepts both types of 
### values. I don't want to have to attach config parameters to descriminate the input and output type but it may the direction that I would need to go?
@solid(
    input_defs=[InputDefinition('provider_partials', List[Union[ProviderDataFrame, ProviderSeries]])],
    output_defs=[OutputDefinition(ProviderPartialDataFrame)],
)
def merge_provider_partials(context, provider_partials):
    context.log.info('Merging provider partials to providers')
    partial = pd.concat(provider_partials, axis=1)
    return partial

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
kinghuangcommented, Jun 28, 2020

@schrockn Where can I learn about ScalarUnion? I can’t find anything about it on the docs site.

0reactions
natekuppcommented, Nov 9, 2020

For runtime types, we now have unions via PythonObjectDagsterType. Also looks like ScalarUnion is documented now, but @kinghuang please let us know if you need more info there

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handbook - Unions and Intersection Types
How to use unions and intersection types in TypeScript. ... If 'padding' is a number, then that number of spaces is added to...
Read more >
Learn TypeScript: Union Types Cheatsheet
You can declare a union type consisting of literal types, such as string literals, number literals or boolean literals. These will create union...
Read more >
typescript - combine union type object building
Issue here is that based on type I'll add to "type" I can't figure how to select correct payload type (and return type)....
Read more >
Union Types in TypeScript - YouTube
A union type in TypeScript allows you to declare a value that can have different types.Timeline:00:08 - What is a union type ?00:51...
Read more >
Union Types in Flow & Reason - Jake Zimmerman
In this post, we're going to explore why that's the case. We'll start with a problem which union types can solve, flesh out...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found