Skip to content

prefect.artifacts

Interface for creating and reading artifacts.

Create a link artifact.

Parameters:

Name Type Description Default
- link

The link to create.

required

Returns:

Type Description
UUID
  • The table artifact ID.
Source code in /home/runner/work/docs/docs/prefect_source/src/prefect/artifacts.py
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
@sync_compatible
async def create_link_artifact(
    link: str,
    link_text: Optional[str] = None,
    key: Optional[str] = None,
    description: Optional[str] = None,
) -> UUID:
    """
    Create a link artifact.

    Args:
        - link: The link to create.

    Returns:
        - The table artifact ID.
    """
    formatted_link = f"[{link_text}]({link})" if link_text else f"[{link}]({link})"
    artifact = await _create_artifact(
        key=key,
        type="markdown",
        description=description,
        data=formatted_link,
    )

    return artifact.id

create_markdown_artifact async

Create a markdown artifact.

Parameters:

Name Type Description Default
- markdown

The markdown to create.

required

Returns:

Type Description
UUID
  • The table artifact ID.
Source code in /home/runner/work/docs/docs/prefect_source/src/prefect/artifacts.py
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
@sync_compatible
async def create_markdown_artifact(
    markdown: str,
    key: Optional[str] = None,
    description: Optional[str] = None,
) -> UUID:
    """
    Create a markdown artifact.

    Args:
        - markdown: The markdown to create.

    Returns:
        - The table artifact ID.
    """
    artifact = await _create_artifact(
        key=key,
        type="markdown",
        description=description,
        data=markdown,
    )

    return artifact.id

create_table_artifact async

Create a table artifact.

Parameters:

Name Type Description Default
- table

The table to create.

required

Returns:

Type Description
UUID
  • The table artifact ID.
Source code in /home/runner/work/docs/docs/prefect_source/src/prefect/artifacts.py
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
@sync_compatible
async def create_table_artifact(
    table: Union[Dict[str, List[Any]], List[Dict[str, Any]]],
    key: Optional[str] = None,
    description: Optional[str] = None,
) -> UUID:
    """
    Create a table artifact.

    Args:
        - table: The table to create.

    Returns:
        - The table artifact ID.
    """
    formatted_table = json.dumps(table) if isinstance(table, list) else table

    artifact = await _create_artifact(
        key=key,
        type="table",
        description=description,
        data=formatted_table,
    )

    return artifact.id