Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce dg.map_asset_specs #26109

Merged
merged 1 commit into from
Nov 25, 2024
Merged

Introduce dg.map_asset_specs #26109

merged 1 commit into from
Nov 25, 2024

Conversation

benpankow
Copy link
Member

@benpankow benpankow commented Nov 23, 2024

Summary

Based on conversation in #25941, introduces a new dg.map_asset_specs function which can be used to map a user-provided function over a set of AssetSpecs and AssetDefinitions.

@multi_asset(specs=[
  AssetSpec(key="foo"),
  AssetSpec(key="bar"),
])
def my_multi_asset():
  ...

my_specs_and_defs = [
  my_multi_asset,
  AssetSpec(key="external")
]

my_mapped_specs_and_defs = map_asset_specs(
  lambda spec: spec.replace_attributes(owners="[email protected]"),
  my_specs_and_defs
)

Test Plan

New unit tests.

Changelog

Introduced dg.map_asset_specs to enable modifying AssetSpecs and AssetsDefinitions in bulk.

@benpankow benpankow requested a review from neverett as a code owner November 23, 2024 00:11
@benpankow
Copy link
Member Author

benpankow commented Nov 23, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

github-actions bot commented Nov 23, 2024

Deploy preview for dagster-docs ready!

Preview available at https://dagster-docs-h6t4kpxch-elementl.vercel.app
https://benpankow-map-specs.dagster.dagster-docs.io

Direct link to changed pages:

@benpankow benpankow force-pushed the benpankow/replace-attributes branch from 04fb74c to 8634ced Compare November 25, 2024 17:07
Base automatically changed from benpankow/replace-attributes to master November 25, 2024 17:52
@benpankow benpankow merged commit d523b22 into master Nov 25, 2024
1 of 3 checks passed
@benpankow benpankow deleted the benpankow/map-specs branch November 25, 2024 18:58
cmpadden pushed a commit that referenced this pull request Dec 5, 2024
## Summary

Based on conversation in #25941, introduces a new `dg.map_asset_specs`
function which can be used to map a user-provided function over a set of
`AssetSpec`s and `AssetDefinitions`.

```python
@multi_asset(specs=[
  AssetSpec(key="foo"),
  AssetSpec(key="bar"),
])
def my_multi_asset():
  ...

my_specs_and_defs = [
  my_multi_asset,
  AssetSpec(key="external")
]

my_mapped_specs_and_defs = map_asset_specs(
  lambda spec: spec.replace_attributes(owners="[email protected]"),
  my_specs_and_defs
)
```


## Test Plan

New unit tests.

## Changelog
> Introduced dg.map_asset_specs to enable modifying `AssetSpec`s and
`AssetsDefinition`s in bulk.
pskinnerthyme pushed a commit to pskinnerthyme/dagster that referenced this pull request Dec 16, 2024
## Summary

Based on conversation in dagster-io#25941, introduces a new `dg.map_asset_specs`
function which can be used to map a user-provided function over a set of
`AssetSpec`s and `AssetDefinitions`.

```python
@multi_asset(specs=[
  AssetSpec(key="foo"),
  AssetSpec(key="bar"),
])
def my_multi_asset():
  ...

my_specs_and_defs = [
  my_multi_asset,
  AssetSpec(key="external")
]

my_mapped_specs_and_defs = map_asset_specs(
  lambda spec: spec.replace_attributes(owners="[email protected]"),
  my_specs_and_defs
)
```


## Test Plan

New unit tests.

## Changelog
> Introduced dg.map_asset_specs to enable modifying `AssetSpec`s and
`AssetsDefinition`s in bulk.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants