or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

asset-management.mdindex.mdlineage-entities.mdnotifier-compatibility.mdopenlineage-integration.mdprovider-verification.mdsecurity-permissions.mdstandard-components.mdversion-compatibility.md

asset-management.mddocs/

0

# Asset Management

1

2

Version-compatible asset and dataset handling with support for asset aliases, collections, and authorization details. This module handles the transition from "Dataset" to "Asset" terminology in Airflow 3.0 while providing a consistent API.

3

4

## Capabilities

5

6

### Core Asset Class

7

8

Main asset/dataset class for representing data dependencies in Airflow workflows.

9

10

```python { .api }

11

class Asset:

12

"""

13

Version-compatible asset/dataset class.

14

15

Maps to airflow.assets.Asset in Airflow 3.0+

16

Maps to airflow.datasets.Dataset in Airflow < 3.0

17

"""

18

```

19

20

### Asset Aliases

21

22

Asset alias class for creating symbolic references to assets that can be resolved at runtime.

23

24

```python { .api }

25

class AssetAlias:

26

"""

27

Version-compatible asset/dataset alias class.

28

29

Maps to airflow.assets.AssetAlias in Airflow 3.0+

30

Maps to airflow.datasets.DatasetAlias in Airflow < 3.0

31

"""

32

```

33

34

### Asset Collections

35

36

Collection classes for representing groups of assets with logical operators.

37

38

```python { .api }

39

class AssetAll:

40

"""

41

Asset collection representing all assets (AND logic).

42

43

Maps to airflow.assets.AssetAll in Airflow 3.0+

44

Maps to airflow.datasets.DatasetAll in Airflow < 3.0

45

"""

46

47

class AssetAny:

48

"""

49

Asset collection representing any asset (OR logic).

50

51

Maps to airflow.assets.AssetAny in Airflow 3.0+

52

Maps to airflow.datasets.DatasetAny in Airflow < 3.0

53

"""

54

```

55

56

### Authorization Details

57

58

Classes for asset authorization and permission management.

59

60

```python { .api }

61

class AssetDetails:

62

"""

63

Asset details for authorization purposes.

64

65

Maps to airflow.assets.AssetDetails in Airflow 3.0+

66

Maps to airflow.datasets.DatasetDetails in Airflow < 3.0

67

"""

68

69

class AssetAliasDetails:

70

"""

71

Asset alias details for authorization purposes.

72

73

Available in Airflow 3.0+ from airflow.api_fastapi.auth.managers.models.resource_details.AssetAliasDetails

74

Note: May not be properly imported in Airflow < 3.0 despite being in __all__

75

"""

76

```

77

78

### Alias Expansion

79

80

Function to expand asset aliases to actual asset instances.

81

82

```python { .api }

83

def expand_alias_to_assets(...):

84

"""

85

Expand asset aliases to actual assets.

86

87

Maps to appropriate expansion function based on Airflow version.

88

"""

89

```

90

91

## Usage Examples

92

93

```python

94

from airflow.providers.common.compat.assets import (

95

Asset,

96

AssetAlias,

97

AssetAll,

98

AssetAny,

99

expand_alias_to_assets

100

)

101

102

# Create assets

103

input_data = Asset("s3://bucket/input.csv")

104

output_data = Asset("s3://bucket/output.csv")

105

106

# Create asset aliases

107

processed_data = AssetAlias("processed_data")

108

109

# Use asset collections

110

all_inputs = AssetAll([input_data, processed_data])

111

any_output = AssetAny([output_data])

112

113

# Expand aliases

114

actual_assets = expand_alias_to_assets(processed_data)

115

116

# Use in DAGs (asset-aware scheduling)

117

from airflow import DAG

118

from airflow.operators.dummy import DummyOperator

119

120

dag = DAG(

121

"example_dag",

122

schedule=[input_data], # Trigger when input_data is updated

123

catchup=False

124

)

125

126

task = DummyOperator(

127

task_id="process_data",

128

outlets=[output_data], # Mark as producing output_data

129

dag=dag

130

)

131

```